This function computes edge weights based on a gene expression profile.
assignEdgeWeights(
microarray,
graph,
use.attr,
y,
weight.method = "cor",
complex.method = "max",
missing.method = "median",
same.gene.penalty = "median",
bootstrap = 100,
verbose = TRUE
)
Microarray should be a Dataframe or a matrix, with genes as rownames, and samples as columns.
An annotated igraph object.
An attribute name to map microarray
rows (genes) to graph vertices. The attribute must
be annotated in graph
, and the values correspond to rownames
of microarray
. You can check the coverage and
if there are complex vertices using getAttrStatus
. You can eliminate complexes using expandComplexes
.
Sample labels, given as a factor or a character vector. This must be the same size as the columns of microarray
A function, or a string indicating the name of the function to be used to compute the edge weights.
The function is provided with 2 numerical verctors (2 rows from microarray
), and it should return a single numerical
value (or NA
). The default computes Pearson's correlation.
A function, or a string indicating the name of the function to be used in weighting edges connecting complexes.
If a vertex has >1 attribute value, all possible pairwise weights are first computed, and given to complex.method
. The default
function is max
.
A function, or a string indicating the name of the function to be used in weighting edges when one of the vertices
lack expression data. The function is passed all edge weights on the graph. Default is median
.
A numerical value to be assigned when 2 adjacent vertices have the same attribute value, since correlation and
similarity measure will give perfect scores. Alternatively, same.gene.penalty
can be a function, computing the penalty from all
edge weights on the graph (excluding same-gene and missing values). The default is to take the median
An integer n
, where the weight.method
is perfomed on n
permutations of the gene profiles, and taking
the median value. Set it to NA
to disable bootstrapping.
Print the progress of the function.
The input graph with edge.weight
as an edge attribute. The attribute can be a list of weights if y
labels
were provided.
## Convert a metabolic network to a reaction network.
data(ex_sbml) # bipartite metabolic network of Carbohydrate metabolism.
rgraph <- makeReactionNetwork(ex_sbml, simplify=TRUE)
#> This graph was created by an old(er) igraph version.
#> ℹ Call `igraph::upgrade_graph()` on it to use with the current igraph version.
#> For now we convert it on the fly...
## Assign edge weights based on Affymetrix attributes and microarray dataset.
# Calculate Pearson's correlation.
data(ex_microarray) # Part of ALL dataset.
rgraph <- assignEdgeWeights(microarray = ex_microarray, graph = rgraph,
weight.method = "cor", use.attr="miriam.uniprot",
y=factor(colnames(ex_microarray)), bootstrap = FALSE)
#> 100 genes were present in the microarray, but not represented in the network.
#> 55 genes were couldn't be found in microarray.
#> Assigning edge weights for label ALL1/AF4
#> Assigning edge weights for label BCR/ABL
#> Assigning edge weights for label E2A/PBX1
#> Assigning edge weights for label NEG
# Using Spearman correlation, assigning missing edges to -1
if (FALSE) { # \dontrun{
assignEdgeWeights(microarray, graph, use.attr="miriam.affy.probeset",
y=factor(colnames(microarray)),
weight.method = function(x1,x2) cor(x1,x2, method="spearman"),
missing.method = -1)
} # }