The documentation states that the gene_id attribute of a gtf file maps to the element ID (4th BED column), however the coding seems to indicate that gene_name is the preferred source column and that gene_id is mapped secondarily if gene_name is not present. IMO the documentation has the correct intent because gene_ids will likely be unique, whereas gene names dont need to be. Could we make the code reflect this?
try:
cols['id'] = attrd['gene_name'].replace('"', '').strip().rstrip(';')
except KeyError:
try:
cols['id'] = attrd['gene_id'].replace('"', '').strip().rstrip(';')
except KeyError:
cols['id'] = '.'