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

scanorama with reticulate - ERROR: Data sets must be numpy array or scipy.sparse.csr_matrix, received type <class 'str'>. #141

Open
lucygarner opened this issue Mar 1, 2023 · 2 comments

Comments

@lucygarner
Copy link

lucygarner commented Mar 1, 2023

Hi,

I am getting an error when following the guidance for running scanorama with reticulate as below:

# List of datasets (matrices of cells-by-genes):
datasets <- list( list of matrix )

# List of gene lists:
genes_list <- list( list of list of string )

library(reticulate)
scanorama <- import('scanorama')

# Integration.
integrated.data <- scanorama$integrate(datasets, genes_list)

# Batch correction.
corrected.data <- scanorama$correct(datasets, genes_list, return_dense=TRUE)

# Integration and batch correction.
integrated.corrected.data <- scanorama$correct(datasets, genes_list,
                                               return_dimred=TRUE, return_dense=TRUE)

My datasets object is a list of matrices.

class(datasets[[1]])
[1] "matrix" "array"

When I pass these to the integrate function, I get the following error:
ERROR: Data sets must be numpy array or scipy.sparse.csr_matrix, received type <class 'str'>.

Do I need to convert my R matrices to a different class before passing to the integrate function?

Best wishes,
Lucy

@gdagstn
Copy link

gdagstn commented Mar 1, 2023

You need to set names of your datasets list to NULL

(see my reply here, cross-posting in case someone does not read the discussions page)

@anemartinezlarrinaga2898

Im getting the same error but running it in Python! But the names of my list are already NULL

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

3 participants