assignUnassigned {clusterExperiment} | R Documentation |
Assigns the unassigned samples in a cluster to the nearest cluster based on distance to the medians of the clusters.
## S4 method for signature 'ClusterExperiment' assignUnassigned(object, whichCluster = "primary", clusterLabel, makePrimary = TRUE, whichAssay = 1, reduceMethod = "none", ...) ## S4 method for signature 'ClusterExperiment' removeUnassigned(object, whichCluster = "primary")
object |
A Cluster Experiment object |
whichCluster |
in which clustering to get cluster assignments and assign the unassigned samples |
clusterLabel |
if missing, the current cluster label of the cluster will be appended with the string "_AllAssigned". |
makePrimary |
whether to make the added cluster the primary cluster (only relevant if |
whichAssay |
which assay to use to calculate the median per cluster and take dimensionality reduction (if requested) |
reduceMethod |
character. A method (or methods) for reducing the size of
the data, either by filtering the rows (genes) or by a dimensionality
reduction method. Must either be 1) must match the name of a built-in
method, in which case if it is not already existing in the object will be
passed to |
... |
arguments passed to |
The function assignUnassigned
calculates the median values of each variable for each
cluster, and then calculates the euclidean distance of each unassigned
sample to the median of each cluster. Each unassigned sample is assigned to
the cluster for which it closest to the median.
All unassigned samples in the cluster are given a clustering, regardless of whether they are classified as -1 or -2.
removeUnclustered
removes all samples that are unclustered
(i.e. -1 or -2 assignment) in the designated cluster of object
(so they may
be unclustered in other clusters found in clusterMatrix(object)
).
The function assignUnassigned
returns a ClusterExperiment
object with the unassigned samples assigned to one of the existing clusters.
The function removeUnassigned
returns a ClusterExperiment
object with the unassigned samples removed.
#load CE object data(rsecFluidigm) smallCE<-rsecFluidigm[,1:50] #assign the unassigned samples assignUnassigned(smallCE, makePrimary=TRUE) #note how samples are REMOVED: removeUnassigned(smallCE)