scudoNetwork-methods: Create graph from a ScudoResults object

scudoNetworkR Documentation

Create graph from a ScudoResults object

Description

A function to create an igraph object from a ScudoResults object. In the graph, nodes are samples and edges quantify the similarity between the nodes.

Usage

scudoNetwork(object, N, colors = character())

Arguments

object

a ScudoResults object

N

a number between 0 and 1, representing the fraction of the signature-to-signature distances that will be used to draw the graph

colors

a character vector of hexadecimal RGB color codes used to color the nodes of the graph. length(colors) must be equal to the number of samples. By default colors are chosen according to the groups in object

Details

This function uses the distance matrix in the ScudoResults object to generate an igraph object, representing a graph where nodes are samples and edges quantify the similarity between the signatures of pairs of nodes.

The distance matrix in object is used to generate an unweighted adjacency matrix, that is then used to generate the graph. The sample quantile of probability N, computed from all the non-zero distances in the distance matrix, is used as a threshold to generate the adjacency matrix: all the distances larger than this quantile are mapped to 0, all the distances smaller than this quantile are mapped to 1 (with the exception of the distances of any node from itself, which are equal to 0).

Distances are set as attributes of the edges. Use igraph::E(igraphObject)$distance to retrieve them, where igraphObject is the result of scudoNetwork.

The color parameter controls the color of the nodes. It must be a vector of hexadecimal RGB color codes (like "#FFFFFF"), with length equal to the number of samples in object. By default, a different color is assigned to each group. If no group is specified in object, all nodes are set to the same color. A vector of node colors can be accessed with igraph::V(igraphObject)$color. Use igraph::V(igraphObject)$group to access the group label of each node (it returns NULL if no group is specified in object).

Value

An object of class igraph.

Author(s)

Matteo Ciciani matteo.ciciani@gmail.com, Thomas Cantore cantorethomas@gmail.com

See Also

scudoCytoscape, ScudoResults, igraph

Examples

# generate dummy dataset and run scudo
exprData <- data.frame(a = 11:20, b = 16:25,
    c = rev(1:10), d = c(1:2, rev(3:10)))
rownames(exprData) <- letters[11:20]
grps <- as.factor(c("G1", "G1", "G2", "G2"))
nTop <- 2
nBottom <- 3

res <- scudoTrain(exprData, grps, nTop, nBottom, foldChange = FALSE,
    featureSel = FALSE)

# generate network
col <- c("#FF0000", "#FF0000", "#0000FF", "#0000FF")
net <- scudoNetwork(res, N = 0.5, colors = col)

# retrieve node colors and groups
nodes <- igraph::V(net)
colors <- nodes$color
groups <- nodes$group

# retrieve distances from edges
edges <- igraph::E(net)
dist <- edges$distance

# plot the network
scudoPlot(net)


Matteo-Ciciani/scudo documentation built on Feb. 3, 2024, 9:41 a.m.