I converted my adata to rds format using sceasy first since I cannot use the anndata object directly in R, specifically monocle 3.
Issue 1:
cds <- as.cell_data_set(sce)
Error in UseMethod(generic = "as.cell_data_set", object = x) :
no applicable method for 'as.cell_data_set' applied to an object of class "c('SingleCellExperiment', 'RangedSummarizedExperiment', 'SummarizedExperiment', 'RectangularData', 'Vector', 'Annotated', 'vector_OR_Vector')"
Solution :
This was because my sce object was:
> class(sce)
[1] "SingleCellExperiment"
attr(,"package")
[1] "SingleCellExperiment"
When I changed sce object as seurat object, this error was resolved:
> class(sce)
[1] "Seurat"
attr(,"package")
[1] "SeuratObject"
Now, cds object looks like this:
> class(cds)
[1] "cell_data_set"
attr(,"package")
[1] "monocle3"
Issue 2:
cds <- preprocess_cds(cds, num_dim = 100)
Error in names(sf) <- colnames(SingleCellExperiment::counts(cds)) :
attempt to set an attribute on NULL
Solution : source
> ## Calculate size factors using built-in function in monocle3
> cds <- estimate_size_factors(cds)
No comments:
Post a Comment