mean_rank_for_known_geodesic_distance: Mean rank of edges corresponding to known gene-gene...

Description Usage Arguments Details Value Examples

View source: R/mean_rank_for_known_geodesic_distance.R

Description

This function computes the mean rank of edges in a reconstructed network, where each edge corresponds to two genes with a given geodesic distance in the known gene-gene interaction network. A distance of 1 corresponds to direct interactions, while higher distances correspond to indirect interactions in the known interaction network.

Usage

1
2
3
4
5
6
mean_rank_for_known_geodesic_distance(
  net,
  known,
  d = 1:3,
  known.threshold = 1e-10
)

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.

d

integer vector. A list of positive-valued geodesic distances in the known interaction network.

known.threshold

numeric. The value must be in the rage [0,1]. If known interaction weight is greater than or equal to known.threshold, the corresponding edge is considered true.

Details

Values in net must be unsigned. 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. A NA value will be treated as an edge with a -Inf value, i.e. an edge with very low confidence.

Each value in known must be in the range [0, 1], where a value greater than or equal to known.threshold indicates the presence of an edge. A NA in known indicates there is no known interaction between the corresponding genes (similar to zeros) and the geodesic distance between these genes is considered indeterminate (unlike zeros) i.e., not included in the edges with a given finite geodesic distance. The corresponding edge is also excluded while computing ranks in the reconstructed network net.

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 numeric vector of the same length as d containing the mean ranks corresponding to the distance values in d.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 = matrix(rbinom(length(genes)^2, 1 , 0.5), nrow = length(genes), dimnames = list(genes, genes))
dummy_ppi[lower.tri(dummy_ppi)] = t(dummy_ppi)[lower.tri(dummy_ppi)]  # symmetric ppi
d = 1:3
mean_ranks = mean_rank_for_known_geodesic_distance(net = dummy_net,
                                                   known = dummy_ppi,
                                                   d = d)
barplot(
  mean_ranks,
  main = "Mean ranks of edges in learned network",
  xlab = "Known interaction distance",
  ylab = "Mean Rank",
  names.arg = d
)
barplot(
  c(
    mean_ranks[1] - mean_ranks[2],
    mean_ranks[2] - mean_ranks[3]
  ),
  main = "Differences between mean ranks of two known distances",
  xlab = "Known geodesic distances",
  ylab = "Difference in mean rank",
  names.arg = c("1-2", "2-3")
)

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