subset {clusterExperiment}R Documentation

Functions to subset ClusterExperiment Objects

Description

These functions are used to subset ClusterExperiment objects, either by removing samples, genes, or clusterings

Usage

## S4 method for signature 'ClusterExperiment,character'
removeClusterings(x, whichClusters, ...)

## S4 method for signature 'ClusterExperiment,numeric'
removeClusterings(x, whichClusters)

## S4 method for signature 'ClusterExperiment,numeric'
removeClusters(x, whichCluster,
  clustersToRemove, makePrimary = FALSE, clusterLabels = NULL)

## S4 method for signature 'ClusterExperiment,character'
removeClusters(x, whichCluster, ...)

## S4 method for signature 'ClusterExperiment,ANY,character,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'ClusterExperiment,ANY,logical,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'ClusterExperiment,ANY,numeric,ANY'
x[i, j, ..., drop = TRUE]

Arguments

x

a ClusterExperiment object.

whichClusters

argument that can be either numeric or character value indicating the clusters to be used. If numeric, gives the indices of the clusterMatrix to return; this can also be used to defined an ordering for the clusterings (as relevant). whichClusters can be a character value identifying the clusterTypes to be used, or if not matching clusterTypes then clusterLabels; alternatively whichClusters can be either 'all' or 'workflow' or 'primary' to indicate choosing all clusterings or choosing all workflowClusters clusterings or choosing the 'primary' clustering, respectively. If missing, the entire matrix of all clusterings is returned.

...

The arguments transformation, clusterTypes and clusterInfo to be passed to the constructor for signature SingleCellExperiment,matrix.

whichCluster

Clustering from which to remove clusters for removeCluster. Note that it is a singular cluster.

clustersToRemove

numeric vector identifying the clusters to remove (whose samples will be reassigned to -1 value).

makePrimary

whether to make the added cluster the primary cluster (only relevant if y is a vector)

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.

i, j

A vector of logical or integer subscripts, indicating the rows and columns to be subsetted for i and j, respectively.

drop

A logical scalar that is ignored.

Details

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

removeClusters creates a new cluster that unassigns samples in cluster clustersToRemove (in the clustering defined by whichClusters) and assigns them to -1 (unassigned)

Note that when subsetting the data, the dendrogram information and the co-clustering matrix are lost.

Value

A ClusterExperiment object.

removeClusterings returns a ClusterExperiment object, unless all clusters are removed, in which case it returns a SingleCellExperiment object.


[Package clusterExperiment version 2.3.0 Index]