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 while trying to convert SeuratObj to Anndata #18

Closed
jovanakalamkovic99 opened this issue Jan 23, 2024 · 1 comment
Closed

Error while trying to convert SeuratObj to Anndata #18

jovanakalamkovic99 opened this issue Jan 23, 2024 · 1 comment

Comments

@jovanakalamkovic99
Copy link

Hello,

I am encountering a problem when trying to convert the Seurat object obtained from PRECAST into Anndata.
Firstly, I perform PRECAST on two samples that were prepared from anndatas and transformed into seurat objects using the library sceasy (https://github.com/cellgeni/sceasy). After performing PRECAST, I perform SelectModel and then IntegrateSpaData.
After the last function is performed the result is a seurat object (before that it is a PRECAST object).

The last thing I want to do is to return the data to an Anndata for further processing (namely, I want to calculate the Integration LISI score and some ARI scores) for which I need the whole object. I tried running:

sceasy::convertFormat(seuInt, from="seurat", to="anndata", assay = "PRE_CAST",
outFile='mouse_brain_precast/PRECAST_BRAIN.h5ad')

The assay is a parameter because the default assay is named RNA and after the IntegrateSpaData the assay is named PRE_CAST.

However, after attempting to convert the format using sceasy I get an error
Error in ncol(df) :
no slot of name "meta.features" for this object of class "Assay5"
Calls: -> func -> .regularise_df -> ncol

And upon inspection I do see that the slot meta.features is not there, but I cannot create it because whenever I try to create the meta.features I get the following error:

Error in (function (cl, name, valueClass) :
‘meta.features’ is not a slot in class “Seurat”

Please help me solve this problem or find a workaround.
Thank you!

@jovanakalamkovic99
Copy link
Author

I believe I have found the solution thanks to @haukeh90 on (cellgeni/sceasy#76)

Leukocytes[["RNA3"]] <- as(object = Leukocytes[["RNA"]], Class = "Assay")
DefaultAssay(Leukocytes) <- "RNA3"
Leukocytes[["RNA"]] <- NULL
Leukocytes <- RenameAssays(object = Leukocytes, RNA3 = 'RNA')

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

1 participant