brianhie / scanorama

Panoramic stitching of single cell data
http://scanorama.csail.mit.edu
MIT License
262 stars 49 forks source link

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

Open lucygarner opened 1 year ago

lucygarner commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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