Description Usage Arguments Details Value Examples
View source: R/sparsenet_enrichment_functions.R
Get ENR for all networks in a specified directory
1 2 3 4 5 6 7 8 |
netDir |
(char) directory containing interaction networks |
pheno_DF |
(data.frame) table with patient ID and status.
Must contain columns for Patient ID (named "ID") and class
(named "STATUS"). Status should be a char; value of predictor class
should be specified in |
predClass |
(char) value for patients in predictor class |
netGrep |
(char) pattern for grep-ing network text files, used in dir(pattern=..) argument |
enrType |
(char) how enrichment should be computed. Options are: 1) binary: Skew of number of (+,+) interactions relative to other interactions. Used when all edges in network are set to 1 (e.g. shared CNV overlap) 2) corr: 0.5*((mean weight of (+,+) edges)-(mean weight of other edges)) |
... |
arguments for |
For each network, compute the number of (+,+) and other (+,-),(-,+),(-,-) interactions. From this compute network ENR. The measure of (+,+)-enrichment is defined as: ENR(network N) = ((num (+,+) edges) - (num other edges))/(num edges). A network with only (+,+) interactions has an ENR=1 ; a network with no (+,+) interactions has an ENR=-1; a network with a balance of the two has ENR=0.
(list):
1) plusID (char) vector of + nodes
2) minusID (char) vector of - nodes
3) orig_rat (numeric) ENR
for data networks
4) fList (char) set of networks processed
5) orig (data.frame) output of countIntType_batch
for input
networks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | d <- tempdir()
options(stringsAsFactors=FALSE)
pids <- paste("P",seq_len(5),sep="")
pheno <- data.frame(ID=pids,STATUS=c(rep("case",3),rep("control",2)))
# write PSN
m1 <- matrix(c("P1","P1","P2","P2","P3","P4",1,1,1),byrow=FALSE,ncol=3)
write.table(m1,file=paste(d,"net1.nettxt",sep=getFileSep()),sep="\t",
col.names=FALSE,row.names=FALSE,quote=FALSE)
m2 <- matrix(c("P3","P4",1),nrow=1)
write.table(m2,file=paste(d,"net2.nettxt",sep=getFileSep()),sep="\t",
col.names=FALSE,row.names=FALSE,quote=FALSE)
# compute enrichment
x <- countPatientsInNet(d,dir(d,pattern=c("net1.nettxt","net2.nettxt")), pids)
getEnr(d,pheno,"case","nettxt$")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.