combine.networks: Combines two or more networks

Description Usage Arguments Value Note See Also Examples

View source: R/combine.networks.R

Description

Takes as input two or more adjacency matrices, and the corresponding contributions. Computes a combined network (weighted graph) in which the weight on an edge between two nodes is an average of the weights on the same edge in the input networks.

Usage

1
2
3
combine.networks(nets, contributions, outPath, midfix="",
    powerVector=1:20, verbose=1, RsquaredCut=0.75, minModuleSize=5,
    doRemoveTOM=TRUE, datExpr, doReturNetworks=FALSE, doSave=FALSE)

Arguments

nets

A list of adjacency matrices (networks), which can be generated using e.g., the WGCNA::adjacency function. Rows and columns must be named.

contributions

A numeric vector with the same length as nets. In computing the average weight on each edge in the combined network, first the edge weights from individual networks are multiplied by their corresponding contributions, then the result will be divided by the sum of weights of all networks containing this edge.

outPath

A string to the path where plots and results will be saved.

midfix

An optional string used in the output file names.

powerVector

A numeric vector of power values that are tried to find the best one. See WGCNA::pickSoftThreshold documentation.

verbose

The integer level of verbosity. 0 means silent and higher values produce more details of computation.

RsquaredCut

A threshold in the range [0,1] used to estimate the power. A higher value can increase power. For technical use only. See pickSoftThreshold for more details.

minModuleSize

The value that controls the minimum number of genes per module.

doRemoveTOM

A boolean determining the big TOM file must remove or not.

datExpr

The expression matrix that WGCNA::blockwiseModules uses for fine-tuning and removing genes from modules. This is not an ideal behavior by WGCNA.

doReturNetworks

A boolean value to determine whether to return Network, which is relatively a big matrix (typically GBs). Set to FALSE not to waste memory.

doSave

A boolean value to determine whether the whole output of this function (typically 1-2 GBs) should be saved as combinedNetwork. Set to FALSE not to waste disk space.

Value

A list with following components

call

The command that created the results

midfix

The input argument

Network

The adjacency matrix of the combined network

denominators

A matrix, each cell of which is the sum of weights of all networks contributing to the edge corresponding to that cell

power

The power (beta) value used for the combined network

fits

The fit indices calculated for the combined network

net

The output of WGCNA::blockwiseModules containing the module information in its colors field

modules

The output of WGCNA::blockwiseModules

combinedNetworkFile

The path to the saved file containing combinedNetwork

Note

If the networks have different node sets, the combined network will be computed on the union of nodes.

See Also

WGCNA::blockwiseModules, WGCNA::TOMsimilarity, and WGCNA::pickSoftThreshold.fromSimilarity

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(aml)
data(mds)
nets <- list()
## Make the coexpression networks:
nets[["aml"]] <- abs(stats::cor(aml[,1:200]))
nets[["mds"]] <- abs(stats::cor(mds[,1:200]))
## Combine them:
combined <- combine.networks(nets=nets, contributions=c(nrow(aml), nrow(mds)),
                 outPath=".", datExpr=rbind(aml, mds)[,1:200])
print(table(combined$modules))

Pigengene documentation built on Nov. 8, 2020, 6:47 p.m.