Accessing expression matrix for particular cell/feature in Seurat (R)
1
0
Entering edit mode
21 months ago
Aryan ▴ 30

Given a SeuratObject created from a 10X file, pbmc, how can I access the expression values across ALL features for a particular cell? I know I can access the cell names with rownames(pbmc@meta.data) and the matrix with GetAssayData(object = pbmc, slot = "counts"), but I'm really confused as to how to index the matrix such that I can extract a column/row from it. (I am not sure if the data I want is a row or column in the matrix - I believe it is a column).

scRNA r seurat R Seurat • 687 views
ADD COMMENT
0
Entering edit mode
21 months ago
jv ★ 1.8k

The column names of the output from GetAssayData will be the cell UMIs, so one way you can select the counts for a single cell would be:

cell_umi <- "AAACCCACAATCTCGA"
counts <- Seurat::GetAssayData(scrna_object)
cell_counts <- counts[, cell_umi]

You can also use Seurat::subset with the cells parameter to subset your Seurat object to a specific cell or subset of cells via cell UMIs.

ADD COMMENT

Login before adding your answer.

Traffic: 1659 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6