Returns a list of cells that match a particular set of criteria such as identity class, high/low values for particular PCs, etc.
WhichCells(object, ...)
# S3 method for Assay
WhichCells(object, cells = NULL, expression, invert = FALSE, ...)
# S3 method for Seurat
WhichCells(
object,
cells = NULL,
idents = NULL,
expression,
slot = "data",
invert = FALSE,
downsample = Inf,
seed = 1,
...
)
An object
Arguments passed on to CellsByIdentities
return.null
If no cells are requested, return a NULL
;
by default, throws an error
Subset of cell names
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 the selection of cells
A vector of identity classes to keep
Slot to pull feature data for
Maximum number of cells per identity class, default is
Inf
; downsampling will happen after all other operations, including
inverting the cell selection
Random seed for downsampling. If NULL, does not set a seed
A vector of cell names
WhichCells(pbmc_small, idents = 2)
#> [1] "AGGTCATGAGTGTC" "AGAGATGATCTCGC" "GGGTAACTCTAGTG" "CATGAGACACGGGA"
#> [5] "TACGCCACTCCGAA" "CTAAACCTGTGCAT" "GTAAGCACTCATTC" "TTGGTACTGAATCC"
#> [9] "CATCATACGGAGCA" "TACATCACGCTAAC" "GATAGAGAAGGGTG" "GCTCCATGAGAAGT"
#> [13] "CTGCCAACAGGAGC" "TTGCATTGAGCTAC" "CCTATAACGAGACG" "TTGAGGACTACGCA"
#> [17] "CATATAGACTAAGC" "GACATTCTCCACCT" "GCGTAAACACGGTT"
WhichCells(pbmc_small, expression = MS4A1 > 3)
#> [1] "AGGTCATGAGTGTC" "AGAGATGATCTCGC" "GGGTAACTCTAGTG" "CATGAGACACGGGA"
#> [5] "TACGCCACTCCGAA" "CTAAACCTGTGCAT" "GTAAGCACTCATTC" "TTGGTACTGAATCC"
#> [9] "CATCATACGGAGCA" "TACATCACGCTAAC" "ATTACCTGCCTTAT" "GATAGAGATCACGA"
levels(pbmc_small)
#> [1] "0" "1" "2"
WhichCells(pbmc_small, idents = c(1, 2), invert = TRUE)
#> [1] "ATGCCAGAACGACT" "CATGGCCTGTGCAT" "GAACCTGATGAACC" "TGACTGGATTCTCA"
#> [5] "AGTCAGACTGCACA" "TCTGATACACGTGT" "TGGTATCTAAACAG" "GCAGCTCTGTTTCT"
#> [9] "GATATAACACGCAT" "AATGTTGACAGTCA" "CTAAACCTCTGACA" "CTAACGGAACCGAT"
#> [13] "AGATATACCCGTAA" "TACTCTGAATCGAC" "GCGCATCTTGCTCC" "GTTGACGATATCGG"
#> [17] "ACAGGTACTGGTGT" "GGCATATGCTTATC" "CATTACACCAACTG" "TAGGGACTGAACTC"
#> [21] "TACAATGATGCTAG" "CTTCATGACCGAAT" "AAGCAAGAGCTTAG" "CGGCACGAACTCAG"
#> [25] "GGTGGAGATTACTC" "GGCCGATGTACTCT" "CATGCGCTAGTCAC" "ATTCAGCTCATTGG"
#> [29] "GGCATATGGGGAGT" "ATCATCTGACACCA" "GTCATACTTCGCCT" "TTACGTACGTTCAG"
#> [33] "GAGTTGTGGTAGCT" "GACGCTCTCTCTCG" "AGTCTTACTTCGGA" "GGAACACTTCAGAC"