coexpression_known_interactions_auc: Area under the curve of a co-expression network to find known...

Description Usage Arguments Details Value Examples

View source: R/coexpression_known_interactions_auc.R

Description

This function computes the area under the precision-recall curve and the ROC curve. The area is computed by the PRROC package using known gene-gene interaction scores.

Usage

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

Arguments

net

matrix or data.frame. A gene x gene matrix representing edge weights between genes in a co-expression network. See details.

known

matrix or data.frame. A gene x gene matrix representing the probability that edges between genes true. See details.

curve

logical. Should the curves be returned?

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.ignore

character representing how NA's should be handled. Accepted values are 'net', 'known' and 'any'. If 'net', edges with NA weight in net are ignored. If 'known', edges with NA weight in known are ignored. If 'any', edges with NA weight in either net or known are ignored.

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 known must be in the range [0, 1] representing the probability that the corresponding edge (interaction) is true. While the values in net are not limited to any range, each value 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.

Both net and known must be square matrices of same dimension. Either both or none of the matrices should have row and column names. If available, the set of row names and column names must be unique and same in each matrix. The set of row and columns names of both matrices should also be same. Both matrices must be symmetric when rows and columns are in the same order. Diagonal entries in the matrices 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
15
16
genes = sprintf("G%d", 1:10)
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
dummy_ppi = abs(dummy_net + rnorm(length(dummy_net)))
dummy_ppi = (dummy_ppi + t(dummy_ppi)) / (2 * max(dummy_ppi))  # symmetric ppi
auc_res = coexpression_known_interactions_auc(
  net = dummy_net,
  known = dummy_ppi,
  curve = TRUE,
  max.compute = TRUE,
  min.compute = 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, max.plot = TRUE, min.plot = TRUE, fill.area = TRUE)
plot(auc_res$roc, max.plot = TRUE, min.plot = TRUE, fill.area = TRUE)

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