addClusterings {clusterExperiment}R Documentation

Add clusterings to ClusterExperiment object

Description

Function for adding new clusterings in form of vector (single cluster) or matrix (multiple clusterings) to an existing ClusterExperiment object

Usage

## S4 method for signature 'ClusterExperiment,matrix'
addClusterings(x, y,
  clusterTypes = "User", clusterLabels = NULL, clusterLegend = NULL)

## S4 method for signature 'ClusterExperiment,ClusterExperiment'
addClusterings(x, y)

## S4 method for signature 'ClusterExperiment,vector'
addClusterings(x, y,
  makePrimary = FALSE, ...)

Arguments

x

a ClusterExperiment object

y

additional clusters to add to x. Can be a ClusterExperiment object or a matrix/vector of clusters.

clusterTypes

a string describing the nature of the clustering. The values 'clusterSingle', 'clusterMany', 'mergeClusters', 'makeConsensus' are reserved for the clustering coming from the package workflow and should not be used when creating a new object with the constructor.

clusterLabels

label(s) for the clusters being added. If y a matrix, the column names of that matrix will be used by default, if clusterLabels is not given.

clusterLegend

a list giving the cluster legend for the clusters added.

makePrimary

whether to make the added cluster the primary cluster (only relevant if y is a vector)

...

For addClusterings, passed to signature ClusterExperiment,matrix. For [ (subsetting), passed to SingleCellExperiment subsetting function.

Details

addClusterings adds y to x, and is thus not symmetric in the two arguments. In particular, the primaryCluster, all of the dendrogram information, coClustering, and orderSamples are all kept from the x object, even if y is a ClusterExperiment.

Value

A ClusterExperiment object.

Examples

data(simData)

cl1 <- clusterSingle(simData, subsample=FALSE,
sequential=FALSE, mainClusterArgs=list(clusterArgs=list(k=3), 
clusterFunction="pam"))
cl2 <- clusterSingle(simData, subsample=FALSE,
sequential=FALSE, mainClusterArgs=list(clusterArgs=list(k=3), 
clusterFunction="pam"))

addClusterings(cl1, cl2)

[Package clusterExperiment version 2.4.2 Index]