pyranges1.read_gtf() currently fails on valid RefSeq GTF files where an attribute value contains a semicolon inside quotes.
Example attribute field from a RefSeq GTF:
gene_id "SELENOO"; transcript_id "NM_001115017.5"; db_xref "GeneID:417745"; gbkey "CDS"; gene "SELENOO"; note "UGA stop codon recoded as selenocysteine; The RefSeq protein has 1 substitution compared to this genomic sequence"; product "protein adenylyltransferase SelO, mitochondrial"; protein_id "NP_001108489.5"; transl_except "(pos:20486313..20486315,aa:Sec)"; exon_number "1";
Running:
import pyranges1 as pr
pr.read_gtf("GCF_016699485.2_bGalGal1.mat.broiler.GRCg7b_genomic.gtf")
produces:
ValueError: dictionary update sequence element #5 has length 1; 2 is required
This appears to come from parse_kv_fields() splitting the attribute column on ; without accounting for quoted values.
A quote-aware split (only splitting on semicolons outside quotes) would resolve this. Would you like me to submit a PR?
pyranges1.read_gtf()currently fails on valid RefSeq GTF files where an attribute value contains a semicolon inside quotes.Example attribute field from a RefSeq GTF:
Running:
produces:
ValueError: dictionary update sequence element #5 has length 1; 2 is requiredThis appears to come from
parse_kv_fields()splitting the attribute column on ; without accounting for quoted values.A quote-aware split (only splitting on semicolons outside quotes) would resolve this. Would you like me to submit a PR?