Functions to add/remove clusters to ClusterExperiment

Share:

Description

These functions are used to add or remove clusters to a ClusterExperiment object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## S4 method for signature 'ClusterExperiment,matrix'
addClusters(x, y, clusterTypes = "User")

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

## S4 method for signature 'ClusterExperiment,numeric'
addClusters(x, y, ...)

## S4 method for signature 'ClusterExperiment,character'
removeClusters(x, whichRemove,
  exactMatch = TRUE)

## S4 method for signature 'ClusterExperiment,numeric'
removeClusters(x, whichRemove)

## S4 method for signature 'ClusterExperiment'
removeUnclustered(x)

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', 'combineMany' are reserved for the clustering coming from the package workflow and should not be used when creating a new object with the constructor.

...

Passed to signature ClusterExperiment,matrix.

whichRemove

which clusters to remove. Can be numeric or character. If numeric, must give indices of clusterMatrix(x) to remove. If character, should match a clusterTypes of x.

exactMatch

logical. Whether whichRemove must exactly match a value of clusterTypes(x). Only relevant if whichRemove is character.

Details

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

removeClusters removes the clusters given by whichRemove. If all clusters are implied, then returns a SummarizedExperiment object. If the primaryCluster is one of the clusters removed, the primaryClusterIndex is set to 1 and the dendrogram and cooccurance matrix are discarded and orderSamples is set to 1:NCOL(x).

removeUnclustered removes all samples that are unclustered (i.e. -1 or -2 assignment) in the primaryCluster of x (so they may be unclustered in other clusters found in clusterMatrix(x)).

Value

A ClusterExperiment object with the added clusters.

Examples

1
2
3
4
5
6
7
8
9
data(simData)

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

cl2 <- clusterSingle(simData, clusterFunction="pam", subsample=FALSE,
sequential=FALSE, clusterDArgs=list(k=5))

addClusters(cl1, cl2)