I want to get a set of exon regions for each protein coding gene.
I extracted a set of relevant information (chromosome, start, end, gene ID, gene name, gene type, exon number and exon ID) from a GTF using:
awk '$3 == "exon"' annotation.gtf \
| gtf2bed \
| cut -f1-4,10 \
| awk 'match($0, /gene_name \"[a-zA-Z0-9\_\-.\/]*\"/, gene_name)
&& match($0, /gene_type \"[^"]*\"/, gene_type)
&& match($0, /exon_number [0-9]*/, exon_number)
&& match($0, /exon_id \"[^"]*\"/, exon_id) {
print $1,$2,$3,$4,gene_name[0],gene_type[0],exon_number[0],exon_id[0];
}' \
| tr -d '"' \
| tr ' ' $'\t' \
| cut -f1-4,6,8,10,12 \
| grep 'protein_coding' \
> annotation.exons.bed
However, during a sanity check, I noticed that for some genes there are some exons with overlapping coordinates, same gene information and exon number, but different exon ID, e.g.:
chr2 9423650 9424052 ENSG00000119203.14 CPSF3 protein_coding 1 ENSE00001829522.1
chr2 9423653 9423823 ENSG00000119203.14 CPSF3 protein_coding 1 ENSE00001830696.2
chr2 9423883 9424960 ENSG00000119203.14 CPSF3 protein_coding 1 ENSE00001932298.1
I did not directly work with exons in the past, but I am aware of alternative splicing. My understanding was that exons can be skipped during alternative splicing, but I assumed that exon number was unique for bases, within the same gene (on the same strand).
In the example above, the first 2 listed exons have the same exon number, overlapping (but not exactly the same) bases, and different exon ID. Is this due to some additional information that I can retrieve from the GTF, i.e., from:
chr2 9423650 9424052 ENSG00000119203.14 . + HAVANA exon . gene_id "ENSG00000119203.14"; transcript_id "ENST00000475482.5"; gene_type "protein_coding"; gene_name "CPSF3"; transcript_type "protein_coding"; transcript_name "CPSF3-203"; exon_number 1; exon_id "ENSE00001829522.1"; level 2; protein_id "ENSP00000419744.1"; transcript_support_level "4"; hgnc_id "HGNC:2326"; tag "mRNA_end_NF"; tag "cds_end_NF"; havana_gene "OTTHUMG00000090415.5"; havana_transcript "OTTHUMT00000353331.3";
chr2 9423653 9423823 ENSG00000119203.14 . + HAVANA exon . gene_id "ENSG00000119203.14"; transcript_id "ENST00000238112.8"; gene_type "protein_coding"; gene_name "CPSF3"; transcript_type "protein_coding"; transcript_name "CPSF3-201"; exon_number 1; exon_id "ENSE00001830696.2"; level 2; protein_id "ENSP00000238112.3"; transcript_support_level "1"; hgnc_id "HGNC:2326"; tag "basic"; tag "MANE_Select"; tag "appris_principal_1"; tag "CCDS"; ccdsid "CCDS1664.1"; havana_gene "OTTHUMG00000090415.5"; havana_transcript "OTTHUMT00000206843.2";
?
Is this because the different exons belong to different transcripts? However, shouldn't different exons still be non-overlapping one against each other?