Christopher Kuo
Christopher Kuo

Reputation: 41

RunUMAP code error after merged spatial transcriptomic objects

I merged 6 spatial transcriptomic objects together and then ran

Metastaticsamples.merge <- ScaleData(Metastaticsamples.merge)

#perform linear reduction analysis:
Metastaticsamples.merge <- RunPCA(Metastaticsamples.merge, features = VariableFeatures(object = Metastaticsamples.merge))

#Metastatic
Metastaticsamples.merge <- FindNeighbors(Metastaticsamples.merge, reduction = "pca", dims = 1:15)
Metastaticsamples.merge <- FindClusters(Metastaticsamples.merge, verbose = FALSE)
Metastaticsamples.merge <- RunUMAP(Metastaticsamples.merge, dims = 1:15)

However upon doing RunUMAP i hit an error code

20:35:37 Initializing from normalized Laplacian + noise (using irlba)
Error in irlba::irlba(L, nv = n, nu = 0, maxit = iters) :
function 'as_cholmod_sparse' not provided by package 'Matrix'

any thoughts on what happened and how to overcome this?

tried to check packages update them but did not work

Upvotes: 4

Views: 10281

Answers (5)

Rogan Grant
Rogan Grant

Reputation: 21

In case anyone is having issues with this solution and also has renv installed, beware that the source install may be ignored in favor of a cached version. This solved the issue for me: renv::install("irlba", type = "source", rebuild = TRUE). Otherwise follow @mischko's solution

Upvotes: 0

Federico Vannuccini
Federico Vannuccini

Reputation: 1

Another solution:

remove Matrix

remove.packages("Matrix")

remove irlba

remove.packages("irlba")

remove Seurat

remove.packages("Seurat")

reinstall Seurat

remotes::install_version("Seurat", version = "4.3.0.1")

With the latter installation you reinstall also Matrix and irlba as dependencies of Seurat. In this way you can work with dgcMatrix objects.

Upvotes: -2

mischko
mischko

Reputation: 51

I ran into the same error. Yes, it can be resolved by downgrading to Matrix 1.6-1. But it's also possible to reinstall irlba without the need to downgrade Matrix (which is a temporary workaround). Reinstalling irlba worked in my case.

Also see: https://github.com/bwlewis/irlba/issues/70

Upvotes: 5

Reza
Reza

Reputation: 29

Thanks, got same error. issue solved after:

   install.packages("remotes")
   remotes::install_version("Matrix", version = "1.6-1")
   packageVersion("Matrix")

Upvotes: 2

Valdemort
Valdemort

Reputation: 27

It's a compatibility issue with the new Matrix package version (1.6-2). Just install the previous version (1.6-1) and you should be fine.

Upvotes: 1

Related Questions