getEnr {netDx} | R Documentation

## Get ENR for all networks in a specified directory

### Description

Get ENR for all networks in a specified directory

### Usage

    getEnr(netDir, pheno_DF, predClass, netGrep = "_cont.txt$",
      enrType = "binary", ...)

### Arguments

`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` param; all other values are considered non-predictor class Rows with duplicate IDs will be excluded.
`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 `countIntType_batch`

### Details

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.

### Value

(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

### Examples

    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$")

[Package netDx version 1.0.3 Index]