You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
to_gtf() serializes repeated tag attributes as a single comma-separated value #214
When reading a GTF file with duplicate_attr=True and then exporting it with to_gtf(), repeated tag attributes are written as a single comma-separated value.
tag "gencode_basic"; tag "gencode_primary"; tag "Ensembl_canonical";
Exported attributes:
tag "gencode_basic,gencode_primary,Ensembl_canonical";
Expected output:
tag "gencode_basic"; tag "gencode_primary"; tag "Ensembl_canonical";
Although the exported value is a valid quoted string, it no longer represents three separate tag attributes as in the original Ensembl/GENCODE GTF. Downstream tools may interpret it as one unrecognized tag.
Is there an option to preserve repeated attributes when exporting to GTF? If not, could support for this be added?
changed the title [-]Title: to_gtf() serializes repeated tag attributes as a single comma-separated value[/-][+]to_gtf() serializes repeated tag attributes as a single comma-separated value[/+]on Nov 2, 2026
I can fix this and create a pull request if that’s okay with you. Actually, I’ve already fixed the problem and I’m going to test it tomorrow =)
But I’m also happy to wait if you’d prefer to handle it yourself.
I fixed the formatting of tag attributes in GTF output.
The updated output matches the format used by GENCODE and Ensembl, where each tag value is written as a separate tag attribute:
tag "gencode_basic"; tag "gencode_primary"; tag "Ensembl_canonical";
In the NCBI RefSeq GTF examples I checked, each feature had only one tag attribute, such as:
tag "MANE Select";
Single tag values are unaffected by this change.
I tested the changes on an Ensembl (Homo_sapiens.GRCh38.116.chr.gtf.gz) GTF file. After the fix, to_gtf() produced separate tag attributes as expected.
The GENCODE format documentation explicitly allows multiple occurrences of tag and includes examples:
Activity
[-]Title: to_gtf() serializes repeated tag attributes as a single comma-separated value[/-][+]to_gtf() serializes repeated tag attributes as a single comma-separated value[/+]endrebak commentedon Nov 3, 2026
It would be simple to add. I can try to do so this weekend. I will have to look at the file spec first and see it is valid though.
CaptainLabMan commentedon Nov 3, 2026
I can fix this and create a pull request if that’s okay with you. Actually, I’ve already fixed the problem and I’m going to test it tomorrow =)
But I’m also happy to wait if you’d prefer to handle it yourself.
endrebak commentedon Nov 4, 2026
Feel free to create a PR.
CaptainLabMan commentedon Nov 5, 2026
I fixed the formatting of
tagattributes in GTF output.The updated output matches the format used by GENCODE and Ensembl, where each tag value is written as a separate
tagattribute:tag "gencode_basic"; tag "gencode_primary"; tag "Ensembl_canonical";In the NCBI RefSeq GTF examples I checked, each feature had only one
tagattribute, such as:tag "MANE Select";Single tag values are unaffected by this change.
I tested the changes on an Ensembl (Homo_sapiens.GRCh38.116.chr.gtf.gz) GTF file. After the fix,
to_gtf()produced separatetagattributes as expected.The GENCODE format documentation explicitly allows multiple occurrences of
tagand includes examples: