Given a set of genes, filter to the ones found in the sample. This is useful because some Seurat functions (Seurat::VlnPlot, Seurat::FeaturePlot) will quit on an error if a gene is not found (i.e. not in the rownames of seurat@data).

filterGenesSample(genes, seurat, from_sp = "hg", to_sp = "mm")

Arguments

genes

Character vector of genes to search for

seurat

Seurat object

from_sp

One of "hg" or "mm". Default: "hg"

to_sp

One of "hg" or "mm". Default: "mm"

Value

Character vector of converted gene names which are detected in the sample

Examples

filterGenesSample(c("IL32", "foo"), pbmc, "hg", "hg")
#> [1] "IL32"