Generate local null model p-value
localNullModel.Rd
This function keeps the number of connections of each nodes in the graph but it rewires the partners of connections and produces modularity score. When it repeats multiple time, a modularity score distribution will be used to produce netbox loacl p-value.
Arguments
- netboxGraph
igraph network graph object. This igraph object contains NetBox algorithm identified network from
geneConnector
function- iterations
numeric value for number of iterations
Value
a list of returned results
randomModularityScore: vector of modularity scores in the iterations of local re-wiring randomization process
randomMean: numeric value of mean of modularity scores in the iterations of local re-wiring randomization process
randomSD: numeric value of standard deviation of modularity scores in the iterations of local re-wiring randomization process
modularityScoreObs: numeric value of observed modularity score in the NetBox algorithm identified network
zScore: numeric value of z-score
pValueObs: numeric value of observed p-value
Author
Eric Minwei Liu, emliu.research@gmail.com
Examples
data(netbox2010)
sifNetwork<-netbox2010$network
graphReduced <- networkSimplify(sifNetwork,directed = FALSE)
#> Loading network of 9264 nodes and 157780 interactions
#> Treated as undirected network
#> Removing multiple interactions and loops
#> Returning network of 9264 nodes and 68111 interactions
geneList<-as.character(netbox2010$geneList)
results<-geneConnector(geneList=geneList,networkGraph=graphReduced,
pValueAdj='BH',pValueCutoff=0.05,
communityMethod='lec',keepIsolatedNodes=FALSE)
#> 274 / 517 candidate nodes match the name in the network of 9264
#> nodes
#> Only test neighbor nodes with local degree equals or exceeds 2
#> Multiple hypothesis corrections for 892 neighbor nodes in the network
#> For p-value 0.05 cut-off, 6 nodes were included as linker nodes
#> Connecting 274 candidate nodes and 6 linker nodes
#> Remove 208 isolated candidate nodes from the input
#> Final network contains 72 nodes and 152 interactions
#> Detecting modules using "leading eigenvector" method
names(results)
#> [1] "netboxGraph" "netboxCommunity" "netboxOutput" "nodeType"
#> [5] "moduleMembership" "neighborData"
# Suggested 1000 iterations.
# Use 10 interations in the exampel to save running time.
localTest <- localNullModel(netboxGraph=results$netboxGraph, iterations=10)
#> ###########
#> Based on 10 random trails
#> Random networks: mean modularity = 0.308
#> Random networks: sd modularity = 0.049
#> Observed network modularity is: 0.519
#> Observed network modularity z-score is: 4.348
#> One-tail p-value is: 6.861e-06