Skip to content

Error when running read_gtf() on RefSeq MANE GTF #398

Description

@isaacvock

Hello,

I downloaded a GTF file from the MANE project (link; code to download specific GTF: wget https://ftp.ncbi.nlm.nih.gov/refseq/MANE/MANE_human/release_1.4/MANE.GRCh38.v1.4.refseq_genomic.gtf.gz) and then attempted to read it into a Python session with pyranges (version 0.1.4) with pr.read_gtf('path/to/gtf'). This threw the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/isaacvock/mambaforge/envs/biopython/lib/python3.12/site-packages/pyranges/readers.py", line 380, in read_gtf
    gr = read_gtf_full(
         ^^^^^^^^^^^^^^
  File "/home/isaacvock/mambaforge/envs/biopython/lib/python3.12/site-packages/pyranges/readers.py", line 423, in read_gtf_full
    extra = _to_rows(df.Attribute, ignore_bad=ignore_bad)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/isaacvock/mambaforge/envs/biopython/lib/python3.12/site-packages/pyranges/readers.py", line 460, in to_rows
    rowdicts.append({k: v for k, v in parse_kv_fields(line)})
                                      ^^^^^^^^^^^^^^^^^^^^^
  File "/home/isaacvock/mambaforge/envs/biopython/lib/python3.12/site-packages/pyranges/readers.py", line 442, in parse_kv_fields
    return [kv.replace('""', '"NA"').replace('"', "").split(None, 1) for kv in line.rstrip("; ").split("; ")]
                                                                               ^^^^^^^^^^^
AttributeError: 'float' object has no attribute 'rstrip'

Error reproduces in two separate conda environments with version 0.1.4 installed and two systems (one running WSL and the other Ubuntu). I confirmed that I can read the gtf file without error in R using rtracklayer::import(). Any help resolving this issue would be much appreciated.

[EDIT]: The error also appears in version 0.0.129. Also, the code runs with no error if you use the Ensembl MANE annotation rather than the RefSeq one.

Best,
Isaac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions