Skip to content
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

Minor suggestion on spatialFeaturePlot() #274

Open
mvfki opened this issue Dec 12, 2024 · 1 comment
Open

Minor suggestion on spatialFeaturePlot() #274

mvfki opened this issue Dec 12, 2024 · 1 comment

Comments

@mvfki
Copy link

mvfki commented Dec 12, 2024

I'm working on a Visium HD dataset, which is relatively large and has 85k cells. And when I wanted to see some gene expression with spatialFeaturePlot(), it immediately warned me saying

Warning message:
In asMethod(object) :
  sparse->dense coercion: allocating vector of size 12.1 GiB

I dove into the source code and saw data <- as.matrix(object@data) in the first line of the function body. I have a sparse matrix presented when constructing the CellChat object, and converting the whole thing into a dense form is obviously the cause.

My personal suggestion for a better implementation would be first to check the features input and only subset the expression of specified ones, which are the only ones necessary to be converted to dense.

@sqjin
Copy link
Member

sqjin commented Dec 18, 2024

@mvfki Thanks for the suggestion. This can be modified as data <- object@data. We will update it.

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

2 participants