anndata icon indicating copy to clipboard operation
anndata copied to clipboard

Issues subsetting AnnData object with reticulate

Open imerelli opened this issue 3 years ago • 3 comments

Hi, I'm using reticulate to perform the scanpy tutorial for single cell data analysis.

#R library(reticulate) reticulate::repl_python()

#mkdir data #wget http://cf.10xgenomics.com/samples/cell-exp/1.1.0/pbmc3k/pbmc3k_filtered_gene_bc_matrices.tar.gz -O data/pbmc3k_filtered_gene_bc_matrices.tar.gz #cd data; tar -xzf pbmc3k_filtered_gene_bc_matrices.tar.gz

#python import scanpy as sc adata = sc.read_10x_mtx('data/filtered_gene_bc_matrices/hg19/') sc.pp.calculate_qc_metrics(adata, percent_top=None, log1p=False, inplace=True) adata=adata[adata.obs.n_genes_by_counts < 2500, :]

Error in py_call_impl(callable, dots$args, dots$keywords) : AttributeError: 'AnnData' object has no attribute '_X'

This python code works in a jupyter notebook. scanpy==1.9.1, reticulate==1.25 It seems that subsetting an AnnData object using reticulate generates some internal errors. Have you any suggestion to solve this?

imerelli avatar Jul 26 '22 18:07 imerelli

Can you provide us with more info about your reticulate environment? Like the version of anndata?

ivirshup avatar Aug 29 '22 15:08 ivirshup

#>>> import session_info #>>> session_info.show()

anndata 0.8.0 scanpy 1.9.1 session_info 1.0.0

Python 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:51:59) [GCC 10.3.0] Linux-3.10.0-1160.62.1.el7.x86_64-x86_64-with-glibc2.17

Session information updated at 2022-09-07 05:07

imerelli avatar Sep 07 '22 09:09 imerelli

Any news about this?

imerelli avatar Sep 18 '22 20:09 imerelli

This issue has been automatically marked as stale because it has not had recent activity. Please add a comment if you want to keep the issue open. Thank you for your contributions!

github-actions[bot] avatar Nov 18 '22 11:11 github-actions[bot]

This seems like it's tied to reticulate, and we don't have the bandwidth to have "support for anndata via reticulate" as a tested use case.

I've seen this error come up before, so I believe there is something going on.

Someone else figuring out what's going on and making a PR (probably to reticulate?) would be appreciated.

ivirshup avatar Nov 18 '22 15:11 ivirshup

This issue has been automatically marked as stale because it has not had recent activity. Please add a comment if you want to keep the issue open. Thank you for your contributions!

github-actions[bot] avatar Aug 16 '23 02:08 github-actions[bot]