hierarchicalMergeCloseModules: Merge close (similar) hierarchical consensus modules

View source: R/Functions.R

hierarchicalMergeCloseModulesR Documentation

Merge close (similar) hierarchical consensus modules

Description

Merges hierarchical consensus modules that are too close as measured by the correlation of their eigengenes.

Usage

hierarchicalMergeCloseModules(
  # input data
  multiExpr, 
  multiExpr.imputed = NULL,
  labels,

  # Optional starting eigengenes
  MEs = NULL,

  unassdColor = if (is.numeric(labels)) 0 else "grey",
  # If missing data are present, impute them?
  impute = TRUE,


  # Options for eigengene network construction
  networkOptions,

  # Options for constructing the consensus
  consensusTree,
  calibrateMESimilarities = FALSE,

  # Merging options
  cutHeight = 0.2,
  iterate = TRUE,

  # Output options
  relabel = FALSE,
  colorSeq = NULL,
  getNewMEs = TRUE,
  getNewUnassdME = TRUE,

  # Options controlling behaviour of the function
  trapErrors = FALSE,
  verbose = 1, indent = 0)

Arguments

multiExpr

Expression data in the multi-set format (see multiData). A vector of lists, one per set. Each set must contain a component data that contains the expression data, with rows corresponding to samples and columns to genes or probes.

multiExpr.imputed

If multiExpr contain missing data, this argument can be used to supply the expression data with missing data imputed. If not given, the impute.knn function will be used to impute the missing data within each module (see imputeByModule.

labels

A vector (numeric, character or a factor) giving module labels for genes (variables) in multiExpr.

MEs

If module eigengenes have been calculated before, the user can save some computational time by inputting them. MEs should have the same format as multiExpr. If they are not given, they will be calculated.

unassdColor

The label (value in labels) that represents unassigned genes. Module of this label will not enter the module eigengene clustering and will not be merged with other modules.

impute

Should missing values be imputed in eigengene calculation? If imputation is disabled, the presence of NA entries will cause the eigengene calculation to fail and eigengenes will be replaced by their hubgene approximation. See moduleEigengenes for more details.

networkOptions

A single list of class NetworkOptions giving options for network calculation for all of the networks, or a multiData structure containing one such list for each input data set.

consensusTree

A list specifying the consensus calculation. See newConsensusTree for details.

calibrateMESimilarities

Logical: should module eigengene similarities be calibrated? This setting overrides the calibration options in consensusTree.

cutHeight

Maximum dissimilarity (i.e., 1-correlation) that qualifies modules for merging.

iterate

Controls whether the merging procedure should be repeated until there is no change. If FALSE, only one iteration will be executed.

relabel

Controls whether, after merging, color labels should be ordered by module size.

colorSeq

Color labels to be used for relabeling. Defaults to the standard color order used in this package if colors are not numeric, and to integers starting from 1 if colors is numeric.

getNewMEs

Controls whether module eigengenes of merged modules should be calculated and returned.

getNewUnassdME

When doing module eigengene manipulations, the function does not normally calculate the eigengene of the 'module' of unassigned ('grey') genes. Setting this option to TRUE will force the calculation of the unassigned eigengene in the returned newMEs, but not in the returned oldMEs.

trapErrors

Controls whether computational errors in calculating module eigengenes, their dissimilarity, and merging trees should be trapped. If TRUE, errors will be trapped and the function will return the input colors. If FALSE, errors will cause the function to stop.

verbose

Controls verbosity of printed progress messages. 0 means silent, up to (about) 5 the verbosity gradually increases.

indent

A single non-negative integer controlling indentation of printed messages. 0 means no indentation, each unit above that adds two spaces.

Details

This function merges input modules that are closely related. The similarities are quantified by correlations of module eigengenes; a “consensus” similarity is calculated using hierarchicalConsensusMEDissimilarity according to the recipe in consensusTree. Once the (dis-)similarities are calculated, average linkage hierarchical clustering of the module eigengenes is performed, the dendrogram is cut at the height cutHeight and modules on each branch are merged. The process is (optionally) repeated until no more modules are merged.

If, for a particular module, the module eigengene calculation fails, a hubgene approximation will be used.

The user should be aware that if a computational error occurs and trapErrors==TRUE, the returned list (see below) will not contain all of the components returned upon normal execution.

Value

If no errors occurred, a list with components

labels

Labels for the genes corresponding to merged modules. The function attempts to mimic the mode of the input labels: if the input labels is numeric, character and factor, respectively, so is the output. Note, however, that if the function performs relabeling, a standard sequence of labels will be used: integers starting at 1 if the input labels is numeric, and a sequence of color labels otherwise (see colorSeq above).

dendro

Hierarchical clustering dendrogram (average linkage) of the eigengenes of the most recently computed tree. If iterate was set TRUE, this will be the dendrogram of the merged modules, otherwise it will be the dendrogram of the original modules.

oldDendro

Hierarchical clustering dendrogram (average linkage) of the eigengenes of the original modules.

cutHeight

The input cutHeight.

oldMEs

Module eigengenes of the original modules in the sets given by useSets.

newMEs

Module eigengenes of the merged modules in the sets given by useSets.

allOK

A logical set to TRUE.

If an error occurred and trapErrors==TRUE, the list only contains these components:

colors

A copy of the input colors.

allOK

a logical set to FALSE.

Author(s)

Peter Langfelder

See Also

multiSetMEs for calculation of (consensus) module eigengenes across multiple data sets;

newConsensusTree for information about consensus trees;

hierarchicalConsensusMEDissimilarity for calculation of hierarchical consensus eigengene dissimilarity.


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