limix / bgen-reader-py

A BGEN file format reader.
MIT License
10 stars 3 forks source link

Error while creating metafile bgen.metadata #47

Open cnl27 opened 10 months ago

cnl27 commented 10 months ago

Hello,

I'm trying to read a bgen file but I get the following error:

WARNING: magic number mismatch
ERROR: unknown layout 1
Writing variants|                                                     | - eta - 

The total volume has not been fully consumed.Traceback (most recent call last):
  File "bgen.py", line 11, in <module>
    bgen2 = open_bgen(filename, verbose=True)
  File "/home/username/.local/lib/python3.7/site-packages/bgen_reader/_bgen2.py", line 159, in __init__
    self._create_metadata2()
  File "/home/username/.local/lib/python3.7/site-packages/bgen_reader/_bgen2.py", line 171, in _create_metadata2
    self._extract_nalleles_ids_etc(mmm_wplus)
  File "/home/username/.local/lib/python3.7/site-packages/bgen_reader/_bgen2.py", line 1049, in _extract_nalleles_ids_etc
    self._cbgen.create_metafile(metafile_filepath, verbose=self._verbose)
  File "/home/username/.local/lib/python3.7/site-packages/cbgen/_bgen_file.py", line 154, in create_metafile
    raise RuntimeError(f"Error while creating metafile {filepath}.")
RuntimeError: Error while creating metafile bgen.metadata.

Any ideas on what might be happening?

Thank you!

CarlKCarlK commented 10 months ago

@cnl27,

Thanks for using bgen-reader!

This looks like your input file is missing a "magic number" that should be in bgen files.

Based on previous comments by @horta (the packages' primary author) this could be because your input file isn't a bgen file or because it is a bgen file created without a magic number. See https://github.com/limix/bgen/issues/6 for a previous, similar report.

Can you tell us more about the file?

Yours, Carl

horta commented 10 months ago

Indeed, feels like you tried to read the wrong file.