Hello,
I've tried to do this but it does not seem to be working for me. I'm probably missing something dumb.
My seurat object is called 'epithelial', which consists of cells obtained from 3 conditions. I'm trying to take out all cells that are under the 'Healthy' condition.
I've done the below to check what column the metadata is stored at :
head(epithelial@meta.data)
Which returns :
orig.ident nCount_RNA nFeature_RNA stim integrated_snn_res.0.5 seurat_clusters
AACAAGACAGGACATG.1_1 SeuratProject 27811 5305 Healthy 0 0
AACCATGTCATGCCAA.1_1 SeuratProject 17552 4351 Healthy 0 0
AACCCAAAGGCCTGCT.1_1 SeuratProject 23151 4945 Healthy 0 0
AAGACAAAGAAGTATC.1_1 SeuratProject 13419 3819 Healthy 5 5
AATGACCCAAGAGGCT.1_1 SeuratProject 17281 4333 Healthy 0 0
ACATCGAAGACATGCG.1_1 SeuratProject 38385 5917 Healthy 4 4
Which means my condition is stored in the 4th column. I then run to try to replicate the above you've mentioned :
test.seurat <- subset(epithelial, subset = 4 == "Healthy")
and receive this error :
Error in FetchData(object = object, vars = expr.char[vars.use], cells = cells, :
None of the requested variables were found:
Also for the fun of it tried to be inventive to run :
test.seurat <- subset(epithelial@meta.data$stim, subset = 'Healthy')
which returned
Error in subset.default(epithelial@meta.data$stim, subset = "Healthy") :
'subset' must be logical
If you could provide any help that would be most appreciated :( thank you.