view kaks_analysis.xml @ 4:48271ee78198 draft

Uploaded
author greg
date Thu, 21 Dec 2017 09:17:01 -0500
parents 1fb0f2092177
children a5639484fb63
line wrap: on
line source

<tool id="plant_tribes_kaks_analysis" name="KaKsAnalysis" version="@WRAPPER_VERSION@.3.0">
    <description>estimates paralogous and orthologous pairwise synonymous (Ks) and non-synonymous (Ka) substitution rates</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <requirements>
        <requirement type="package" version="1.0.3">plant_tribes_kaks_analysis</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
#set output_dir = 'kaksAnalysis_dir'
#set comparison = $comparison_cond.comparison
#if str($options_type.options_type_selector) == 'advanced':
    #set codeml_ctl_file_cond = $options_type.codeml_ctl_file_cond
    #set codeml_ctl_file_select = $codeml_ctl_file_cond.codeml_ctl_file_select
    #set fit_components_cond = $options_type.fit_components_cond
    #set fit_components = $fit_components_cond.fit_components
    #set recalibrate_cond = $options_type.recalibrate_cond
    #set recalibrate = $recalibrate_cond.recalibrate
    #set set_min_coverage_cond = $options_type.set_min_coverage_cond
    #set set_min_coverage = $set_min_coverage_cond.set_min_coverage
    #set set_lower_ks_limit_cond = $options_type.set_lower_ks_limit_cond
    #set set_lower_ks_limit = $set_lower_ks_limit_cond.set_lower_ks_limit
    #set set_upper_ks_limit_cond = $options_type.set_upper_ks_limit_cond
    #set set_upper_ks_limit = $set_upper_ks_limit_cond.set_upper_ks_limit
#else:
    #set codeml_ctl_file_select = 'no'
    #set fit_components = 'no'
    #set set_lower_ks_limit = 'no'
    #set set_upper_ks_limit = 'no'
#end if
KaKsAnalysis
--num_threads \${GALAXY_SLOTS:-4}
--coding_sequences_species_1 '$coding_sequences_species_1'
--proteins_species_1 '$proteins_species_1'
--comparison $comparison
#if str($comparison) == 'orthologs':
    --coding_sequences_species_2 '$comparison_cond.coding_sequences_species_2'
    --proteins_species_2 '$comparison_cond.proteins_species_2'
    #if str($comparison_cond.blast_option) == 'crbblast':
        --crb_blast
    #end if
#end if
#if str($options_type.options_type_selector) == 'advanced':
    #if str($set_min_coverage) == 'yes':
        --min_coverage $set_min_coverage_cond.min_coverage
    #end if
    #if str($recalibrate) == 'yes':
        --recalibration_rate $recalibrate_cond.recalibration_rate
    #end if
    #if str($codeml_ctl_file_select) == 'yes':
        --codeml_ctl_file '$codeml_ctl_file_cond.codeml_ctl_file'
        # No else block needed here because the default codeml_ctl config
        # will be used if the --codeml_ctl_file flag is missing.
    #end if
    #if str($fit_components) == 'yes':
        --fit_components
        --num_of_components $fit_components_cond.num_of_components
    #end if
    #if str($set_lower_ks_limit) == 'yes':
        --min_ks $set_lower_ks_limit_cond.min_ks
    #end if
    #if str($set_upper_ks_limit) == 'yes':
        --max_ks $set_upper_ks_limit_cond.max_ks
    #end if
#end if
&>kaks_analysis_log.txt;
if [[ $? -ne 0 ]]; then
    cp kaks_analysis_log.txt '$output_species1_fna';
    cp kaks_analysis_log.txt '$output_species1_faa';
    #if str($comparison) == 'paralogs':
        cp kaks_analysis_log.txt '$output_species1_paralog';
        cp kaks_analysis_log.txt '$output_rbhb_paralog';
    #else:
        cp kaks_analysis_log.txt '$output_species2_faa';
        cp kaks_analysis_log.txt '$output_species2_fna';
        cp kaks_analysis_log.txt '$output_species1_ortholog';
        cp kaks_analysis_log.txt '$output_species2_ortholog';
        cp kaks_analysis_log.txt '$output_rbhb_ortholog';
    #end if
    cp kaks_analysis_log.txt '$output_kaks';
    #if str($fit_components) == 'yes':
        cp kaks_analysis_log.txt '$output_components'
    #end if
else
    && mv $output_dir/species1.fna '$output_species1_fna'
    && mv $output_dir/species1.faa '$output_species1_faa'
    #if str($comparison) == 'paralogs':
        && mv $output_dir/species1.fna.blastn.paralogs '$output_species1_paralog'
        && mv $output_dir/*.rbhb '$output_rbhb_paralog'
    #else:
        && mv $output_dir/species2.faa '$output_species2_faa'
        && mv $output_dir/species2.fna '$output_species2_fna'
        && mv $output_dir/species1.fna.blastn.orthologs '$output_species1_ortholog'
        && mv $output_dir/species2.fna.blastn.orthologs '$output_species2_ortholog'
        && mv $output_dir/*.rbhb '$output_rbhb_ortholog'
    #end if
    && mv $output_dir/*.kaks '$output_kaks'
    #if str($fit_components) == 'yes':
        && mv $output_dir/*.components '$output_components'
    #end if
fi
    ]]></command>
    <inputs>
        <param name="coding_sequences_species_1" format="fasta" type="data" label="Coding sequences for the first species" />
        <param name="proteins_species_1" format="fasta" type="data" label="Protein sequences for the first species" />
        <conditional name="comparison_cond">
            <param name="comparison" type="select" label="Type of sequence comparison">
                <option value="paralogs" selected="true">Paralogous</option>
                <option value="orthologs">Orthologous</option>
            </param>
            <when value="paralogs" />
            <when value="orthologs">
                <param name="coding_sequences_species_2" format="fasta" type="data" label="Coding sequences for the second species" />
                <param name="proteins_species_2" format="fasta" type="data" label="Protein sequences for the second species" />
                <param name="blast_option" type="select" display="radio" label="Determine for cross-species orthologs using">
                    <option value="blast" selected="true">reciprocal best BLAST</option>
                    <option value="crbblast">conditional reciprocal best BLAST</option>
                </param>
            </when>
        </conditional>
        <conditional name="options_type">
            <param name="options_type_selector" type="select" label="Options Configuration">
                <option value="basic" selected="true">Basic</option>
                <option value="advanced">Advanced</option>
            </param>
            <when value="basic" />
            <when value="advanced">
                <conditional name="set_min_coverage_cond">
                    <param name="set_min_coverage" type="select" label="Alignment coverage configuration">
                        <option value="no" selected="true">No</option>
                        <option value="yes">Yes</option>
                    </param>
                    <when value="no" />
                    <when value="yes">
                        <param name="min_coverage" type="float" value="0.5" min="0.3" max="1.0" label="match score" />
                    </when>
                </conditional>
                <conditional name="recalibrate_cond">
                    <param name="recalibrate" type="select" label="Species rates recalibration configuration">
                        <option value="no" selected="true">No</option>
                        <option value="yes">Yes</option>
                    </param>
                    <when value="no" />
                    <when value="yes">
                        <param name="recalibration_rate" type="float" value="0.0" min="0.0" label="Recalibration rate" />
                    </when>
                </conditional>
                <conditional name="codeml_ctl_file_cond">
                    <param name="codeml_ctl_file_select" type="select" label="PAML codeml configuration">
                        <option value="no" selected="true">No</option>
                        <option value="yes">Yes</option>
                    </param>
                    <when value="no" />
                    <when value="yes">
                        <param name="codeml_ctl_file" format="txt" type="data" label="PAML codeml control file" />
                    </when>
                </conditional>
                <conditional name="fit_components_cond">
                    <param name="fit_components" type="select" label="Rates clustering configuration">
                        <option value="no" selected="true">No</option>
                        <option value="yes">Yes</option>
                    </param>
                    <when value="no" />
                    <when value="yes">
                        <param name="num_of_components" type="integer" value="1" min="1" label="Number of components" />
                    </when>
                </conditional>
                <conditional name="set_lower_ks_limit_cond">
                    <param name="set_lower_ks_limit" type="select" label="Lower limit synonymous subsitution rates configuration">
                        <option value="no" selected="true">No</option>
                        <option value="yes">Yes</option>
                    </param>
                    <when value="no" />
                    <when value="yes">
                        <param name="min_ks" type="float" value="0.0" min="0.0" label="Minimum rate" />
                    </when>
                </conditional>
                <conditional name="set_upper_ks_limit_cond">
                    <param name="set_upper_ks_limit" type="select" label="Upper limit synonymous subsitution rates configuration">
                        <option value="no" selected="true">No</option>
                        <option value="yes">Yes</option>
                    </param>
                    <when value="no" />
                    <when value="yes">
                        <param name="max_ks" type="float" value="0.0" min="0.0" label="Maximum rate" />
                    </when>
                </conditional>
            </when>
        </conditional>
        <!-- Required due to the Emmix license -->
        <param name="non_commercial_use" label="I certify that I am not using this tool for commercial purposes." type="boolean" truevalue="NON_COMMERCIAL_USE" falsevalue="COMMERCIAL_USE" checked="False">
            <validator type="expression" message="This tool is only available for non-commercial use.">value == True</validator>
        </param>
    </inputs>
    <outputs>
        <data name="output_species1_fna" format="fasta" label="${tool.name} (coding sequences species1) on ${on_string}" />
        <data name="output_species1_faa" format="fasta" label="${tool.name} (amino acids species1) on ${on_string}" />
        <data name="output_species2_fna" format="fasta" label="${tool.name} (coding sequences species2) on ${on_string}">
            <filter>comparison_cond['comparison'] == 'orthologs'</filter>
        </data>
        <data name="output_species2_faa" format="fasta" label="${tool.name} (amino acids species2) on ${on_string}">
            <filter>comparison_cond['comparison'] == 'orthologs'</filter>
        </data>
        <data name="output_species1_paralog" format="tabular" label="${tool.name} (blastn results species1 vs species1) on ${on_string}">
            <filter>comparison_cond['comparison'] == 'paralogs'</filter>
        </data>
        <data name="output_species1_ortholog" format="tabular" label="${tool.name} (blastn results species1 vs species2) on ${on_string}">
            <filter>comparison_cond['comparison'] == 'orthologs'</filter>
        </data>
        <data name="output_species2_ortholog" format="tabular" label="${tool.name} (blastn results species2 vs species1) on ${on_string}">
            <filter>comparison_cond['comparison'] == 'orthologs'</filter>
        </data>
        <data name="output_rbhb_paralog" format="tabular" label="${tool.name} (paralogous pairs) on ${on_string}">
            <filter>comparison_cond['comparison'] == 'paralogs'</filter>
        </data>
        <data name="output_rbhb_ortholog" format="tabular" label="${tool.name} (orthologous pairs) on ${on_string}">
            <filter>comparison_cond['comparison'] == 'orthologs'</filter>
        </data>
        <data name="output_kaks" format="tabular" label="${tool.name} (KaKs distribution) on ${on_string}" />
        <data name="output_components" format="ptkscmp" label="${tool.name} (significant components in the KaKs distribution) on ${on_string}">
            <filter>options_type['options_type_selector'] == 'advanced' and options_type['fit_components_cond']['fit_components'] == 'yes'</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="coding_sequences_species_1" value="species1_cds.fasta" ftype="fasta"/>
            <param name="proteins_species_1" value="species1_pep.fasta" ftype="fasta"/>
            <param name="non_commercial_use" value="True"/>
            <output name="output_species1_fna" file="species1_cds.fasta" ftype="fasta" compare="contains"/>
            <output name="output_species1_faa" file="species1_pep.fasta" ftype="fasta" compare="contains"/>
            <output name="output_species1_paralog" file="output_blastn_results1.tabular" ftype="tabular" compare="contains"/>
            <output name="output_rbhb_paralog" file="output_paralogous_pairs.tabular" ftype="tabular"/>
            <output name="output_kaks" file="output1.tabular" ftype="tabular"/>
        </test>
    </tests>
    <help>
This tool is one of the PlantTribes collection of automated modular analysis pipelines for comparative and evolutionary analyses
of genome-scale gene families and transcriptomes.  This tool estimates paralogous and orthologous pairwise synonymous (Ks) and
non-synonymous (Ka) substitution rates for a set of gene coding sequences either produced by the AssemblyPostProcessor tool or
from an external source.  Optionally, the resulting set of estimated Ks values can be clustered into components using a mixture
of multivariate normal distributions to identify significant duplication event(s) in a species or a pair of species.

-----

 * **Required options**

  - **Coding sequences for the first species** - coding sequence fasta file for the first species either produced by the AssemblyPostProcessor tool or from an external source selected from your history.
  - **Protein sequences for the first species** - corresponding protein sequence fasta files for the first species either produced by the AssemblyPostProcessor tool or from an external source selected from your history.
  - **Type of sequence comparison** - pairwise sequence comparison to determine homologous pairs.  This can be either paralogous for self-species comparison or orthologous for cross-species comparison.  Cross-species comparison requires input for the second species.

 * **Other options**

  - **Coding sequences for the second species** - coding sequence fasta file for the second species either produced by the AssemblyPostProcessor tool or from an external source selected from your history.  This option is required only for orthologous comparison.
  - **Protein sequences for the second species** - corresponding protein sequence fasta files for the second species either produced by the AssemblyPostProcessor tool or from an external source selected from your history.  This option is required only for orthologous comparison.

  - **Determine for cross-species orthologs using** - select option for blast orthology.

    - **reciprocal best BLAST** - use the default stringent reciprocal BLAST package for orthology assignment.
    - **conditional reciprocal best BLAST** - use the CRB-BLAST package for orthology assignment which increases sensitivity to orthology comparisons and determines additional cross-species orthologs that are being left out by the defaul stringent reciprocal BLAST.

  - **Alignment coverage configuration** - select 'Yes' to set the minimum allowable alignment coverage length between homologous pairs.  PlantTribes uses global codon alignment match score to determine the pairwise alignment coverage.  By default, the match score is set to 0.5 if 'No' is selected.

    - **match score** - number of base matches in a pairwise sequence alignment divided by the length of shorter sequence.  Positions in the alignment corresponding to gaps are not considered.  The score is restricted to the range 0.3 - 1.0.

  - **Species rates recalibration configuration** - select 'Yes' to recalibrate synonymous substitution rates of a species using a predetermined evolutionary rate.  Recalibration evolutionary rate can be determined from a species tree inferred from a collection of conserved single copy genes from taxa of interest as described in [7].  Rate recalibration applies only to paralogous comparisons.

    - **recalibration rate** - a predetermined evolutionary recalibration rate.

  - **PAML codeml configuration** - select 'Yes' to enable selection of a PAML codeml control file to carry out maximum likelihood analysis of protein-coding DNA sequences using codon substitution models.  Template file "codeml.ctl.args" can be found in the scaffold data installed into Galaxy via the PlantTribes Scaffolds Download Data Manager tool, and are also available at the PlantTribes GitHub `repository`_.  Default settings shown in the template are used if 'No' is selected.
  - **Rates clustering configuration** - select 'Yes' to estimate clusters of synonymous substitution rates using a mixture of multivariate normal distributions which represent putative duplication event(s).

    - **Number of components** - number of components to include in the normal mixture model.

  - **Lower limit synonymous substitution rates configuration** - select 'Yes' to set the minimum allowable synonymous substitution rate to use in the normal mixtures cluster analysis to exclude young paralogs that arise from normal gene births and deaths in a genome.

    - **Minimum rate** - minimum allowable synonymous substitution rate.

  - **Upper limit synonymous substitution rates configuration** - select 'Yes' to set the maximum allowable synonymous substitution rate to use in the normal mixtures cluster analysis to exclude likely ancient paralogs in a genome.

    - **Maximum rate** - maximum allowable synonymous substitution rate.

.. _repository: https://github.com/dePamphilis/PlantTribes/blob/master/config/codeml.ctl.args

    </help>
    <citations>
        <expand macro="citation1" />
        <citation type="bibtex">
            @article{Wall2008,
            journal = {Nucleic Acids Research},
            author = {2. Wall PK, Leebens-Mack J, Muller KF, Field D, Altman NS},
            title = {PlantTribes: a gene and gene family resource for comparative genomics in plants},
            year = {2008},
            volume = {36},
            number = {suppl 1},
            pages = {D970-D976},}
        </citation>
        <citation type="bibtex">
            @article{Altschul1990,
            journal = {Journal of molecular biology}
            author = {3. Altschul SF, Gish W, Miller W, Myers EW, Lipman DJ},
            title = {Basic local alignment search tool},
            year = {1990},
            volume = {215},
            number = {3},
            pages = {403-410},}
        </citation>
        <citation type="bibtex">
            @article{Katoh2013,
            journal = {Molecular biology and evolution},
            author = {4. Katoh K, Standley DM},
            title = {MAFFT multiple sequence alignment software version 7: improvements in performance and usability},
            year = {2013},
            volume = {30},
            number = {4},
            pages = {772-780},}
        </citation>
        <citation type="bibtex">
            @article{Yang2007,
            journal = {Molecular biology and evolution},
            author = {5. Yang Z},
            title = {PAML 4: phylogenetic analysis by maximum likelihood},
            year = {2007},
            volume = {24},
            number = {8},
            pages = {1586-1591},}
        </citation>
        <citation type="bibtex">
            @article{McLachlan1999,
            journal = {Journal of Statistical Software},
            author = {6. McLachlan GJ, Peel D, Basford KE, Adams P},
            title = {The EMMIX software for the fitting of mixtures of normal and t-components},
            year = {1999},
            volume = {4},
            number = {2},
            pages = {1-14},}
        </citation>
        <citation type="bibtex">
            @article{Cui2006,
            journal = {Genome Research},
            author = {7. Cui L, Wall PK, Leebens-Mack JH, Lindsay BG, Soltis DE, Doyle JJ, Soltis PS, Carlson JE, Arumuganathan K, Barakat A, Albert VA},
            title = {Widespread genome duplications throughout the history of flowering plants},
            year = {2006},
            volume = {16},
            number = {6},
            pages = {738-749},}
        </citation>
    </citations>
</tool>