sizeRestrictedClusterMerge: Cluter merging with size restrictions

View source: R/blockwiseModulesC.R

sizeRestrictedClusterMergeR Documentation

Cluter merging with size restrictions

Description

This function merges clusters by correlation of the first principal components such that the resulting merged clusters do not exceed a given maximum size.

Usage

sizeRestrictedClusterMerge(
    datExpr,
    clusters,
    clusterSizes = NULL,
    centers = NULL,
    maxSize,
    networkType = "unsigned",
    verbose = 0,
    indent = 0)

Arguments

datExpr

Data on which the clustering is based (e.g., expression data). Variables are in columns and observations (samples) in rows.

clusters

A vector with element per variable (column) in datExpr giving the cluster label for the corresponding variable.

clusterSizes

Optional pre-calculated cluster sizes. If not given, will be determined from given clusters.

centers

Optional pre-calculaed cluster centers (first principal components/singular vectors). If not given, will be calculated from given data and cluster assignments.

maxSize

Maximum allowed size of merged clusters. If any of the given clusters are larger than maxSize, they will not be changed.

networkType

One of "unsigned" and "signed". Determines whether clusters with negatively correlated representatives will be considered similar ("unsigned") or dis-similar ("signed").

verbose

integer level of verbosity. Zero means silent, higher values make the output progressively more and more verbose.

indent

indentation for diagnostic messages. Zero means no indentation, each unit adds two spaces.

Details

The function iteratively merges two closest clusters subject to the constraint that the merged cluster size cannot exceed maxSize. Merging stops when no two clusters can be merged without exceeding the maximum size.

Value

A list with two components

clusters

A numeric vector with one component per input gene, giving the cluster number in which the gene is assigned.

centers

Cluster centers, that is their first principal components/singular vectors.

Author(s)

Peter Langfelder

See Also

The last step in projectiveKMeans uses this function.


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