I believe many of the experts here have gone through this issue,

I have run tRNAscan-SE on my genome to predict all the tRNAs, and have successfully gotten all the tRNA coordinates like start, end and type all arranged in a table.

My question is how can I convert this result to fasta format as long I have all the details about the tRNA ready?

Is there any tool that I can use to get the fasta sequences of the regions described in my table from the original genome?

enter image description here

Sequence                tRNA    Bounds  tRNA    Anti    Intron Bounds   Inf       
Name            tRNA #  Begin   End     Type    Codon   Begin   End     Score   Note
--------        ------  -----   ------  ----    -----   -----   ----    ------  ------
NW_011590950.1  1       36704   36632   Ala     AGC     0       0       40.8    pseudo
  • $\begingroup$ Could you provide the table you are referring? Having some sample data will help us to answer your questions. Do you have the reference genome? Many thanks! BTW, what have you tried? Perhaps manually finding the sequence or something else? $\endgroup$
    – llrs
    Commented Oct 10, 2018 at 10:06
  • $\begingroup$ I have uploaded the table, unfortunately, the data I'm working on doesn't have a reference. $\endgroup$
    – M.Bioinfo
    Commented Oct 10, 2018 at 10:33
  • $\begingroup$ finding these results just by running tRNAscan on my genome, the table above is my Results, in fact, I need a fasta format has all the tRNA sequence to implemented in another tool $\endgroup$
    – M.Bioinfo
    Commented Oct 10, 2018 at 10:35
  • 2
    $\begingroup$ You provided a picture, could you provide text that could be used to copy and paste to make it easier for people to use the information? $\endgroup$
    – llrs
    Commented Oct 10, 2018 at 11:05
  • $\begingroup$ I did upload a copy from the data but, when past here doesn't arrange accordingly $\endgroup$
    – M.Bioinfo
    Commented Oct 11, 2018 at 6:22

2 Answers 2


You can select “Output BED format” on the tRNAscan-SE server:


Given the output BED format and your input reference in FASTA format, you can easily generate a FASTA file of tRNA sequences via bedtools getfasta:

bedtools getfasta -name -s -fo ‹output.fasta› -fi ‹reference.fasta› -bed ‹tRNAscan-SE-output.bed›
  • $\begingroup$ thank you for the respond, but I'm running it locally, and the output options are Secondary, statistics, and shown table. but currently, I have submitted the job to their server, let's wait and see :) $\endgroup$
    – M.Bioinfo
    Commented Oct 14, 2018 at 6:48

You can do this using the tools from the exonerate package. I assume you have all the sequences shown in your table in a single, multifasta file. If so, first create a single file per sequence using fastaexplode:

fastaexplode reference.fa

This will create one file for each sequence in reference.fa. Now, you can read through the results table, and extract the sequences:

awk -F"\t" '{ 
                if(NR>3){ printf "%s %s ", $1, $2; 
                        print $3, $4-$3
                        print $4,$3-$4,"-"
            }' file | while read name num start len rev; do 
                fastasubseq "$name".fa $start $len > $num.fa
                if [[ ! -z $rev ]]; then 
                    fastarevcomp $num.fa > $tmpFile && 
                    mv $tmpFile $num.fa

I would suggest you go with Konrad's approach, however, that looks much cleaner and simpler.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.