This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get sequences for all genes in a GTF file

I have a gtf file like:

scaffold_0      maker  exon    9496    9623    .       +       .       transcript_id "RHOH"; transcript_id_full "RHOH"
scaffold_0      StringTie       exon    11728   11971   .       +       .       transcript_id "RHOH"; transcript_id_full "RHOH"
scaffold_0      maker   exon    12077   12144   .       +       .       transcript_id "RHOH"; transcript_id_full "RHOH"
scaffold_0      StringTie       exon    20708   23579   .       +       .       transcript_id "RHOH"; transcript_id_full "RHOH"
scaffold_0      maker   exon    39534   40131   .       -       .       transcript_id "gene17"; transcript_id_full "gene17"
scaffold_0      maker   exon    43071   43701   .       +       .       transcript_id "gene1"; transcript_id_full "gene1"
scaffold_0      maker   exon    57526   57640   .       +       .       transcript_id "CHRNA9"; transcript_id_full "CHRNA9"
scaffold_0      maker   exon    58475   58630   .       +       .       transcript_id "CHRNA9"; transcript_id_full "CHRNA9"
scaffold_0      maker   exon    59298   59831   .       +       .       transcript_id "CHRNA9"; transcript_id_full "CHRNA9"
scaffold_0      maker   exon    60967   61512   .       +       .       transcript_id "CHRNA9"; transcript_id_full "CHRNA9"

and a .fa scaffold file:

>scaffold_0
agcagggctggagcaggagcagggctggagctggagcaaggctggagcag
gagcagggctggggctggagcagggctggagcaggagcaggagcagggct
ggagcagggctggagctagagcaggggctggagcagggctggggctggag
cagggctggagctggagcagggctggagctagagcaggggctggagcagg
agcagggctggagcaggagcagggctggagctagagcacgggctggagca
gggctggggctggagcagggctggagcaggagcaggggctggggctggag
caggggctggagcagggactggagcagggctggagcagggctggagcagg
gctggagcagggccggggctggagcGGGGTGCCGGCTCCCTCGTGGCTGG
CAGGCGGTGTGTGCTCGGCGAGcCCCCGGAGCCGGAGCCCCGGGGCGGGG

and would like to output the sequences for individual transcripts:

something maybe like (or similar to in some way):

>scaffold_0      maker  exon    9496    9623    .       +       .       transcript_id "RHOH"; transcript_id_full "RHOH"
GGTGCCGGCTCCCTCGTGGCTGGCAGGCGGTGTGTGCTCGGCGAGcCCCCGGAGCCGGAGCCCCGGG ...
>scaffold_0      StringTie    exon    11728   11971   .       +       .       transcript_id "RHOH"; transcript_id_full "RHOH"
GAGAGAGAAAACGGCAAAAGTCAGAGTTTAGAGAAACAGATGTGGGTTTGCACGTTCTGCACGTTCTCCCTTTG ...

and so on.

Do I have to code it up or there is a tool that would allow me to do this? If I do have to code for it. Would you have insights on how to do it in a easy way?

genome assembly

Take a look at gffread utility here.

0 answers

No answers yet.

Log in to answer this question.