This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Where to get Gene start position to end positon for all gene in an organism

In a transcript file (.gtf) we can able to get exon wise start position and stop position, CDS and start codon region and stop codon region,but I want start position and end position of all genes (not exon wise) with its chromosome number in an organism.

gene genome

2 answers

Normally there's a "gene" entry for each gene, so:

awk 'BEGIN{FS="\t"; OFS="\t"}{if($3 == "gene") print $1, $4, $5}' foo.gtf

Thank you very much for your kind reply

As Devon said if the GTF file is from Gencode, you will have "gene" entry. Extracting "gene" entry will give you the desired results. If you use Ensembl GTF annotation (hg19 upto GRCh37.74), it does not have "gene" entry. In this case use the following script.

The output will look similar to

enter image description here

Thank you so much for your valuable reply.

Hello, I have this exact same question but I'm not seeing the code here. Anyway you could please resend the code?

Log in to answer this question.