view rrparser.xml @ 13:a76972fe49bc draft default tip

planemo upload for repository https://github.com/brsynth/rrparser commit 15dbdd1f0a222a8e1b0fb5c16b36885520a3d005
author tduigou
date Mon, 07 Apr 2025 07:47:30 +0000
parents 17fbb6aa450b
children
line wrap: on
line source

<tool id="rrparser" name="RRules Parser" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2" license="MIT">
    <description>Retrieve the reaction rules from RetroRules</description>
    <macros>
        <token name="@VERSION_SUFFIX@">4</token>
        <token name="@TOOL_VERSION@">2.7.0</token>
    </macros>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">rrparser</requirement>
    </requirements>
    <stdio>
        <regex match="WARNING:" level="warning" />
        <regex match="ERROR:" level="fatal" />
    </stdio>
    <command detect_errors="exit_code"><![CDATA[
        python -m rrparser
        #if str($rules.type) != "rules-file":
            --rules_file retrorules
            --rule-type '$rules.type'
        #else:
            --rules_file '$rules.file'
            --input-format '$rules.input_format'
        #end if
        --diameters '$adv.diameters'
        --output-format csv
        --rules-dir "\${TMPDIR:-.}"
        #if str($adv.compress) == "true":
            --outfile '$out_rules'.csv.gz
            && mv '$out_rules'.csv.gz '$out_rules'
        #else:
            --outfile '$out_rules'
        #end if
        #if str($adv.input_conditional_ec.input_type) == "in"
            --ec '$adv.input_conditional_ec.input_ec_in'
        #end if
        #if str($adv.input_conditional_ec.input_type) == "out"
            --ecx '$adv.input_conditional_ec.input_ec_out'
        #end if
        #if $adv.input_scores_file
            --scores '$adv.input_scores_file'
        #end if
    ]]></command>
    <inputs>
        <conditional name="rules">
            <param name="type" type="select" label="Rule Type" help="Return the rules that are in reverse, forward, both direction or from an input user file">
                <option value="retro" selected="True">RetroRules (retro)</option>
                <option value="forward">RetroRules (forward)</option>
                <option value="all">RetroRules (all)</option>
                <option value="rules-file">Other reaction rules...</option>
            </param>
            <when value="retro"/>
            <when value="forward"/>
            <when value="all"/>
            <when value="rules-file">
                <param name="file" type="data" format="csv" optional="False" label="Rules File" help="Filename of reaction rules"/>
                <param name="input_format" type="select" optional="False" label="File format" help="Input file format (default: csv)">
                    <option value="csv" selected="True">csv</option>
                    <option value="tsv">tsv</option>
                </param>
            </when>
        </conditional>
        <section name="adv" title="Advanced Options" expanded="false" >
            <param name="compress" type="boolean" checked="false" label="Compress output" />
            <param name="input_scores_file" type="data" format="csv" optional="True" label="Score File" help="Filename containing rules names and scores" />
            <conditional name="input_conditional_ec">
                <param name="input_type" type="select" label="Filter based on EC number">
                    <option value="no" selected="True">No</option>
                    <option value="in">EC numbers to keep</option>
                    <option value="out">EC numbers to remove</option>
                </param>
                <when value="no" />
                <when value="in">
                    <param name="input_ec_in" type="data" format="txt" label="File containing EC numbers" help="EC numbers on one line separted by a comma" />
                </when>
                <when value="out">
                    <param name="input_ec_out" type="data" format="txt" label="File containing EC numbers" help="EC numbers on one line separted by a comma" />
                </when>
            </conditional>
            <param argument="--diameters" type="select" display="checkboxes" multiple="True" label="Select the diameters of the reactions rules" help=" Diameter of the sphere including the atoms around the reacting center (default is including all values: 2,4,6,8,10,12,14,16). The higher is the diameter, the more specific are the rules">
                <option selected="true" value="2">2</option>
                <option selected="true" value="4">4</option>
                <option selected="true" value="6">6</option>
                <option selected="true" value="8">8</option>
                <option selected="true" value="10">10</option>
                <option selected="true" value="12">12</option>
                <option selected="true" value="14">14</option>
                <option selected="true" value="16">16</option>
            </param>
        </section>
        
    </inputs>
    <outputs>
        <data name="out_rules" format="csv" label="${tool.name}(${rules.type}, d=$diameters)" >
            <change_format>
                <when input="compress" format="tar" value="true"/>
            </change_format>
        </data>
    </outputs>
    <tests>
        <test>
        <!-- test 1: check if identical outputs are produced with default parameters-->
            <output name="out_rules" md5="54806bd44f7a8414e78439e3bb99e6d8"/>
        </test>
        <test>
        <!-- test 2: check if identical outputs are produced with diameters=2,4,6-->
            <section name="adv">   
                <param name="diameters" value="2,4,6"/>
            </section>
            <output name="out_rules" md5="12a55e1a3c7822a35ed799afa59b2aa2"/>
        </test>
        <test>
        <!-- test 3: check if identical outputs are produced with csv input rules file-->
            <conditional name="rules">
                <param name="type" value="rules-file"/>
                <param name="file" value="rules_in.csv" />
            </conditional>
            <output name="out_rules" file="rules_out.csv" ftype="csv" compare="diff"/>
        </test>
        <test>
        <!-- test 4 -->
            <conditional name="rules">
                <param name="type" value="rules-file"/>
                <param name="file" value="rules_in.csv" />
            </conditional>
            <section name="adv">
                <conditional name="input_conditional_ec">
                    <param name="input_type" value="in"/>
                    <param name="input_ec_in" value="ec.txt"/>
                </conditional>
            </section>
            <output name="out_rules" file="test.4.output.csv" ftype="csv" compare="diff"/>
        </test>
        <test>
            <!-- python -m rrparser -rules_file rules_in.csv -input-format csv -ecx ec.txt -diameters 2,4,6,8,10,12,14,16 -output-format csv -outfile test.5.output.csv -->
            <conditional name="rules">
                <param name="type" value="rules-file"/>
                <param name="file" value="rules_in.csv" />
            </conditional>
            <section name="adv">
                <conditional name="input_conditional_ec">
                    <param name="input_type" value="out"/>
                    <param name="input_ec_out" value="ec.txt"/>
                </conditional>
            </section>
            <output name="out_rules" file="test.5.output.csv" ftype="csv" compare="diff"/>
        </test>
        <test>
            <!-- python -m rrparser -rules_file rules_in.csv -input-format csv -diameters 2,4,6,8,10,12,14,16 -output-format csv -outfile rules_scores.csv -scores scores.csv -->
            <conditional name="rules">
                <param name="type" value="rules-file"/>
                <param name="file" value="rules_in.csv" />
            </conditional>
            <section name="adv" >
                <param name="input_scores_file" value="scores.csv" />
            </section>
            <output name="out_rules" file="rules_scores.csv" ftype="csv" compare="diff"/>
        </test>
    </tests>
    <help><![CDATA[
RRulesParser
============

Retrieve the reaction rules from `RetroRules <https://retrorules.org/>`_ extracted from public databases and expressed in the community-standard SMARTS (SMILES arbitrary target specification) format, augmented by a rule representation at different levels of specificity (the atomic environment around the reaction center).

The generated output is a file containing reaction rules which are generic descriptions of chemical reactions that can be used in retrosynthesis workflows (e.g. `Retrosynthesis KNIME Workflow <https://www.myexperiment.org/workflows/4987.html>`_) in order to enumerate all possible biosynthetic routes connecting a target molecule to its precursors.

Input
-----

* **Rule Type**: (string) Return the rules that are in reverse, forward, both direction or from an input user file
* **rules-file**: (string) Filename of reaction rules provided in csv or tsv format.
* **input_format**: (string) input file format (csv: default, tsv)
* **diameters**: (integer list) diameter of the sphere including the atoms around the reacting center (default is including all values: 2,4,6,8,10,12,14,16). The higher is the diameter, the more specific are the rules
* **EC numbers to filter**: retain or remove some EC numbers. A file is expected containing EC numbers separated by a comma on the first line.
* **Scores file**: file containing rules names and scores

Ouput
-----

* **out_rules**: (string): file containing the parsed reactions rules (default=csv). It will be zipped if *Compress output* is set to yes.
    ]]></help>
    <creator>
        <organization name="BioRetroSynth" url="https://github.com/brsynth"/>
    </creator>
    <citations>
        <citation type="doi">10.1093/nar/gky940</citation>
    </citations>
</tool>