This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to extract coordinates of first exons from .gtf file.

Hi All,

Supposed I have a .gtf file with the exons of all genes in a given genome. I would like to extract the first exon coordinate of each gene from the .gtf file. How should I get started?

Regards,
Ziyi

rna-seq gtf genome exon

1 answer

As your question is about getting started, I would suggest to look for code snippets or libraries that parse GTF files to get an idea about handling a GTF file.

For example:

http://www-huber.embl.de/users/anders/HTSeq/doc/tour.html#tour

https://github.com/ctokheim/PrimerSeq/blob/master/gtf.py

But a quick and dirty way would be:

curl https://raw.githubusercontent.com/roryk/DEXSeq/master/inst/python_scripts/dexseq_prepare_annotation.py  | python - genes.gtf out.tmp​
grep "exonic_part_number \"001\"" out.tmp | less -S

This gives all the first exonic parts of a gene, assuming a standard gtf file format.

Thank you! HTseq seems promising and I think I found some leads in the TSS Plot.

I updated my ans. accept it if it works for you.

Log in to answer this question.