<tool id="barrnap" name="barrnap" version="1.2.2">
    <description>Locate ribosomal RNA's in a fasta file. (GFF output)</description>
   <xrefs>
        <xref type="bio.tools">barrnap</xref>
    </xrefs>
    <requirements>
        <requirement type="package" version="0.9">barrnap</requirement>
    </requirements>
    <version_command>barrnap --version</version_command>
    <command detect_errors="exit_code"><![CDATA[
        ## symlink fasta because tool generates .fai
        ln -s '$fasta_file' query.fa &&

        barrnap
        --quiet
        --threads \${GALAXY_SLOTS:-1}
        --reject $reject
        --lencutoff $lencutoff
        --evalue $evalue
        #if $incseq
            --incseq
        #end if
        #if $outseq
            --outseq '$fasta_out'
        #end if
        --kingdom $kingdom
        query.fa
        > '$gff'
    ]]>
    </command>

    <inputs>
        <param name="fasta_file" type="data" format="fasta" label="Fasta file" help="Fasta file to look for rRNA's in" />
        <param name="kingdom" type="select" label="Kingdom">
            <option value="bac" selected="true">Bacteria</option>
            <option value="euk">Eukaryote</option>
            <option value="mito">Mitochondria</option>
            <option value="arc">Archaea</option>
        </param>
        <param name="reject" type="float" value="0.5" label="Reject length threshold" help="Proportional length threshold to reject prediction" />
        <param name="lencutoff" type="float" value="0.8" label="Length cutoff" help="Proportional length threshold to tag a find as pseudo" />
        <param name="evalue" type="float" value="1e-06" label="e-value" help="Similarity e-value cutoff" />
        <param name="incseq" type="boolean" label="Include Sequences in GFF" help="Include the fasta sequences in the GFF output file" />
        <param name="outseq" type="boolean" label="Save rRNA hit seqs as FASTA" help="Produce an output file of the rRNA sequences found in FASTA format." />
    </inputs>

    <outputs>
        <data name="gff" format="gff3" label="${tool.name} on ${on_string}: rRNA GFF"/>
        <data name="fasta_out" format="fasta" label="${tool.name} on ${on_string}: rRNA Sequences">
            <filter>outseq</filter>
        </data>
    </outputs>

    <tests>
        <test><!-- Test 1 -->
            <param name="fasta_file" value="bacteria.fna" ftype="fasta" />
            <param name="kingdom" value="bac" />
            <output name="gff" value="test_1.gff" ftype="gff3" />
        </test>
        <test> <!-- Test 2 -->
            <param name="fasta_file" value="small.fna" ftype="fasta" />
            <param name="kingdom" value="bac" />
            <param name="incseq" value="true" />
            <output name="gff" value="test_2.gff" ftype="gff3" />
        </test>
        <test> <!-- Test 3 -->
            <param name="fasta_file" value="small.fna" ftype="fasta" />
            <param name="kingdom" value="bac" />
            <param name="evalue" value="0.00000001" />
            <output name="gff" value="test_3.gff" ftype="gff3" />
        </test>
        <test><!-- Test 4 -->
            <param name="fasta_file" value="small.fna" ftype="fasta" />
            <param name="outseq" value="true" />
            <param name="kingdom" value="bac" />
            <output name="gff" value="test_4.gff" ftype="gff3" />
            <output name="fasta_out" value="test_4.fna" ftype="fasta" />
        </test>
    </tests>

<help>

**barrnap**

barrnap_ predicts the location of 5S, 16S and 23S ribosomal RNA genes in Bacterial genome sequences. Barrnap now supports Archaea, Eukaryota and Mitochondria. It takes FASTA DNA sequence as input, and write GFF3 as output. It uses the new NHMMER tool that comes with HMMER 3.1-dev for HMM searching in DNA:DNA style. NHMMER binaries for 64-bit Linux and Mac OS X are included and will be auto-detected. Multithreading is supported and one can expect roughly linear speed-ups with more CPUs.
This tool is designed to be a substitute for RNAmmer. It was motivated by my desire to remove Prokka's dependency on RNAmmer which is encumbered by an free-for-academic sign-up license, and by the needed legacy HMMER 2.x which conflicts with HMMER 3.x that most people are using now.

RNAmmer is more sophisticated than Barrnap, and more accurate. because it uses HMMER 2.x in glocal alignment mode, whereas HMMER 3.x currently only supports local alignment (Sean Eddy expects glocal to be supported in 2014). In practice, Barrnap will find all the typical 5/16/23S genes in bacteria, but may get the end points out by a few bases and will probably miss wierd rRNAs. The HMM models it uses are derived from RFAM, Silva, and GreenGenes.

The name Barrnap is derived from BActerial Ribosomal RNA Predictor. It was spawned at CodeFest 2013 in Berlin, Germany by Torsten Seemann and Tim Booth.

.. _barrnap: https://github.com/tseemann/barrnap

**Inputs/Parameters**

*Fasta file*: The fasta file whose contents you want to search for ribosomal RNA's.

*Kingdom*: Select the Kingdom of the organism: Bacteria, Eukarote, Mitochondria or Archaea.

*Length cutoff*: Proportional length threshold to tag a possible rRNA as pseudo.

*Reject length threshold*: Proportional length threshold to reject prediction

*E-value*: Similarity cutoff e-value.

*Include Sequences in GFF*: This includes the original fasta sequence in the GFF file below the #FASTA tag

</help>
<citations>
  <citation type="bibtex">@UNPUBLISHED{Seemann2013,
    author = "Torsten Seemann",
    title = "barrnap 0.8 : rapid ribosomal RNA prediction",
    year = "2013",
    note = "https://github.com/tseemann/barrnap"}
  </citation>
</citations>
</tool>
