coexpression_shared_pathway_auc: Evaluate co-expression network's ability to find edges where...

Description Usage Arguments Details Value Examples

View source: R/coexpression_shared_pathway_auc.R

Description

If both genes of an edge is available in at least one pathway (gene set), the edge is considered positive. Using the edge weights as the score for the positive class, this function computes both the area under the precision-recall curve and the area under the ROC curve.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
coexpression_shared_pathway_auc(
  net,
  pathways,
  curve = F,
  max.compute = F,
  min.compute = F,
  rand.compute = F,
  dg.compute = F,
  na.rm = F,
  neg.treat = "error"
)

Arguments

net

matrix or data.frame. A gene x gene matrix representing edge weights between genes in a co-expression network. Gene names must be available as row and column names. See details.

pathways

list. List of pathways where each entry contains the genes in each pathway. Pathway names may be provided as names(pathways). If provided, pathway names must be unique.

curve

logical. Should the curves, required for plotting, be generated?

max.compute

logical. Should the maximum area under the curve be computed?

min.compute

logical. Should the minimum area under the curve be computed?

rand.compute

logical. Should the are under the curve for a random classifier be computed?

dg.compute

logical. Should the area under the precision-recall curve according to the interpolation of Davis and Goadrich be computed?

na.rm

logical. Should edges with NA weights be excluded? If FALSE, net cannot have any edge with NA weight.

neg.treat

character representing how negative values in net should be treated. Accepted values are 'none', 'warn' and 'error'. If 'allow', negative values are allowed. If 'warn', a warning is generated. If 'error', an error is generated.

Details

Each value in net should represent the relative probability that the corresponding edge is true. In other words, larger values should represent higher confidence in corresponding edges. If the sign of values in net represents positive or negative associations between genes, you probably should provide absolute values. If you still want to allow negative values in net, you may set neg.treat = "allow". In this case, any negative value will represent lower confidence than any non-negative value.

net must be a square matrix. Gene names must be available as row and column names. Gene names must be unique. net must be symmetric when rows and columns are identically ordered. Diagonal entries are ignored.

Value

A list object with the following items.

pr

Precision-recall curve object. See pr.curve for details.

roc

ROC curve object. See roc.curve for details.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
require(msigdbr)
msigdb_df = as.data.frame(msigdbr(species = "Homo sapiens", category = "H"))
pathways = tapply(msigdb_df$human_gene_symbol, msigdb_df$gs_id, FUN = c)
genes = c('TP53', 'RBM3', 'SF3', 'LIM12', 'ATM', 'TMEM160', 'BCL2L1', 'MDM2',
          'PDR', 'MEG3', 'EGFR', 'CD96', 'KEAP1', 'SRSF1', 'TSEN2')
dummy_net = matrix(rnorm(length(genes)^2), nrow = length(genes), dimnames = list(genes, genes))
dummy_net = abs((dummy_net + t(dummy_net))/2)                    # symmetric network
auc_res = coexpression_shared_pathway_auc(net = dummy_net,
                                          pathways = pathways,
                                          curve = TRUE)
print(sprintf('AUC under the precision-recall curve: %s', auc_res$pr$auc.integral))
print(sprintf('AUC under the ROC curve: %s', auc_res$roc$auc))
plot(auc_res$pr)
plot(auc_res$roc)

alorchhota/spice documentation built on March 12, 2021, 12:05 a.m.