cnvkit icon indicating copy to clipboard operation
cnvkit copied to clipboard

Unable to load BED file with skgenome

Open EfraMP opened this issue 1 year ago • 0 comments

Hi,

I installed CNVkit (v0.9.11) via Conda. I tried to read a BED file using skgenome, as this:

import skgenome as skg
bed = skg.tabio.read_auto('file.bed')

But got the next output:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/skgenome/tabio/util.py", line 9, in wrapper
    return line_parser(line)
  File "/home/user/.local/lib/python3.10/site-packages/skgenome/tabio/bedio.py", line 29, in _parse_line
    return chrom, int(start), int(end), gene, strand
ValueError: invalid literal for int() with base 10: 'chromStart'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.10/site-packages/skgenome/tabio/__init__.py", line 111, in read_auto
    return read(infile, fmt or 'tab')
  File "/home/user/.local/lib/python3.10/site-packages/skgenome/tabio/__init__.py", line 75, in read
    dframe = reader(infile, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/skgenome/tabio/bedio.py", line 49, in read_bed
    return pd.DataFrame.from_records(
  File "/home/user/.local/lib/python3.10/site-packages/pandas/core/frame.py", line 2450, in from_records
    first_row = next(data)
  File "/home/user/.local/lib/python3.10/site-packages/skgenome/tabio/util.py", line 11, in wrapper
    raise ValueError("Bad line: %r" % line) from exc
ValueError: Bad line: '#chrom\tchromStart\tchromEnd\tname\tscore\n'

FYI, the BED is just chr, start, end, bin_name and copy number

EfraMP avatar Jul 19 '24 08:07 EfraMP