matrixToNetwork: Construct a network from a matrix

View source: R/Functions-fromSimilarity.R

matrixToNetworkR Documentation

Construct a network from a matrix

Description

Constructs a network

Usage

matrixToNetwork(
    mat, 
    symmetrizeMethod = c("average", "min", "max"), 
    signed = TRUE, 
    min = NULL, max = NULL, 
    power = 12,
    diagEntry = 1)

Arguments

mat

matrix to be turned into a network. Must be square.

symmetrizeMethod

method for symmetrizing the matrix. The method will be applied to each component of mat and its transpose.

signed

logical: should the resulting network be signed? Unsigned networks are constructed from abs(mat).

min

minimum allowed value for mat. If NULL, the actual attained minimum of mat will be used. Missing data are ignored. Values below min are truncated to min.

max

maximum allowed value for mat. If NULL, the actual attained maximum of mat will be used. Missing data are ignored. Values below max are truncated to max.

power

the soft-thresholding power.

diagEntry

the value of the entries on the diagonal in the result. This is usally 1 but some applications may require a zero (or even NA) diagonal.

Details

If signed is FALSE, the matrix mat is first converted to its absolute value.

This function then symmetrizes the matrix using the symmetrizeMethod component-wise on mat and t(mat) (i.e., the transpose of mat).

In the next step, the symmetrized matrix is linearly scaled to the interval [0,1] using either min and max (each either supplied or determined from the matrix). Values outside of the [min, max] range are truncated to min or max.

Lastly, the adjacency is calculated by rasing the matrix to power. The diagonal of the result is set to diagEntry. Note that most WGCNA functions expect the diagonal of an adjacency matrix to be 1.

Value

The adjacency matrix that encodes the network.

Author(s)

Peter Langfelder

See Also

adjacency for calculation of a correlation network (adjacency) from a numeric matrix such as expression data

adjacency.fromSimilarity for simpler calculation of a network from a symmetric similarity matrix.


WGCNA documentation built on Sept. 18, 2024, 5:08 p.m.

Related to matrixToNetwork in WGCNA...