This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error when reading in loom files with loompy

I'm trying to import a loom file that I created using Seurat and loomR from 10X data, and I keep getting the same error.

Here is my code:

> import scanpy as sc
> import loompy
> print(loompy.__version__) ## 3.0.6
> adata = sc.read_loom('myloomfile.loom')

Here is the error message I get:

> Traceback (most recent call last):

>   File "<stdin>", line 1, in <module>

>   File "/my home directory/miniconda3/lib/python3.8/site-packages/anndata/compat/__init__.py", line 253, in inner_f

>     return f(*args, **kwargs)

>   File "/my home directory/miniconda3/lib/python3.8/site-packages/anndata/_io/read.py", line 261, in read_loom

>     with connect(filename, "r", **kwargs) as lc:

>   File "/my home directory/miniconda3/lib/python3.8/site-packages/loompy/loompy.py", line 1389, in connect

>     return LoomConnection(filename, mode, validate=validate)

>   File "/my home directory/miniconda3/lib/python3.8/site-packages/loompy/loompy.py", line 81, in __init__

>     if not lv.validate(filename):

>   File "/my home directory/miniconda3/lib/python3.8/site-packages/loompy/loom_validator.py", line 50, in validate

>     self.version = get_loom_spec_version(f)

>   File "/my home directory/miniconda3/lib/python3.8/site-packages/loompy/utils.py", line 19, in get_loom_spec_version

>     if "attrs" in f and "LOOM_SPEC_VERSION" in f["/attrs"]:

>   File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper

>   File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper

>   File "/my home directory/miniconda3/lib/python3.8/site-packages/h5py/_hl/group.py", line 439, in __contains__

>     return self._e(name) in self.id

>   File "h5py/h5g.pyx", line 462, in h5py.h5g.GroupID.__contains__

>   File "h5py/h5g.pyx", line 463, in h5py.h5g.GroupID.__contains__

>   File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper

>   File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper

>   File "h5py/h5g.pyx", line 532, in h5py.h5g._path_valid

>   File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper

>   File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper

>   File "h5py/h5l.pyx", line 212, in h5py.h5l.LinkProxy.exists

> RuntimeError: Unable to get link info (addr overflow, addr = 14464, size = 176, eoa = 2144)

Any idea what's going on here?

Thanks in advance!

seurat python loompy

1 answer

For anyone who is facing the same problem - you need to close the loom file before reading it again

Log in to answer this question.