Skip to content

reload cds cause error. #505

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

Open
shanshenbing opened this issue Dec 27, 2023 · 1 comment
Open

reload cds cause error. #505

shanshenbing opened this issue Dec 27, 2023 · 1 comment

Comments

@shanshenbing
Copy link

I run following code to get pseudotime of cells.

#Store data in a cell_data_set object
exprDa <- GetAssayData(object = srobj,slot = 'counts', assay = 'RNA')
metaDa <- [email protected]
gene_annotation <-data.frame(gene_short_name =rownames(exprDa))
rownames(gene_annotation)<-rownames(exprDa)

cds <- new_cell_data_set(exprDa,
                         cell_metadata = metaDa,
                         gene_metadata = gene_annotation)

## Step 1: Normalize and pre-process the data
cds <- preprocess_cds(cds, num_dim = 100)
#check var
#Remove batch effects
## Step 2: Remove batch effects with cell alignment
#check for batch
plot_cells(cds, color_cells_by=batchCol, label_cell_groups=FALSE)
cds <- align_cds(cds, alignment_group = batchCol)

#Cluster your cells
## Step 3: Reduce the dimensions using UMAP
cds <- reduce_dimension(cds)
#check for batch again.
plot_cells(cds, color_cells_by=batchCol, label_cell_groups=FALSE)
## Step 4: Cluster the cells
cds <- cluster_cells(cds)
#check for clusters
plot_cells(cds)
#subset cds
#opitonal
cds <- choose_cells(cds)
# recluster the cells
cds <- cluster_cells(cds)
#check for clusters
plot_cells(cds)


#Order cells in pseudotime along a trajectory
## Step 5: Learn a graph
cds <- learn_graph(cds)
## Step 6: Order cells
cds <- order_cells(cds)

#save  data
qs::qsave(x = cds,nthreads = 10,
          file = paste0(dataDir, '/', projid, '.', ppart, '.cds.qs'))

Everything is ok, but when I save the R img or save cds object and reload cds obj, error will be thrown.

cds

class: cell_data_set
dim: 31109 6385
metadata(2): cds_version citations
assays(1): counts
rownames(31109): AL627309.5 LINC01409 ... GPR50 AC010086.3
rowData names(1): gene_short_name
colnames(6385): LM01_AAACGGGTCCTTCAAT-1 LM01_AACCATGCAGGGTACA-1 ...
BM16_TGACCCTAGTCTAGCT-1 BM16_TGATCAGCACTAGGCC-1
colData names(45): orig.ident nCount_RNA ... Size_Factor pseudotime
Error in validObject(result) :
invalid class “cell_data_set” object: slots in class definition but not in object: "preprocess_aux"
Error during wrapup: no slot of name "preprocess_aux" for this object of class "cell_data_set"
Error: no more error handlers available (recursive errors?); invoking 'abort' restart

@shanshenbing
Copy link
Author

Finally, I found the reason. I used monocle3(version 1.2.9) when generating CDS obj. But I used monocle3 (version 1.0.0) to load CDS. Different monocle3 version caused the error.

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