adjacency | R Documentation |

Calculates (correlation or distance) network adjacency from given expression data or from a similarity.

adjacency(datExpr, selectCols = NULL, type = "unsigned", power = if (type=="distance") 1 else 6, corFnc = "cor", corOptions = list(use = "p"), weights = NULL, distFnc = "dist", distOptions = "method = 'euclidean'", weightArgNames = c("weights.x", "weights.y")) adjacency.fromSimilarity(similarity, type = "unsigned", power = if (type=="distance") 1 else 6)

`datExpr` |
data frame containing expression data. Columns correspond to genes and rows to samples. |

`similarity` |
a (signed) similarity matrix: square, symmetric matrix with entries between -1 and 1. |

`selectCols` |
for correlation networks only (see below); can be used to select genes whose adjacencies will be calculated. Should be either a numeric vector giving the indices of the genes to be used, or a boolean vector indicating which genes are to be used. |

`type` |
network type. Allowed values are (unique abbreviations of) |

`power` |
soft thresholding power. |

`corFnc` |
character string specifying the function to be used to calculate co-expression similarity for correlation networks. Defaults to Pearson correlation. Any function returning values between -1 and 1 can be used. |

`corOptions` |
character string or a list specifying additional arguments to be passed to the function given
by |

`weights` |
optional observation weights for |

`distFnc` |
character string specifying the function to be used to calculate co-expression
similarity for distance networks. Defaults to the function |

`distOptions` |
character string or a list specifying additional arguments to be passed to the function given
by |

`weightArgNames` |
character vector of length 2 giving the names of the arguments to |

The argument `type`

determines whether a correlation (`type`

one of `"unsigned"`

,
`"signed"`

, `"signed hybrid"`

), or a distance network (`type`

equal `"distance"`

) will
be calculated. In correlation networks the adajcency is constructed from correlations (values between -1 and
1, with high numbers meaning high similarity). In distance networks, the adjacency is constructed from
distances (non-negative values, high values mean low similarity).

The function calculates the similarity of columns (genes) in `datExpr`

by calling the function
given in `corFnc`

(for correlation networks) or `distFnc`

(for distance networks),
transforms the similarity according to `type`

and raises it to `power`

,
resulting in a weighted network adjacency matrix. If `selectCols`

is given, the `corFnc`

function
will be given arguments `(datExpr, datExpr[selectCols], ...)`

; hence the returned adjacency will have
rows corresponding to all genes and columns corresponding to genes selected by `selectCols`

.

Correlation and distance are transformed as follows: for `type = "unsigned"`

, adjacency = |cor|^power;
for `type = "signed"`

, adjacency = (0.5 * (1+cor) )^power; for `type = "signed hybrid"`

, adjacency
= cor^power if cor>0 and 0 otherwise; and for `type = "distance"`

, adjacency =
(1-(dist/max(dist))^2)^power.

The function `adjacency.fromSimilarity`

inputs a similarity matrix, that is it skips the correlation
calculation step but is otherwise identical.

Adjacency matrix of dimensions `ncol(datExpr)`

times `ncol(datExpr)`

(or the same dimensions
as `similarity`

). If `selectCols`

was
given, the number of columns will be the length (if numeric) or sum (if boolean) of `selectCols`

.

When calculated from the `datExpr`

, the network is always calculated among the columns of
`datExpr`

irrespective of whether a correlation or a distance network is requested.

Peter Langfelder and Steve Horvath

Bin Zhang and Steve Horvath (2005) A General Framework for Weighted Gene Co-Expression Network Analysis, Statistical Applications in Genetics and Molecular Biology, Vol. 4 No. 1, Article 17

Langfelder P, Horvath S (2007) Eigengene networks for studying the relationships between co-expression modules. BMC Systems Biology 2007, 1:54

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.