theislab / scvelo

RNA Velocity generalized through dynamical modeling
https://scvelo.org
BSD 3-Clause "New" or "Revised" License
417 stars 102 forks source link

Issue with running filter_and_normalize #1136

Closed rohitarorayyc closed 11 months ago

rohitarorayyc commented 1 year ago

Issue when running filter_and_normalize ...

scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000) or from scvelo.core import get_initial_size, get_size, multiply, set_initial_size, sum set_initial_size(adata)

# paste your code here, if applicable
Error output ```pytb # paste the error output here, if applicable ``` AnnData object with n_obs × n_vars = 391167 × 36601 obs: 'barcode', 'Sex', 'Race', 'ABRH', 'donor_id', 'n_genes_by_counts', 'log1p_n_genes_by_counts', 'total_counts', 'log1p_total_counts', 'pct_counts_in_top_50_genes', 'pct_counts_in_top_100_genes', 'pct_counts_in_top_200_genes', 'pct_counts_in_top_500_genes', 'total_counts_mt', 'log1p_total_counts_mt', 'pct_counts_mt', 'total_counts_rb', 'log1p_total_counts_rb', 'pct_counts_rb', 'total_counts_hb', 'log1p_total_counts_hb', 'pct_counts_hb', 'leiden', 'sample', 'batch', 'leiden_res0.5', 'cluster_dummy', 'leiden_res0.3', 'barcode' var: 'Accession', 'Chromosome', 'End', 'Start', 'Strand' obsm: 'X_umap' layers: 'matrix', 'ambiguous', 'spliced', 'unspliced' Normalized count data: X, spliced, unspliced. computing neighbors --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) [/tmp/ipykernel_2609/2796425568.py](https://vscode-remote+ssh-002dremote-002bcompute-002da-002d16-002d162.vscode-resource.vscode-cdn.net/tmp/ipykernel_2609/2796425568.py) in ?() ----> 1 set_initial_size(adata) [~/.conda/envs/scvelo_env/lib/python3.9/site-packages/scvelo/core/_anndata.py](https://vscode-remote+ssh-002dremote-002bcompute-002da-002d16-002d162.vscode-resource.vscode-cdn.net/n/scratch3/users/r/roa422/~/.conda/envs/scvelo_env/lib/python3.9/site-packages/scvelo/core/_anndata.py) in ?(adata, layers) 598 None 599 """ 600 if layers is None: 601 layers = ["unspliced", "spliced"] --> 602 verify_dtypes(adata) 603 layers = [ 604 layer 605 for layer in layers [~/.conda/envs/scvelo_env/lib/python3.9/site-packages/scvelo/core/_anndata.py](https://vscode-remote+ssh-002dremote-002bcompute-002da-002d16-002d162.vscode-resource.vscode-cdn.net/n/scratch3/users/r/roa422/~/.conda/envs/scvelo_env/lib/python3.9/site-packages/scvelo/core/_anndata.py) in ?(adata) 752 except IndexError: 753 logg.warn( 754 "The data might be corrupted. Please verify all annotation datatypes." 755 ) --> 756 adata.uns = uns [~/.conda/envs/scvelo_env/lib/python3.9/site-packages/anndata/_core/anndata.py](https://vscode-remote+ssh-002dremote-002bcompute-002da-002d16-002d162.vscode-resource.vscode-cdn.net/n/scratch3/users/r/roa422/~/.conda/envs/scvelo_env/lib/python3.9/site-packages/anndata/_core/anndata.py) in ?(self, index) 1166 def __getitem__(self, index: Index) -> AnnData: 1167 """Returns a sliced view of the object.""" ... 6202 ): 6203 return self[name] -> 6204 return object.__getattribute__(self, name) AttributeError: 'DataFrame' object has no attribute 'dtype' Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
Versions on current GitHub version ```pytb # paste the ouput of scv.logging.print_versions() here ``` scvelo==0.3.0 scanpy==1.9.5 anndata==0.10.3 loompy==3.0.7 numpy==1.26.1 scipy==1.11.3 matplotlib==3.7.2 sklearn==1.1.3 pandas==2.1.1 Numba: Attempted to fork from a non-main thread, the TBB library may be in an invalid state in the child process. ERROR: XMLRPC request failed [code: -32500] RuntimeError: PyPI no longer supports 'pip search' (or XML-RPC search). Please use https://pypi.org/search (via a browser) instead. See https://warehouse.pypa.io/api-reference/xml-rpc.html#deprecated-methods for more information.
WeilerP commented 11 months ago

Cannot reproduce problem. From the looks of it, you stored entries as a Pandas DataFrame instead of numpy array or scipy sparse matrix.