addClusterings,ClusterExperiment,matrix-method {clusterExperiment} | R Documentation |
These functions are used to add or remove clusters to a
ClusterExperiment
object.
## 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, ...) ## S4 method for signature 'ClusterExperiment,character' removeClusterings(x, whichClusters, ...) ## S4 method for signature 'ClusterExperiment,numeric' removeClusterings(x, whichClusters) ## S4 method for signature 'ClusterExperiment' removeUnclustered(x) ## S4 method for signature 'ClusterExperiment,numeric' removeClusters(x, whichClusters, clustersToRemove, clusterLabels = NULL) ## S4 method for signature 'ClusterExperiment,character' removeClusters(x, whichClusters, ...)
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. |
clusterLabels |
label(s) for the clusters being added. If |
clusterLegend |
a list giving the cluster legend for the clusters added. |
makePrimary |
whether to make the added cluster the primary cluster (only relevant if |
... |
Passed to signature |
whichClusters |
optional argument that can be either numeric or
character value. If numeric, gives the indices of the |
clustersToRemove |
numeric vector identifying the clusters to remove (whose samples will be reassigned to -1 value). |
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.
removeClusterings
removes the clusters given by
whichClusters
. If the
primaryCluster
is one of the clusters removed, the
primaryClusterIndex
is set to 1 and the dendrogram and coclustering
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)
).
removeClusters
creates a new cluster that unassigns samples in cluster clustersToRemove
(in the clustering defined by whichClusters
) and assigns them to -1 (unassigned)
A ClusterExperiment
object with the added clusters.
removeClusterings
returns a ClusterExperiment
object,
unless all clusters are removed, in which case it returns a
SingleCellExperiment
object.
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)