Help with subset seurat object by a column in metadata
0
0
Entering edit mode
7 weeks ago
Chris ▴ 340

Hi all,

I try to subset seurat object by sample:

subset(x = combined_seurat_large, subset = sample == "1") Error in .subscript.2ary(x, i, j, drop = drop) : subscript out of bounds

I found other people asked this error on the internet but don't have a clear answer yet. Would you please have a suggestion? The error persists with seurat version 4.3 and 5.1. Thank you so much!

seurat • 613 views
ADD COMMENT
1
Entering edit mode

Seems that the bug still exists and they are working on it.

...and maybe you should try switch to Scanpy as @stefanonard85 said here: github issue

ADD REPLY
0
Entering edit mode

Thank you for the suggestion. Another way is to recreate the seurat object and use only the sample you want.

ADD REPLY
0
Entering edit mode

If sample is one of the column in meta.data, you can subset sample "1" using following commands:

Idents(combined_seurat_large) <- "sample" 
sample <- "1"
subset(skin, idents = sample, invert = FALSE)
ADD REPLY
0
Entering edit mode

Thank you for your reply! Unfortunately, I got the same error message.

ADD REPLY

Login before adding your answer.

Traffic: 1752 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