Description Usage Arguments Details Value Author(s) References See Also Examples
Generates simulations for permutation test, which is performed to obtain the p-value for the enrichment score of a given hub for a specified module during the wKDA process.
1 | kda.analyze.simulate(o, g, nmemb, nnodes, nsim)
|
o |
Observed enrichment score of a hub node assigned for a given module. |
g |
Sub-graph of a given hub and its neighbors (hubnet). |
nmemb |
Number of the members included in a given module. |
nnodes |
Number of the nodes in the whole graph (network) of the dataset. |
nsim |
Number of the iterations (simulations) performed for the permutation test. |
kda.analyze.simulate
performs permutation tests to obtain
p-values for the enrichment score of a given hub node for a given module.
It takes the observed enrichment score of the given hub, hubnet (subgraph
of the hub and its neighbors), number of the members of the given module,
total number of the nodes in the entire graph of the dataset, and number of
the simulations for the permutation test.
In each iteration (simulation), it samples nmemb
nodes randomly
among the entire nodes of the graph. Then, it tests the overlapped nodes
among the randomly chosen nodes and the given node's neigborhood. At the
end, it obtains an enrichment score for each simulation and evaluates these
permuted enrichment scores with respect to the observed enrichment score of
the hub. Among nsim
random simulations; maximally, enrichment scores
of 10 iterations are allowed to be greater than the observed (actual)
enrichment score of the hub. If this limitation is exceeded, simulation
will be finalized at that point and the enrichment score list of the
iterations will be returned.
x |
A list containing enrichment scores of the simulation's iterations |
Ville-Petteri Makinen
Shu L, Zhao Y, Kurt Z, Byars SG, Tukiainen T, Kettunen J, Orozco LD, Pellegrini M, Lusis AJ, Ripatti S, Zhang B, Inouye M, Makinen V-P, Yang X. Mergeomics: multidimensional data integration to identify pathogenic perturbations to biological systems. BMC genomics. 2016;17(1):874.
kda.analyze
, kda.analyze.exec
,
kda.analyze.test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | job.kda <- list()
job.kda$label<-"HDLC"
## parent folder for results
job.kda$folder<-"Results"
## Input a network
## columns: TAIL HEAD WEIGHT
job.kda$netfile<-system.file("extdata","network.mouseliver.mouse.txt",
package="Mergeomics")
## Gene sets derived from ModuleMerge, containing two columns, MODULE,
## NODE, delimited by tab
job.kda$modfile<- system.file("extdata","mergedModules.txt",
package="Mergeomics")
## "0" means we do not consider edge weights while 1 is opposite.
job.kda$edgefactor<-0.0
## The searching depth for the KDA
job.kda$depth<-1
## 0 means we do not consider the directions of the regulatory interactions
## while 1 is opposite.
job.kda$direction<-1
job.kda$nperm <- 20 # the default value is 2000, use 20 for unit tests
## kda.start() process takes long time while seeking hubs in the given net
## Here, we used a very small subset of the module list (1st 10 mods
## from the original module file):
moddata <- tool.read(job.kda$modfile)
mod.names <- unique(moddata$MODULE)[1:min(length(unique(moddata$MODULE)),
10)]
moddata <- moddata[which(!is.na(match(moddata$MODULE, mod.names))),]
## save this to a temporary file and set its path as new job.kda$modfile:
tool.save(moddata, "subsetof.supersets.txt")
job.kda$modfile <- "subsetof.supersets.txt"
## Let's prepare KDA object for KDA:
job.kda <- kda.configure(job.kda)
job.kda <- kda.start(job.kda)
job.kda <- kda.prepare(job.kda)
set.seed(job.kda$seed)
i = 1 ## index of the module, whose p-val is calculated:
memb <- job.kda$module2nodes[[i]]
graph <- job.kda$graph ## we need to import a network
nsim <- job.kda$nperm ## number of simulations
## This auxiliary function is called by kda.analyze.exec(), which is called
## by kda.analyze() main function, see this main function for more details
hubs <- graph$hubs
hubnets <- graph$hubnets
nhubs <- length(hubs)
nnodes <- length(graph$nodes)
nmemb <- length(memb)
## Observed enrichment scores.
# obs <- rep(NA, nhubs)
# k <- 1 ## actual using: for(k in 1:nhubs){}, for unit test, use the 1st hub
# g <- hubnets[[hubs[k]]]
# obs[k] <- kda.analyze.test(g$RANK, g$STRENG, memb, nnodes)
## Estimate P-values.
# pvals <- rep(NA, nhubs)
# for(k in which(obs > 0)) {
# g <- hubnets[[hubs[k]]]
## First pass:
# x <- kda.analyze.simulate(obs[k], g, nmemb, nnodes, 200)
## Then, use x to estimate preliminary and final P-values.
## See kda.analyze() for more detail
## Remove the temporary files used for the test:
file.remove("subsetof.supersets.txt")
## remove the results folder
unlink("Results", recursive = TRUE)
# } ## finishing for loop
|
Writing to file...
Saved 1346 rows in 'subsetof.supersets.txt'.
[1] "subsetof.supersets.txt"
KDA Version:12.7.2015
Parameters:
Search depth: 1
Search direction: 1
Maximum overlap: 0.33
Minimum module size: 20
Minimum degree: automatic
Maximum degree: automatic
Edge factor: 0
Random seed: 1
Importing edges...
TAIL HEAD WEIGHT
Length:140663 Length:140663 Min. :1
Class :character Class :character 1st Qu.:1
Mode :character Mode :character Median :1
Mean :1
3rd Qu.:1
Max. :1
Importing modules...
MODULE NODE
Length:825 Length:825
Class :character Class :character
Mode :character Mode :character
Graph: 7.251717 Mb
Minimum degree set to 20
Maximum degree set to 278
Collecting hubs...
4876 hubs (25.21%)
Graph: 12.46993 Mb
[1] TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.