Extracting Sequences from a FASTA File Using Exon Coordinates from a GTF File
I have a .gtf file containing exon coordinates for all chromosomes of a species and a corresponding .fa file. I need to extract the correct sequences from the FASTA file based on the exon start and end positions provided in the .gtf file.
Can anyone suggest the best way to do this? Are there any existing tools or scripts that can help with this process?
• 1,306 views
•
link
3 answers
awk -F '\t' '($3=="exon") {printf("%s\t%d\t%s\n",$1,int($4)-1,$5);}' in.gtf | sort | uniq > exons.bed
bedtools getfasta -fi ref.fa -bed exons.bed
• 0 views
•
link
gffread is a decent option here. I'd choose that over custom awk scripts for speed and consistency. https://github.com/gpertea/gffread
• 0 views
•
link
Log in to answer this question.