Skip to content

Added support for sparse matrix input in UMAP function in scROSHI#2

Open
flalom wants to merge 1 commit intoETH-NEXUS:masterfrom
flalom:fix-sparse-matrix-support
Open

Added support for sparse matrix input in UMAP function in scROSHI#2
flalom wants to merge 1 commit intoETH-NEXUS:masterfrom
flalom:fix-sparse-matrix-support

Conversation

@flalom
Copy link

@flalom flalom commented Oct 11, 2023

Title: Added Support for Sparse Matrix Input in UMAP function in scROSHI

Description:
This pull request aims to add support for sparse matrices when using the uwot::umap function. The original implementation did not handle sparse matrices from SingleCellExperiment.
This in response to the error:

Error in uwot(X = X, n_neighbors = n_neighbors, n_components = n_components,  : 
  Sparse matrices are only supported as distance matrices

Changes:

  • Converted sparse matrix to dense matrix before passing it to uwot::umap.

Code:

 # Fix sparse matrix
  if (is(tmp, "sparseMatrix")) {
    tmp <- Matrix::as.matrix(tmp)
  }

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

Successfully merging this pull request may close these issues.

1 participant