Author Topic: possible error to gtf2bed  (Read 4187 times)

sdamle

  • Newbie
  • *
  • Posts: 1
possible error to gtf2bed
« on: July 31, 2015, 10:52:44 AM »
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'] = '.'


AlexReynolds

  • Administrator
  • Jr. Member
  • *****
  • Posts: 72
Re: possible error to gtf2bed
« Reply #1 on: July 31, 2015, 11:00:44 AM »
Are you perhaps using an older version of conversion scripts? I moved the conversion tools from Python to C a while back. You might check the version of tools you are using.