matrixToNetwork {WGCNA} | R 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 |
min |
minimum allowed value for |
max |
maximum allowed value for |
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.