view mrbayes.xml @ 2:2fe97192eb4b draft

fix_bug to ensure that non 0 exit code when it fails
author nml
date Fri, 18 Dec 2015 14:21:08 -0500
parents bd36a094f934
children bd2c8053e155
line wrap: on
line source

<?xml version="1.0"?>
<tool id="mrbayes" name="MrBayes" version="1.0.1">
  <description>with options and commands</description>
  <requirements>
    <requirement type="package" version="3.2.6">mrbayes</requirement>
  </requirements>
  <stdio>
    <exit_code range="1:" level="fatal" description="Unknown error has occurred"/>
  </stdio>
  <command> mb $command_file > $outfile
## print list of avaialble variables
#silent sys.stderr.write("\n \n \n ======== Cheetah template variables ========\n")
#for k,v in $searchList[2].items()
#silent   sys.stderr.write(" %s = %s\n" % (str(k), str(v) ))
#end for
#silent sys.stderr.write("======== End of Cheetah template variables ========\n \n \n")
  </command>
  <configfiles>
    <configfile name="command_file">
        begin mrbayes;
        set Seed=$seed;
        set Swapseed=$swapseed;
        set quitonerror=yes;
        execute $data;
        outgroup $outgroup;
        $model;
        lset rates=$rates;
#if str($filename) != ""
    mcmcp filename=$filename;
#end if#
        mcmcp ngen=$ngen nrun=$nrun nchain=$nchain checkfreq=$checkfreq samplefreq=$samplefreq printfreq=$printfreq stoprule=$stoprule burninfrac=$burninfrac;
#if int($ngen) >= int($checkfreq)
    $append;
#end if#
        mcmc;
        $sump
        $sumt
#if str($plot) == "plot"
    plot;
#end if#
        end;
    </configfile>
  </configfiles>
  <inputs>
    <param name="data" type="data" format="nex" label="Nexus input file"/>

    <param name="filename" type="text" label="Output filename" size="10" value=""
      help="Output files will be named this with .p, .t, .mcmc extensions. Use to avoid overwriting files when running repeated analyses on the same dataset." />

    <param name="ngen" type="integer" label="&lt;hr&gt;Number of generations" value="10000" >
      <validator type="in_range" min="1" max="inf" message="Must be greater than or equal to 1"/>
    </param>
    <param name="nchain" type="integer" label="Number of chains" value="2" >
       <validator type="in_range" min="1" max="inf" message="Must be greater than or equal to 1"/>
    </param>
    <param name="nrun" type="integer" label="Number of runs" value="2" >
      <validator type="in_range" min="1" max="inf" message="Must be greater than or equal to 1"/>
    </param>

    <param name="outgroup" type="text" label="&lt;hr&gt;Outgroup" size="10" value="1"
      help="The name or number identifying one taxon from the data." />
    <param name="model" type="select" label="Choose model">
      <sanitizer sanitize="False" />
      <option value="lset nst=6"                                >GRT</option>
      <option value="lset nst=6; prset statefreqpr=fixed(equal)">SYM</option>
      <option value="lset nst=2"                                >HKY</option>
      <option value="lset nst=2; prset statefreqpr=fixed(equal)">K2P</option>
      <option value="lset nst=1"                                >F81</option>
      <option value="lset nst=1; prset statefreqpr=fixed(equal)">JC </option>
      <option value="lset nst=mixed"                            >Mixed </option>
      <help>Models are defined below and are only valid for nucleotide data.</help>
    </param>
    <param name="rates" type="select" label="Choose rates">
      <option value="equal"/>
      <option value="gamma"/>
      <option value="propinv"/>
      <option value="invgamma"/>
      <option value="adgamma"/>
    </param>
    <param name="samplefreq" type="integer" label="&lt;hr&gt;Sample frequency" value="500" >
       <validator type="in_range" min="1" max="inf" message="Must be greater than or equal to 1"/>
       <help>Frequency with which output it written to files." </help>
    </param>
    <param name="printfreq" type="integer" label="Print frequency" value="500" >
       <validator type="in_range" min="1" max="inf" message="Must be greater than or equal to 1"/>
       <help>Frequency with which output is printed to the screen.</help>
    </param>
    <param name="burninfrac" type="float" label="Burn-in fraction" value="0.25">
      <validator type="in_range" min="0.01" max=".50" message="Must be between 0.01 and .50"/>
      <help>Fraction of samples to discard when summarizing. </help>
    </param>
    <param name="stoprule" type="select" label="Stop rule?" >
      <option value="no">No</option>
      <option value="yes">Yes</option>
    </param>
    <param name="sump" type="boolean" truevalue="sump;" falsevalue="" label="&lt;hr&gt;Include sump?"
        help="Summarizes sampled parameter value."/>
    <param name="sumt" type="boolean" truevalue="sumt;" falsevalue="" label="Include sumt?"
        help="Summarizes the trees."/>
    <param name="plot" type="boolean" truevalue="plot" falsevalue="" label="Include plot?"
        help="Creates an x-y graph of the parameter over the course of the chain."/>

    <param name="checkfreq" type="integer" label="&lt;hr&gt;Checkpoint frequency" value="100000" >
       <validator type="in_range" min="100" max="inf" message="Must be greater than or equal to 100"/>
       <help>Frequency with which checkpoints are written. Used for continuing analysis with append.</help>
    </param>
    <param name="append" type="boolean" truevalue="mcmcp append=yes" falsevalue="mcmcp append=no" label="Append to last checkpoint?"
        help="Requires .ckp file (i.e. that number of generations > checkpoint frequency for previous analysis)." />
    <param name="seed" type="integer" label="&lt;hr&gt;Seed" optional="false" value="5"
      help="Specify a seed with which to run the job.">
      <validator type="in_range" min="1" max="inf" message="Must be greater than or equal to 1"/>
    </param>
    <param name="swapseed" type="integer" label="&lt;hr&gt;Swap Seed" optional="false" value="5"
      help="Specify a swap seed with which to run the job.">
      <validator type="in_range" min="1" max="inf" message="Must be greater than or equal to 1"/>
    </param>
  </inputs>
  <outputs>
    <data name="outfile" format="txt"/>
  </outputs>

  <tests>
    <test>
      <param name="data" value="avian_ovomucoids.nex"/>
      <output name="outfile">
        <assert_contents>
          <has_text text="        500 -- [-6144.805] (-6235.323) * [-5853.458] (-5936.317)"/>
          <has_text text="       3000 -- (-4258.327) [-3872.656] * [-3961.044] (-3988.174)"/>
          <has_text text="       5000 -- (-3805.933) [-3708.438] * [-3704.553] (-3727.547)"/>
          <has_text text="       8000 -- [-3676.746] (-3665.247) * [-3621.851] (-3665.758)"/>
          <has_text text="      10000 -- [-3639.639] (-3639.407) * [-3613.090] (-3667.495)"/>
          <has_text text="            13.4 %     ( 11 %)     TLMultiplier(V)"/>
          <has_text text="            12.4 %     ( 10 %)     TLMultiplier(V)"/>
          <has_text text="         1 |          0.14 "/>
          <has_text text="         1 |          0.19 "/>
        </assert_contents>
      </output>
    </test>
  </tests>

<help>

.. class:: warningmark

This tool takes as input a Nexus file (.nex), described here_, that should only contain a data block, without commands. If a command block exists in the file, it will be executed first, followed by the ones specified above.

.. _here: http://en.wikipedia.org/wiki/Nexus_file.

-----

**What it does**

MrBayes is a program for Bayesian inference and model choice across a wide range of phylogenetic and evolutionary models. MrBayes uses Markov chain Monte Carlo (MCMC) methods to estimate the posterior distribution of model parameters.

See the manual_ or the `command reference`_ for more information.

.. _manual: http://mrbayes.sourceforge.net/manual.php
.. _command reference: http://mrbayes.sourceforge.net/commref_mb3.2.pdf

-----

**Model Definitions**

Models are defined by the following MrBayes options::

 GRT: lset nst=6;
 SYM: lset nst=6; prset statefreqpr=fixed(equal);
 HKY: lset nst=2;
 K2P: lset nst=2; prset statefreqpr=fixed(equal);
 F81: lset nst=1;
 JC: lset nst=1; prset statefreqpr=fixed(equal);
 Mixed: lset nst=mixed;

Each model makes different assumptions about nucelotide substitution rates and state frequencies.

The mixed model performs Markov chain sampling over the space of all possible reversible substitution models, by grouping the six rates in various combinations.

-----

.. class:: infomark

**Tip for repetitive analyses**

Note that running the same analysis  on the same dataset in Galaxy will overwrite .p, .t, and .mcmc files for that dataset. This can be avoided by copying the dataset or re-uploading it, or by specifying a new filename.

.. class:: infomark

**Tip for using append**

If you want to use the append functionality, all parameters will have to be identical to your initial analysis. The easiest way to ensure this is by using the blue "Run this job again" arrow on the dataset, and checking the additional append box. Note also that ngen will be the total number of generations, not the number of generations to add, so you should increase this value except if a run was interrupted. Selecting append while checkfreq > ngen will have no effect.

-----

Wrapper originally created by AAFC-MBB -> https://github.com/AAFC-MBB/
</help>
<citations>
  <citation type="bibtex">@ARTICLE {huelsenbeckjpronquistf.2001,
    author  = {Huelsenbeck JP,  Ronquist F.},
    title   = {MRBAYES: Bayesian inference of phylogenetic trees.},
    journal = {Bioinformatics},
    year    = {2001},
    volume  = {17},
    pages   = {754-755},
    url     = {http://www.ncbi.nlm.nih.gov/pubmed/11524383}
  }</citation>
</citations>
</tool>