kstreet13 / slingshot

Functions for identifying and characterizing continuous developmental trajectories in single-cell data.
265 stars 43 forks source link

Error with SlingshotDataSet(): as(<dsCMatrix>, "dgCMatrix") is deprecated #203

Closed jedazard closed 1 year ago

jedazard commented 2 years ago

Hi Kelly, I've run 'getLineages' on a Seurat object outputs as follows:

lineages <- getLineages(data=Embeddings(object=seur.scaled, reduction="umap"), clusterLabels=seurat_clusters, reducedDim=NULL, dist.method="slingshot", use.median=FALSE, omega=FALSE, omega_scale=1.5, times=NULL)

'lineages' PseudotimeOrdering object looks okay to me:

lineages class: PseudotimeOrdering dim: 13472 5 metadata(3): lineages mst slingParams pathStats(2): pseudotime weights cellnames(13472): AAACCCAAGACGCAGT-1 AAACCCAAGCGATGCA-1 ... TTTGTTGGTGCCCTTT-1 TTTGTTGGTTTCGTGA-1 cellData names(2): reducedDim clusterLabels pathnames(5): Lineage1 Lineage2 Lineage3 Lineage4 Lineage5 pathData names(0):

Now, when I simply try to extract a SlingshotDataSet object from my 'lineages' object, I get the following error:

SlingshotDataSet(lineages) Error: as(, "dgCMatrix") is deprecated since Matrix 1.5-0; do as(., "generalMatrix") instead

The same happens with slingshot(). Any idea of what's going on here? Thanks in advance.

I'm using: R version 4.2.0 (2022-04-22) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux 8.6 (Ootpa) [...] other attached packages: [1] slingshot_2.5.2

jedazard commented 1 year ago

I think that I figured it out. I found a conflict between "slingshot" with another library that was attached in my environment. The library is "cerebroApp" (https://github.com/romanhaa/Cerebro). It is used also for trajectory analysis and interactive visualization of scRNA-seq data. I tested the SlingshotDataSet() function with and witout this library, and it's definitely what was causing the problem: SlingshotDataSet() works perfectly when "cerebroApp" is not attched, and fails with this weird error message when it's attached. Now, "cerebroApp" imports and suggests no less than 39 other libraries! I did not have time to test which is causing the conflict, but if someone is willing to do the testing, I'd be happy to learn about it. Also, "cerebroApp" is no longer supported. So, it may be a good idea to stay away from it when using "slingshot". Any suggestion is welcome. Thanks.

kstreet13 commented 1 year ago

Hi @jedazard,

I looked into this a little bit and I'm not sure where the error is coming from. As far as I can tell, nothing in slingshot uses as(, "dgCMatrix"), so this must be something that gets called from another package. I'll keep an eye out for this error, though, in case it pops up again and will try to update this thread if I figure out what's causing it. For now, I think your solution of avoiding having both packages loaded at the same time is probably the best one.

Best, Kelly

peanut-123 commented 1 year ago

Dear Kelly, i came across the same error with @jedazard As i was using the function lines(SlingshotDataSet(ss), lwd=2, col='black') The R outputs as follows: Error: as(<dsCMatrix>, "dgCMatrix") is deprecated since Matrix 1.5-0; do as(., "generalMatrix") instead But I did not library the"cerebroApp" like @jedazard said. I guess some dependencies had updated their function. Could you find the solution about it , thanks very much!

kstreet13 commented 1 year ago

Hi @peanut-123,

Thanks for reporting this! I'm not able to reproduce this error, unfortunately, so is there any chance you could send me some code causes it?

Thanks, Kelly

kstreet13 commented 1 year ago

Closing due to lack of response. Feel free to re-open if this error pops up again.