Description Usage Arguments Details Value Examples
View source: R/mean_rank_for_known_geodesic_distance.R
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.
1 2 3 4 5 6 | mean_rank_for_known_geodesic_distance(
net,
known,
d = 1:3,
known.threshold = 1e-10
)
|
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 |
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.
A numeric vector of the same length as d
containing
the mean ranks corresponding to the distance values in d
.
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")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.