getOR: Get relative proportion of patient classes that contribute to...

Description Usage Arguments Details Value Examples

View source: R/sparsenet_enrichment_functions.R

Description

Get relative proportion of patient classes that contribute to a set of networks

Usage

1
getOR(pNetworks, pheno_DF, predClass, netFile, verbose = TRUE)

Arguments

pNetworks

(matrix) rows are patients, columns are network file filenames. a[i,j] = 1 if patient i has a structural variant in network j; else a[i,j] = 0

pheno_DF

(data.frame) Column "ID" has unique patient identifiers; column "STATUS" has patient class

predClass

(char) Class for which predictor is being built

netFile

(char) vector of networks of interest (e.g. those passing feature selection)

verbose

(logical) print messages

Details

Feature selected networks should have the property of being enriched in the class of interest; e.g. be enriched in 'case' relative to 'control'. When given a list of networks N, this method computes the number and proportion of patients that overlap N. A high relative fraction of the predicted class indicates successful feature selection. To create a ROC or precision-recall curve, several calls can be made to this function, one per cutoff.

Value

List. 1) stats: statistics on group overlap with , This is a 2xK matrix, where rows are classes (predClass,other), and columns are: total samples, samples overlapping nets, 2) relEnr: relative enrichment of predClass over other

Examples

 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.txt",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.txt",sep=getFileSep()),sep="\t",
col.names=FALSE,row.names=FALSE,quote=FALSE)

# compute enrichment
x <- countPatientsInNet(d,dir(d,pattern=c("net1.txt","net2.txt")), pids)
getOR(x,pheno,"case",colnames(x)) # should give large RelEnr

BaderLab/netDx documentation built on Sept. 26, 2021, 9:13 a.m.