<p>You can select “Output BED format” on the tRNAscan-SE server:</p>

<p><a href="https://i.sstatic.net/5Lcv1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5Lcv1.png" alt="screenshot"></a></p>

<p>Given the output BED format and your input reference in FASTA format, you can easily generate a FASTA file of tRNA sequences via <a href="https://bedtools.readthedocs.io/en/latest/content/tools/getfasta.html" rel="nofollow noreferrer"><code>bedtools getfasta</code></a>:</p>

<pre><code>bedtools getfasta -name -s -fo ‹output.fasta› -fi ‹reference.fasta› -bed ‹tRNAscan-SE-output.bed›
</code></pre>

CC BY-SA 4.0
2018-10-14T06:48:04.893Z
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 :)
M.Bioinfo
CC BY-SA 4.0
2018-10-11T10:52:58.600Z
2018-10-11T10:52:58.600Z
Konrad Rudolph
<p>You can do this using the tools from the <a href="https://www.ebi.ac.uk/about/vertebrate-genomics/software/exonerate" rel="nofollow noreferrer"><code>exonerate</code> package</a>. 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 <code>fastaexplode</code>:</p>

<pre><code>fastaexplode reference.fa
</code></pre>

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

<pre><code>tmpFile=<span class="math-container">$(mktemp)
awk -F"\t" '{ 
                if(NR&gt;3){ printf "%s %s ", $1, $2; 
                    if($4&gt;$3){
                        print $3, $4-$3
                    }
                    else{
                        print $4,$3-$4,"-"
                    }
                }
            }' file | while read name num start len rev; do 
                fastasubseq "$</span>name".fa <span class="math-container">$start $</span>len &gt; <span class="math-container">$num.fa
                if [[ ! -z $</span>rev ]]; then 
                    fastarevcomp <span class="math-container">$num.fa &gt; $</span>tmpFile &amp;&amp; 
                    mv <span class="math-container">$tmpFile $</span>num.fa
                fi
                done
</code></pre>

<p>I would suggest you go with <a href="https://bioinformatics.stackexchange.com/a/5199/298">Konrad's approach</a>, however, that looks much cleaner and simpler.</p>

CC BY-SA 4.0
2018-10-11T12:13:28.893Z
2018-10-11T12:13:28.893Z
terdon
<p>I believe many of the experts here have gone through this issue,</p>

<p>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.</p>

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

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

<hr>

<p><a href="https://i.sstatic.net/8JAdp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8JAdp.png" alt="enter image description here"></a></p>

<pre><code>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
</code></pre>

CC BY-SA 4.0
2018-10-10T10:06:42.107Z
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?
llrs
CC BY-SA 4.0
2018-10-10T10:33:46.120Z
I have uploaded the table, unfortunately, the data I'm working on doesn't have a reference.
M.Bioinfo
CC BY-SA 4.0
2018-10-10T10:35:36.367Z
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
M.Bioinfo
CC BY-SA 4.0
2018-10-10T11:05:08.133Z
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?
llrs
CC BY-SA 4.0
2018-10-11T06:22:01.783Z
I did upload a copy from the data but, when past here doesn't arrange accordingly
M.Bioinfo
CC BY-SA 4.0
2018-10-11T07:05:50.950Z
I could edit and arrange the data, but consider pasting it and format it using code formatting (that will keep the structure of the data)
llrs
CC BY-SA 4.0
2018-10-11T08:03:42.103Z
What file did you run tRNAscan on? Do you have a single, multifasta file with the sequences NW_011590950.1, NW_011590951.1, NW_011590952.1 etc?
terdon
CC BY-SA 4.0
2018-10-11T10:50:05.577Z
tRNAscan-SE, when run locally, should also provide you with a FASTA output file, if I remember correctly.
Konrad Rudolph
CC BY-SA 4.0
2018-10-14T05:45:30.470Z
this is my command, im runing trnascan locally --> tRNAscan-SE -E ../GCDROM.fna -o MytRNA -f MytRna-secondary -mMytRna-statistics                          but the run end up with an errore in phase 3
M.Bioinfo
CC BY-SA 4.0
2018-10-14T05:46:39.870Z
Status: Phase I: Searching for tRNAs with HMM-enabled Infernal
Status: Phase II: Infernal verification of candidate tRNAs detected with first-pass scan
FATAL:  Unable to open output file MytRNA
M.Bioinfo
<fasta><trnascan-se>
convert tRNA coordinates Result to Fasta format
# convert tRNA coordinates Result to Fasta format

(Asked by: username_0 on 2018-10-10)

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?


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

**Tags:** fasta, trnascan-se
> **Comments:**
> **username_1**: 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?  
> **username_0**: I have uploaded the table, unfortunately, the data I'm working on doesn't have a reference.  
> **username_0**: 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  
> **username_1**: 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?  
> **username_0**: I did upload a copy from the data but, when past here doesn't arrange accordingly  
> **username_1**: I could edit and arrange the data, but consider pasting it and format it using code formatting (that will keep the structure of the data)  
> **username_2**: What file did you run tRNAscan on? Do you have a single, multifasta file with the sequences NW_011590950.1, NW_011590951.1, NW_011590952.1 etc?  
> **username_3**: tRNAscan-SE, when run locally, should also provide you with a FASTA output file, if I remember correctly.  
> **username_0**: this is my command, im runing trnascan locally --> tRNAscan-SE -E ../GCDROM.fna -o MytRNA -f MytRna-secondary -mMytRna-statistics                          but the run end up with an errore in phase 3  
> **username_0**: Status: Phase I: Searching for tRNAs with HMM-enabled Infernal Status: Phase II: Infernal verification of candidate tRNAs detected with first-pass scan FATAL:  Unable to open output file MytRNA  

---

## 2 answers

### Answer by username_3 on 2018-10-11. Score: 3 | Accepted answer

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›

> **Comments:**
> **username_0**: 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 :)  

---

### Answer by username_2 on 2018-10-11. Score: 1

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:
tmpFile=$(mktemp)
awk -F"\t" '{ 
                if(NR>3){ printf "%s %s ", $1, $2; 
                    if($4>$3){
                        print $3, $4-$3
                    }
                    else{
                        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
                fi
                done

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


---

