Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in .subset2(x, i, exact = exact) : subscript out of bounds #205

Closed
Runzhi819 opened this issue Sep 18, 2024 · 1 comment
Closed

Error in .subset2(x, i, exact = exact) : subscript out of bounds #205

Runzhi819 opened this issue Sep 18, 2024 · 1 comment

Comments

@Runzhi819
Copy link

Excuse me, I‘m tryign to use Convert_Assay to convert the V5 SeuratObject to V4 SeuratObject

# my code
scRNA = CreateSeuratObject(scRNA.counts ,min.cells = 3,project="os", min.features = 300)
install.packages("scCustomize")
library(scCustomize)
scRNA_V4 <- Convert_Assay(seurat_object = scRNA, convert_to = "V3")
sessionInfo() output
my result

> scRNA_V4 <- Convert_Assay(seurat_object = scRNA, convert_to = "V3")
Converting assay "RNA" from Assay5 to Assay.
Error in .subset2(x, i, exact = exact) : subscript out of bounds
What can I do to debug?
@samuel-marsh
Copy link
Owner

Hi @Runzhi819,

So the issue here is due to how Seurat operates and the as function. Basically, if an object does not have normalized and scaled data then the function cannot convert between assay types. Convert_Assay simply wraps this with some additional checks. So it's more meant to be used to convert already in process analyzed objects between formats.

I will add a check in next version to create a more informative error message for this situation.

In meantime though there is easy solution if you are creating an object from scratch. Simply run:

options(Seurat.object.assay.version = "v3")

Then create the object and it will be in V3/4 format. However, you will need to run:

options(Seurat.object.assay.version = "v5")

before creating your next V5 formatted object.

Best,
Sam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants