cggh / scikit-allel

A Python package for exploring and analysing genetic variation data
MIT License
283 stars 49 forks source link

KeyError: "Unable to open object (unable to open external file, external link file name = 'xxxxxx.h5')" #413

Open yifangt-ACRD opened 1 month ago

yifangt-ACRD commented 1 month ago

Hello, I'm learning to use scikit-allel, but got stumped with the first step to read in HDF5 file following thetutorial:

callset_fn = 'data/2016-06-10/ag1000g.phase1.ar3.h5'
callset = h5py.File(callset_fn, mode='r')
callset
# <HDF5 file "ag1000g.phase1.ar3.h5" (mode r)>
chrom = '3L'
variants = allel.VariantChunkedTable(callset[chrom]['variants'], 
                                     names=['POS', 'REF', 'ALT', 'DP', 'MQ', 'QD', 'num_alleles'],
                                     index='POS')
"""
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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 "/home/yifang/miniconda3/envs/allel/lib/python3.12/site-packages/h5py/_hl/group.py", line 357, in __getitem__
    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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/h5o.pyx", line 241, in h5py.h5o.open
KeyError: "Unable to open object (unable to open external file, external link file name = 'ag1000g.phase1.ar3.3L.h5')"
"""
assert callable(allel.VariantChunkedTable)
#nothing

Tried using a new h5df file converted freshly from VCF file, the error stays the same. I'm using # scikit-allel 1.3.8 and # h5py 3.11.0. Does anyone have any clue on the issue? Thanks a lot!