assignEdgeWeights: Assigning weights to network edges

Description Usage Arguments Value Author(s) Examples

View source: R/netWeight.R

Description

This function computes edge weights based on a gene expression profile.

Usage

1
2
3
assignEdgeWeights(microarray, graph, use.attr, y, weight.method = "cor",
  complex.method = "max", missing.method = "median",
  same.gene.penalty = "median", bootstrap = 100, verbose = TRUE)

Arguments

microarray

Microarray should be a Dataframe or a matrix, with genes as rownames, and samples as columns.

graph

An annotated igraph object.

use.attr

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.

y

Sample labels, given as a factor or a character vector. This must be the same size as the columns of microarray

weight.method

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.

complex.method

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.

missing.method

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.

same.gene.penalty

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

bootstrap

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.

verbose

Print the progress of the function.

Value

The input graph with edge.weight as an edge attribute. The attribute can be a list of weights if y labels were provided.

Author(s)

Ahmed Mohamed

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
	## Convert a metabolic network to a reaction network.
 data(ex_sbml) # bipartite metabolic network of Carbohydrate metabolism.
 rgraph <- makeReactionNetwork(ex_sbml, simplify=TRUE)

	## 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)

 # Using Spearman correlation, assigning missing edges to -1
 ## Not run: 
   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)
 
## End(Not run)

NetPathMiner documentation built on Nov. 8, 2020, 8:20 p.m.