Ingest fails when features are not 100% the same for both adata objects.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
- [X ] I have checked that this issue has not already been reported.
- [X ] I have confirmed this bug exists on the latest version of scanpy.
- [X ] (optional) I have confirmed this bug exists on the master branch of scanpy.
I'm working on comit 63b42e4b (latest master).
I'm not sure if intended or not but it seems like it would be usefull if one were able to ingest data that don't share 100% of all features.
Minimal code sample (that we can copy&paste without having any data)
adata = sc.datasets.paul15()
sc.pp.pca(adata_ref)
sc.pp.neighbors(adata_ref)
sc.tl.leiden(adata_ref)
adata = adata_ref[:, :1000].copy() # assume adata_ref has more than 1000 genes.
sc.tl.ingest(adata, adata_ref, obs='leiden')
Error message
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-37-b3cd11e67810> in <module>
----> 1 sc.tl.ingest(adata, adata_ref, obs='leiden')
~/projects/scanpy/scanpy/tools/_ingest.py in ingest(adata, adata_ref, obs, embedding_method, labeling_method, neighbors_key, inplace, **kwargs)
125
126 ing = Ingest(adata_ref, neighbors_key)
--> 127 ing.fit(adata)
128
129 for method in embedding_method:
~/projects/scanpy/scanpy/tools/_ingest.py in fit(self, adata_new)
437
438 if not ref_var_names.equals(new_var_names):
--> 439 raise ValueError(
440 'Variables in the new adata are different '
441 'from variables in the reference adata'
ValueError: Variables in the new adata are different from variables in the reference adata
Versions
sc.logging.print_header()
scanpy==1.8.0.dev78+gc488909a anndata==0.7.6 umap==0.5.0 numpy==1.19.4 scipy==1.5.4 pandas==1.1.4 scikit-learn==0.23.2 statsmodels==0.12.1 python-igraph==0.8.3 leidenalg==0.8.3 pynndescent==0.5.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in scanpy/tools/_ingest.py at Ingest.fit, especially the variable-name comparison that raises the reported ValueError. Reproduce the example with a reference AnnData object and a 1,000-gene subset, then inspect the surrounding ingest flow. Done should be defined as ingest accepting the intended non-identical feature sets without breaking the existing matching-feature case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- bioinformatics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100