jackbibby1 / SCPA

R package for pathway analysis in scRNA-seq data
https://jackbibby1.github.io/SCPA/
GNU General Public License v3.0
62 stars 6 forks source link

Error during running infer_trajectory(): unable to find an inherited method for function 'reducedDim' #85

Closed anuragraj closed 1 day ago

anuragraj commented 5 days ago

Error I am trying to run the example from here: https://jackbibby1.github.io/SCPA/articles/pseudotime.html But, I am getting this error, using the same commands as provided.

Error: unable to find an inherited method for function 'reducedDim' for signature 'x = "PseudotimeOrdering", type = "missing"' Error: Error during trajectory inference, see output above ↑↑↑ In addition: Warning message: In (function (expression, parameters, priors, verbose, seed) : PAM (the default clustering method) does not scale well to a lot of cells. You might encounter memory issues. This can be resolved by using the CLARA clustering method, i.e. cluster_method = 'clara'.

I have also tried on other data, and I am getting the same error. Is this linked with Slingshot?

Code

library(SCPA)
library(Seurat)
library(dyno)

naive_cd4 <- readRDS("naive_cd4.rds")
naive_cd4 <- subset(naive_cd4, idents = "Treg", invert = T)
df <- as.matrix(naive_cd4[["RNA"]]@data)
var_genes <- names(sort(apply(df, 1, var), decreasing = TRUE))[1:100]
counts <- Matrix::t(as(as.matrix(naive_cd4@assays$RNA@counts[var_genes,]), 'sparseMatrix'))
expression <- Matrix::t(as(as.matrix(naive_cd4@assays$RNA@data[var_genes,]), 'sparseMatrix'))

dataset_n4 <- wrap_expression(expression = expression,
                              counts = counts)

model_n4 <- infer_trajectory(dataset_n4, method = ti_slingshot(), verbose = T, parallel = TRUE, cores = 4)

Screenshots image

jackbibby1 commented 1 day ago

Hi,

It looks like things changed from the dyno side because I think the default here used to be that infer_trajectory() was run in a container (rather than R wrapper). I've just ran this in the container (i.e. just change 1 to 2 in the initial option), or run options(dynwrap_backend = 'container') before running infer_trajectory(), and that works fine.

Hopefully that solves things on your side.

Jack

anuragraj commented 1 day ago

Yes, that helped. Thanks a lot. :)