bioconda / bioconda-recipes

Conda recipes for the bioconda channel.
https://bioconda.github.io
MIT License
1.6k stars 3.13k forks source link

Interoperability issues with anndata/scanpy-scripts #45164

Open neoformit opened 6 months ago

neoformit commented 6 months ago

The current build of scanpy-scripts has packaged anndata==0.7.6. This is causing issues in downstream Galaxy tools, since ebi-gxa/anndata_ops requires scanpy-scripts and gets this old anndata version. This means that it does not play nicely with other tools in the anndata suite, for example:

iuc/anndata_manipulate -> anndata==0.10.3
ebi-galaxy/anndata_ops -> anndata==0.7.8

An example of "does not play nicely" is that the output of anndata_manipulate will produce an error if read by anndata_ops, like:

Traceback (most recent call last):
  File "/mnt/tmp/job_working_directory/007/724/7724020/configs/tmp1jvzx33z", line 7, in <module>
    adata = sc.read('input.h5')
  File "/usr/local/lib/python3.9/site-packages/scanpy/readwrite.py", line 112, in read
    return _read(
  File "/usr/local/lib/python3.9/site-packages/scanpy/readwrite.py", line 713, in _read
    return read_h5ad(filename, backed=backed)
  File "/usr/local/lib/python3.9/site-packages/anndata/_io/h5ad.py", line 421, in read_h5ad
    d[k] = read_attribute(f[k])
  File "/usr/local/lib/python3.9/functools.py", line 877, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/usr/local/lib/python3.9/site-packages/anndata/_io/utils.py", line 183, in func_wrapper
    raise AnnDataReadError(
anndata._io.utils.AnnDataReadError: Above error raised while reading key '/layers' of type <class 'h5py._hl.group.Group'> from /.

ebi-galaxy/anndata_ops uses the latest scanpy-scripts==1.1.6, but the anndata version in scanpy-scripts is not pinned:

https://github.com/bioconda/bioconda-recipes/blob/8a3900e6e5bdbf7bae2c166a619e0eb2af4361bf/recipes/scanpy-scripts/meta.yaml#L50-L51

swbioinf commented 5 months ago

Just for more context on this. We are trying to have interoperability between two scanpy-based tools that are wrapped on the 'galaxy' platform.

There is an underlying conflict between old (<v0.8.0, early 2022) and current versions of the AnnData package - A tool using the old version can't read data generated with the newer version (and will generate the above error.) See https://github.com/scverse/scanpy/issues/2297 and https://github.com/scverse/scanpy/issues/1351#issuecomment-1198015945

The two scanpy-using tool wappers in question:

1) 'iuc anndata_manipulate', which doesn't use scanpy-scripts, requires AnnData 0.10.3. 2) 'ebi-gxa anndata_opts' - uses scanpy-scripts, which in turn requires AnnData, without version restriction.

So without any minimum requirements - tool number 2 via scanpy-scripts seems to be choosing an old version of AnnData (probaby the ancient ancient version of AnnData (0.6.11) on biocontainers https://biocontainers.pro/tools/anndata )

End result is that both tools work in isolation, but tool 2 crashes with anything saved with a more current anndata object.