addClusterings: Add clusterings to ClusterExperiment object

addClusteringsR 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, transferFrom = c("x", "y"), mergeCEObjects = FALSE)

## 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.

transferFrom

If x and y are both ClusterExperiment objects indicates from which object the clustering info should be taken (regarding merging, dendrogram, etc). Does not affect the order of the clusterings, which will always be the clusterings of x, followed by those of y (along with slots 'clusterType', 'clusterInfo', 'clusterLegend')

mergeCEObjects

logical If x and y are both ClusterExperiment objects indicates as to whether should try to grab in the information missing from x from y (or vice versa if transferFrom=y).

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, the merge 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)

epurdom/clusterExperiment documentation built on April 23, 2024, 9:09 p.m.