assignUnassigned: Assign unassigned samples to nearest cluster

Description Usage Arguments Details Value See Also Examples

Description

Assigns the unassigned samples in a cluster to the nearest cluster based on distance to the medians of the clusters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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")

Arguments

object

A Cluster Experiment object

whichCluster

argument that can be a single numeric or character value indicating the single clustering to be used. Giving values that result in more than one clustering will result in an error. See details of getClusterIndex.

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 y is a vector)

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 makeFilterStats or link{makeReducedDims}, or 2) must match a stored filtering statistic or dimensionality reduction in the object

...

arguments passed to getReducedData specifying the dimensionality reduction (if any) to be taken of the data for calculating the medians of the clusters

Details

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

Value

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.

See Also

getReducedData

Examples

1
2
3
4
5
6
7
8
#load CE object
data(rsecFluidigm)
smallCE<-rsecFluidigm[,1:50]
#assign the unassigned samples
assignUnassigned(smallCE, makePrimary=TRUE)

#note how samples are REMOVED:
removeUnassigned(smallCE)

clusterExperiment documentation built on Feb. 11, 2021, 2 a.m.