Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

WhichCells

Identify cells matching certain criteria


Description

Returns a list of cells that match a particular set of criteria such as identity class, high/low values for particular PCs, etc.

Usage

WhichCells(object, ...)

## S3 method for class 'Assay'
WhichCells(object, cells = NULL, expression, invert = FALSE, ...)

## S3 method for class 'Seurat'
WhichCells(
  object,
  cells = NULL,
  idents = NULL,
  expression,
  slot = "data",
  invert = FALSE,
  downsample = Inf,
  seed = 1,
  ...
)

Arguments

object

An object

...

Arguments passed on to CellsByIdentities

return.null

If no cells are request, return a NULL; by default, throws an error

cells

Subset of cell names

expression

A predicate expression for feature/variable expression, can evaluate anything that can be pulled by FetchData; please note, you may need to wrap feature names in backticks (``) if dashes between numbers are present in the feature name

invert

Invert the selection of cells

idents

A vector of identity classes to keep

slot

Slot to pull feature data for

downsample

Maximum number of cells per identity class, default is Inf; downsampling will happen after all other operations, including inverting the cell selection

seed

Random seed for downsampling. If NULL, does not set a seed

Value

A vector of cell names

See Also

Examples

WhichCells(pbmc_small, idents = 2)
WhichCells(pbmc_small, expression = MS4A1 > 3)
levels(pbmc_small)
WhichCells(pbmc_small, idents = c(1, 2), invert = TRUE)

SeuratObject

Data Structures for Single Cell Data

v4.0.1
GPL-3
Authors
Rahul Satija [aut] (<https://orcid.org/0000-0001-9448-8833>), Andrew Butler [aut] (<https://orcid.org/0000-0003-3608-0463>), Paul Hoffman [aut, cre] (<https://orcid.org/0000-0002-7693-8957>), Tim Stuart [aut] (<https://orcid.org/0000-0002-3044-0897>), Jeff Farrell [ctb], Shiwei Zheng [ctb] (<https://orcid.org/0000-0001-6682-6743>), Christoph Hafemeister [ctb] (<https://orcid.org/0000-0001-6365-8254>), Patrick Roelli [ctb], Yuhan Hao [ctb] (<https://orcid.org/0000-0002-1810-0822>)
Initial release
2021-05-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.