view macros.xml @ 7:41a4d8c9d6a2 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/DIMet commit 6da96d865a3a557cfa3ad09e1cfa830519e73748
author iuc
date Tue, 06 Aug 2024 17:39:36 +0000
parents a7d1d77e7cc3
children
line wrap: on
line source

<macros>
    <token name="@TOOL_VERSION@">0.2.4</token>
    <token name="@VERSION_SUFFIX@">4</token>
    <xml name="requirements">
        <requirements>
            <requirement type="package" version="@TOOL_VERSION@">dimet</requirement>
        </requirements>
    </xml>
    <xml name="statistical_test_for_multigroup">
        <param name="stat_test" type="select" value="KW"  display="radio" label="Select statistical to apply" help="Please enter at max 1 statistical test by file">
            <option value="KW">Kruskal-Wallis</option>
        </param>
    </xml>
     <xml name="statistical_test_for_bivariate_analysis">
        <param name="stat_test" type="select" value="pearson"  display="radio" label="Select statistical to apply" help="Please enter at max 1 statistical test by file">
            <option value="pearson">pearson</option>
            <option value="spearman">spearman</option>
        </param>
    </xml>
    <xml name="statistical_test">
        <conditional name="statistics">
            <param name="statistical_test_type" type="select" label="Choose which type of statistical test to perform" help="Choose which type of statistical test to perform">
                <option value="parametric">parametric</option>
                <option value="non-parametric-rank" selected="true">non-parametric (rank based)</option>
                <option value="non-parametric-distribution">non-parametric (distribution based)</option>
            </param>
            <when value="parametric">
                <param name="stat_test" type="select" display="radio" label="Select statistical to apply" help="Please enter at max 1 statistical test by file">
                    <option value="Tt" selected="true">t-test</option>
                </param>
            </when>
            <when value="non-parametric-rank">
                <param name="stat_test" type="select" display="radio" label="Select statistical to apply" help="Please enter at max 1 statistical test by file">
                    <option value="MW">Mann Whitney</option>
                    <option value="KW">Kruskal-Wallis</option>
                    <option value="ranksum" selected="true">Wilcoxon's rank sum test</option>
                    <option value="Wcox">Wilcoxon signed-rank test</option>
                    <option value="BrMu">Brunner-Munzel test</option>
                </param>
            </when>
            <when value="non-parametric-distribution">
                <param name="stat_test" type="select" display="radio" label="Select statistical to apply" help="Please enter at max 1 statistical test by file">
                    <option value="prm-scipy" selected="true">permutations test</option>
                    <option value="disfit">distribution fitting (of the z-score of the ratios), disfit needs several hundreds of metabolites to be trustful.</option>
                </param>
            </when>
        </conditional>

    </xml>
    <xml name="citations">
        <citations>
            <citation type="doi">10.1093/bioinformatics/btae282</citation>
            <citation type="bibtex">
                @software{Galvis_Rodriguez_DIMet,
                    author = {Galvis Rodriguez, Johanna  and Guyon, Joris and Dartigues, Benjamin and Specque, Florian and Daubon, Thomas and Karkar, Slim and Nikolski, Macha},
                    license = {MIT},
                    title = {{DIMet}},
                    url = {https://github.com/cbib/DIMet}
                    }
            </citation>
        </citations>

    </xml>
    <xml name="metadata_file_macros">
        <param name="metadata_path" type="data" format="tabular" label="metadata file" help="The metadata, a unique file with the description of the samples in your measures' files. This is compulsory, see section Metadata File Information."/>
    </xml>
    <xml name="abundance_file_macros">
        <param name="abundance_file" type="data" format="tabular" label="Metabolite abundance file" help="The total abundances file must be organized as a matrix: - The first column must contain Metabolite IDs that are unique (not repeated) within the file. - The rest of the columns correspond to the samples - The rows correspond to the metabolites - The values must be tab separated, with the first row containing the sample/column labels. (see help below for more details)"/>
    </xml>
    <xml name="enrichment_file_macros">
        <param name="me_or_frac_contrib_file" type="data" format="tabular" label="Metabolite enrichment file" help="The mean enrichment file must be organized as a matrix: - The first column must contain Metabolite IDs that are unique (not repeated) within the file. - The rest of the columns correspond to the samples. - The rows correspond to the metabolites. - The values must be tab separated, with the first row containing the sample/column labels. (see help below for more details)"/>
    </xml>
    <xml name="isotopologue_prop_file_macros">
        <param name="isotop_prop_file" type="data" format="tabular" label="Isotopologues proportion abundance file" help="    The isotopologue proportions file must be organized as a matrix: - The first column must contain isotopologues IDs that are unique (not repeated) within the file. - The rest of the columns correspond to the samples. - The rows correspond to the isotopologues. - The values must be tab separated, with the first row containing the sample/column labels  (see help below for more details)."/>
    </xml>
    <xml name="isotopologue_abs_file_macros">
        <param name="isotop_abs_file" type="data" format="tabular" label="Isotopologues absolute abundance file" help="The isotopologue absolute values file must be organized as a matrix: - The first column must contain isotopologues IDs that are unique (not repeated) within the file. - The rest of the columns correspond to the samples. - The rows correspond to the isotopologues. - The values must be tab separated, with the first row containing the sample/column labels  (see help below for more details)."/>
    </xml>
    <xml name="input_parameters_pca">
        <expand macro="abundance_file_macros"/>
        <param name="me_or_frac_contrib_file" type="data" optional="true" format="tabular" label="Mean enrichment or fraction contribution file"/>
        <expand macro="metadata_file_macros"/>
    </xml>
    <xml name="input_parameters_abundance">
        <expand macro="abundance_file_macros"/>
        <expand macro="metadata_file_macros"/>
    </xml>
    <xml name="input_parameters_enrichment">
        <expand macro="enrichment_file_macros"/>
        <expand macro="metadata_file_macros"/>
    </xml>
    <xml name="input_parameters_isotopologue">
        <expand macro="isotopologue_prop_file_macros"/>
        <expand macro="metadata_file_macros"/>
    </xml>
    <xml name="input_parameters_metabologram">
        <conditional name="data_input">
            <param name="data_input_selector" type="select" label="Abundance or Enrichment quantification files" help="Select between metabolite total abundances and mean enrichment files">
                <option value="abundance" selected="True">abundance</option>
                <option value="mean_enrichment">mean_enrichment</option>
            </param>
            <when value="abundance">
                <expand macro="abundance_file_macros"/>
                <expand macro="statistical_test"/>

            </when>
            <when value="mean_enrichment">
                <expand macro="enrichment_file_macros"/>
                <expand macro="statistical_test"/>
            </when>
        </conditional>
        <expand macro="metadata_file_macros"/>
        <param name="path_kegg_metabolites" type="data" format="tabular" label="Pathways kegg metabolites file" help="A file with the pathways and respective metabolites ID, that must match with those in your metabolomics data. The names of the columns must be the pathways' names, see the minimal data example downloaded from zenodo as explained above. (see help below for more details)"/>
        <param name="path_kegg_transcripts" type="data" format="tabular" label="Pathways kegg transcripts file" help="A file with the pathways and respective gene symbols, which must match with those present in the transcriptomics data. The names of the columns must be the pathways' names, see the minimal data example downloaded from zenodo as explained above. (see help below for more details)"/>
    </xml>
    <xml name="input_parameters_bivar_analysis">
        <conditional name="data_input">
            <param name="data_input_selector" type="select" label="Abundance, Enrichment or Isotopologues quantification files" help="Select between raw abundance, mean enrichment or isotopologue files">
                <option value="abundance" selected="True">abundance</option>
                <option value="mean_enrichment">mean_enrichment</option>
                <option value="isotop_prop">isotop_prop</option>
                <option value="isotop_abs">isotop_abs</option>
            </param>
            <when value="abundance">
                <expand macro="abundance_file_macros"/>

            </when>
            <when value="mean_enrichment">
                <expand macro="enrichment_file_macros"/>
            </when>
            <when value="isotop_prop">
                <expand macro="isotopologue_prop_file_macros"/>
            </when>
            <when value="isotop_abs">
                <expand macro="isotopologue_abs_file_macros"/>
            </when>
        </conditional>
        <expand macro="metadata_file_macros"/>
        <expand macro="statistical_test_for_bivariate_analysis"/>
    </xml>
    <xml name="input_parameters_diff_analysis">
        <conditional name="data_input">
            <param name="data_input_selector" type="select" label="Abundance, Enrichment or Isotopologues quantification files" help="Select between raw abundance, mean enrichment or isotopologue files">
                <option value="abundance" selected="True">abundance</option>
                <option value="mean_enrichment">mean_enrichment</option>
                <option value="isotop_prop">isotop_prop</option>
                <option value="isotop_abs">isotop_abs</option>
            </param>
            <when value="abundance">
                <expand macro="abundance_file_macros"/>
                <expand macro="statistical_test"/>

            </when>
            <when value="mean_enrichment">
                <expand macro="enrichment_file_macros"/>
                <expand macro="statistical_test"/>
            </when>
            <when value="isotop_prop">
                <expand macro="isotopologue_prop_file_macros"/>
                <expand macro="statistical_test"/>
            </when>
            <when value="isotop_abs">
                <expand macro="isotopologue_abs_file_macros"/>
                <expand macro="statistical_test"/>
            </when>
        </conditional>
        <expand macro="metadata_file_macros"/>
    </xml>
    <xml name="input_parameters_multi_diff_analysis">
        <conditional name="data_input">
            <param name="data_input_selector" type="select" label="Abundance, Enrichment or Isotopologues quantification files" help="Select between raw abundance, mean enrichment or isotopologue files">
                <option value="abundance" selected="True">abundance</option>
                <option value="mean_enrichment">mean_enrichment</option>
                <option value="isotop_prop">isotop_prop</option>
                <option value="isotop_abs">isotop_abs</option>
            </param>
            <when value="abundance">
                <expand macro="abundance_file_macros"/>
                <expand macro="statistical_test_for_multigroup"/>

            </when>
            <when value="mean_enrichment">
                <expand macro="enrichment_file_macros"/>
                <expand macro="statistical_test_for_multigroup"/>
            </when>
            <when value="isotop_prop">
                <expand macro="isotopologue_prop_file_macros"/>
                <expand macro="statistical_test_for_multigroup"/>
            </when>
            <when value="isotop_abs">
                <expand macro="isotopologue_abs_file_macros"/>
                <expand macro="statistical_test_for_multigroup"/>
            </when>
        </conditional>
        <expand macro="metadata_file_macros"/>
    </xml>
    <xml name="suffix">
        <param name="suffix" type="text" optional="false" label="suffix to add to output files" >
            <sanitizer invalid_char="">
                <valid initial="string.ascii_letters,string.digits">
                    <add value="_" />
                </valid>
            </sanitizer>
        </param>      
    </xml>
    <xml name="conditions">
        <param name="conditions" type="select" optional="false" multiple="true" label="Browse conditions from metadata file (1 min. only if two timepoints are set. 2 max.). You have to load a metadata file prior to have access to condition list">
            <options from_dataset="metadata_path">
                <column name="condition" index="1"/>
                <column name="value" index="1"/>
                <filter type="unique_value" name="condition" column="condition"/>
                <filter type="remove_value" value="condition"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="conditions_multigroup">
        <param name="conditions" type="select" optional="false" multiple="true" label="Browse conditions from metadata file. (1 min. only if three timepoints are set). You have to load a metadata file prior to have access to conditions">
            <options from_dataset="metadata_path">
                <column name="condition" index="1"/>
                <column name="value" index="1"/>
                <filter type="unique_value" name="condition" column="condition"/>
                <filter type="remove_value" value="condition"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="timepoint_multigroup">
        <param name="timepoint" type="select" optional="true" multiple="true" label="Browse timepoint from metadata file (1 min. only if three conditions are set). You have to load a metadata file prior to have access to conditions">
            <options from_dataset="metadata_path">
                <column name="timepoint" index="2"/>
                <column name="value" index="2"/>
                <filter type="unique_value" name="timepoint" column="2"/>
                <filter type="remove_value" value="timepoint"/>
                <filter type="sort_by" name="timepoint" column="1"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="timepoint">
        <param name="timepoint" type="select" optional="false" multiple="true" label="Browse timepoint from metadata file (1 min.)">
            <options from_dataset="metadata_path">
                <column name="timepoint" index="2"/>
                <column name="value" index="2"/>
                <filter type="unique_value" name="timepoint" column="2"/>
                <filter type="remove_value" value="timepoint"/>
                <filter type="sort_by" name="timepoint" column="1"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="grouping">
        <param name="grouping" type="select"  optional="false" multiple="true" label="Browse group to compare">
            <option value="condition" selected="true">condition</option>
            <option value="timepoint" selected="true">timepoint</option>
        </param>
    </xml>
    <xml name="correction_method">
        <param name="correction_method" type="select" value="bonferroni" display="radio" label="Select multiple test correction to apply" help="Please enter at max 1 method">
                    <option value="bonferroni">bonferroni</option>
                    <option value="holm-sidak">holm-sidak</option>
                    <option value="holm">holm</option>
                    <option value="simes-hochberg">simes-hochberg</option>
                    <option value="hommel">hommel</option>
                    <option value="fdr_bh">fdr_bh</option>
                    <option value="fdr_by">fdr_by</option>
                    <option value="fdr_tsbh">fdr_tsbh</option>
                    <option value="fdr_tsbky">fdr_tsbky</option>
        </param>
    </xml>
    <xml name="compartments_enrichment">
        <param name="compartments" type="select" optional="false" multiple="true"
               label="Browse compartments from metadata file (All needed). You have to load a metadata file prior to have access to compartments">
            <options from_dataset="metadata_path">
                <column name="compartment" index="4"/>
                <column name="value" index="4"/>
                <filter type="unique_value" name="compartment" column="4"/>
                <filter type="remove_value" value="compartment"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="compartments_abundance">
        <param name="compartments" type="select" optional="false" multiple="true"
               label="Browse compartments from metadata file (All needed). You have to load a metadata file prior to have access to compartments">
            <options from_dataset="metadata_path">
                <column name="compartment" index="4"/>
                <column name="value" index="4"/>
                <filter type="unique_value" name="compartment" column="4"/>
                <filter type="remove_value" value="compartment"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="compartments_metabologram">
        <param name="compartments" type="select" optional="false" multiple="false"
               label="Browse compartments from metadata file (1 max.). You have to load a metadata file prior to have access to compartments">
            <options from_dataset="metadata_path">
                <column name="compartment" index="4"/>
                <column name="value" index="4"/>
                <filter type="unique_value" name="compartment" column="4"/>
                <filter type="remove_value" value="compartment"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="compartments">
        <param name="compartments" type="select" optional="false" multiple="true"
               label="Browse compartments from metadata file (1 min.). You have to load a metadata file prior to have access to compartments">
            <options from_dataset="metadata_path">
                <column name="compartment" index="4"/>
                <column name="value" index="4"/>
                <filter type="unique_value" name="compartment" column="4"/>
                <filter type="remove_value" value="compartment"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="abundance_metabolites_list">
        <param name="metabolites_list" type="select" optional="false" multiple="true"
               label="Select Metabolite(s) for condition 1 to plot (1 min). You have to load a abundance file prior to have access to metabolite list">
            <validator type="length" min="1" message="Please enter at max 2 compartments"/>
            <options from_dataset="abundance_file">
                <column name="metabolite_or_isotopologue" index="0"/>
                <column name="value" index="0"/>
                <filter type="unique_value" name="metabolite_or_isotopologue" column="0"/>
                <filter type="remove_value" value="metabolite_or_isotopologue"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="enrichment_metabolites_list">
        <param name="metabolites_list" type="select" optional="false" multiple="true"
               label="Select Metabolite(s) for condition 1 to plot (1 Min.). You have to load a abundance file prior to have access to metabolite list">
            <validator type="length" min="1" message="Please enter at min 1 metabolite"/>
            <options from_dataset="me_or_frac_contrib_file">
                <column name="ID" index="0"/>
                <column name="value" index="0"/>
                <filter type="unique_value" name="ID" column="0"/>
                <filter type="remove_value" value="ID"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="isotopologue_metabolites_list">
        <param name="metabolites_list" type="select" optional="false" multiple="true"
               label="Select Metabolite(s) to plot (1 Min.). You have to load a abundance file prior to have access to metabolite list">
            <validator type="length" min="1" message="Please enter at min 1 metabolite"/>
            <options from_dataset="isotop_prop_file">
                <column name="ID" index="0"/>
                <column name="value" index="0"/>
                <filter type="unique_value" name="ID" column="0"/>
                <filter type="remove_value" value="ID"/>
            </options>
            <sanitizer>
                <valid initial="default">
                    <add preset="string.printable"/>
                    <add value="\t"/>
                    <remove value="&quot;"/>
                    <remove value="&apos;"/>
                </valid>
            </sanitizer>
        </param>
    </xml>
    <xml name="deg_list">
        <repeat name="deg_list" title="Deregulated gene set" default="1" min="1">
            <param name="input" type="data" format="tabular" label="Deregulated genes set"/>
            <param name="idcol" type="data_column" data_ref="input" label="Column for id" use_header_names="true"/>
            <param name="valuecol" type="data_column" data_ref="input" label="Column for values" use_header_names="true"/>
            <param name="timepoint" type="select" optional="false" multiple="false" label="Browse timepoint from metadata file (1 min.)">
                <options from_dataset="metadata_path">
                    <column name="timepoint" index="2"/>
                    <column name="value" index="2"/>
                    <filter type="unique_value" name="timepoint" column="2"/>
                    <filter type="remove_value" value="timepoint"/>
                    <filter type="sort_by" name="timepoint" column="1"/>
                </options>
                <sanitizer>
                    <valid initial="default">
                        <add preset="string.printable"/>
                        <add value="\t"/>
                        <remove value="&quot;"/>
                        <remove value="&apos;"/>
                    </valid>
                </sanitizer>
            </param>
            <repeat name="factor_list" title="Conditions" default="2" min="2" max="2" help="Specify conditions to compare from metadata file (for each comparison, the last specified condition is the reference). You have to load a metadata file prior to have access to condition list">
                <param name="condition" label="Condition" type="select" optional="false" multiple="false">
                    <options from_dataset="metadata_path">
                        <column name="condition" index="1"/>
                        <column name="value" index="1"/>
                        <filter type="unique_value" name="condition" column="condition"/>
                        <filter type="remove_value" value="condition"/>
                    </options>
                    <sanitizer>
                        <valid initial="default">
                            <add preset="string.printable"/>
                            <add value="\t"/>
                            <remove value="&quot;"/>
                            <remove value="&apos;"/>
                        </valid>
                    </sanitizer>
                </param>
            </repeat>

        </repeat>
    </xml>
    <xml name="plot_abundance_factor_list">
        <repeat name="plot_abundance_factor_list" title="Conditions" min="1" help="Specify conditions to compare from metadata file (1 min. only if two timepoints are set. 2 max.). You have to load a metadata file prior to have access to condition list">
            <param name="condition" label="Condition" type="select" optional="false" multiple="false">
                <options from_dataset="metadata_path">
                    <column name="condition" index="1"/>
                    <column name="value" index="1"/>
                    <filter type="unique_value" name="condition" column="condition"/>
                    <filter type="remove_value" value="condition"/>
                </options>
                <sanitizer>
                    <valid initial="default">
                        <add preset="string.printable"/>
                        <add value="\t"/>
                        <remove value="&quot;"/>
                        <remove value="&apos;"/>
                    </valid>
                </sanitizer>
            </param>
        </repeat>
    </xml>
    <xml name="plot_factor_list">
        <repeat name="plot_factor_list" title="Conditions" min="2" help="Specify conditions to compare from metadata file (1 min. only if two timepoints are set. 2 max.). You have to load a metadata file prior to have access to condition list">
            <param name="condition" label="Condition" type="select" optional="false" multiple="false">
                <options from_dataset="metadata_path">
                    <column name="condition" index="1"/>
                    <column name="value" index="1"/>
                    <filter type="unique_value" name="condition" column="condition"/>
                    <filter type="remove_value" value="condition"/>
                </options>
                <sanitizer>
                    <valid initial="default">
                        <add preset="string.printable"/>
                        <add value="\t"/>
                        <remove value="&quot;"/>
                        <remove value="&apos;"/>
                    </valid>
                </sanitizer>
            </param>
        </repeat>
    </xml>
    <xml name="factor_list">
        <repeat name="factor_list" title="Conditions" min="2" max="2" help="Specify conditions to be taken into account from metadata file (for each comparison, the last specified condition is the reference). You have to load a metadata file prior to have access to condition list">
            <param name="condition" label="Condition" type="select" optional="false" multiple="false">
                <options from_dataset="metadata_path">
                    <column name="condition" index="1"/>
                    <column name="value" index="1"/>
                    <filter type="unique_value" name="condition" column="condition"/>
                    <filter type="remove_value" value="condition"/>
                </options>
                <sanitizer>
                    <valid initial="default">
                        <add preset="string.printable"/>
                        <add value="\t"/>
                        <remove value="&quot;"/>
                        <remove value="&apos;"/>
                    </valid>
                </sanitizer>
            </param>
        </repeat>
    </xml>
    <xml name="palette">
        <param name="palette" type="select" value="pastel" display="radio" label="Select palette colormap to apply to abundance plot." help="For more information see https://seaborn.pydata.org/tutorial/color_palettes.html">
            <option value="pastel" selected="true">pastel</option>
            <option value="deep">deep</option>
            <option value="muted">muted</option>
            <option value="bright">bright</option>
            <option value="dark">dark</option>
            <option value="colorblind">colorblind</option>
        </param>
    </xml>
    <token name="@INIT_PCA@"><![CDATA[
    #import json
    #import re

    mkdir -p data &&

    #if $metadata_path:
        ln -s '$metadata_path' data/metadata.csv &&
    #end if
    #if $abundance_file:
        ln -s '$abundance_file' data/abundance.csv &&
    #end if
    #if $me_or_frac_contrib_file:
        ln -s '$me_or_frac_contrib_file' data/me_or_frac_contrib.csv &&
    #end if

    ]]></token>
    <token name="@INIT_CONFIG@"><![CDATA[
    mkdir -p 'config' &&
    touch 'config/config.yaml' &&
    ]]></token>
    <token name="@REMOVE_CONFIG@"><![CDATA[
    && rm -r 'config'
    ]]></token>
    <token name="@INIT_ABUNDANCE_PLOT@"><![CDATA[

    mkdir -p data &&
    #if $metadata_path:
        ln -s '$metadata_path' data/metadata.csv &&
    #end if
    #if $abundance_file:
        ln -s '$abundance_file' data/abundance.csv &&
    #end if
    #set $axisx = "condition"
    #if str( $output_options.bar_color ) == "condition":
        #set $axisx = "timepoint"
    #end if

    ]]></token>
    <token name="@INIT_ENRICHMENT_PLOT@"><![CDATA[

    mkdir -p data &&

    #if $metadata_path:
        ln -s '$metadata_path' data/metadata.csv &&
    #end if
    #if $me_or_frac_contrib_file:
        ln -s '$me_or_frac_contrib_file' data/me_or_frac_contrib.csv &&
    #end if
    ]]></token>
    <token name="@INIT_ISOTOPOLOGUE_PLOT@"><![CDATA[

    mkdir -p data &&

    #if $metadata_path:
        ln -s '$metadata_path' data/metadata.csv &&
    #end if
    #if $isotop_prop_file:
        ln -s '$isotop_prop_file' data/isotop_prop.csv &&
    #end if
    ]]></token>
    <token name="@INIT_BI_ANALYSIS@"><![CDATA[

    mkdir -p data &&

    #if $metadata_path:
        ln -s '$metadata_path' data/metadata.csv &&
    #end if


    #set conditions_MDV_comparison  = {}
    #set timepoints_MDV_comparison  = {}
    #set conditions_metabolite_time_profiles  = {}

    #if str( $stat_test ) == "pearson":
        #silent $conditions_MDV_comparison['isotopologue_proportions']='pearson'
        #silent $timepoints_MDV_comparison['isotopologue_proportions']='pearson'
        #silent $conditions_metabolite_time_profiles['abundances']='pearson'
        #silent $conditions_metabolite_time_profiles['mean_enrichment']='pearson'
    #else
        #silent $conditions_MDV_comparison['isotopologue_proportions']='spearman'
        #silent $timepoints_MDV_comparison['isotopologue_proportions']='spearman'
        #silent $conditions_metabolite_time_profiles['abundances']='spearman'
        #silent $conditions_metabolite_time_profiles['mean_enrichment']='spearman'
    #end if
    #set $impute_values  = {}
    #if str( $data_input.data_input_selector ) == "abundance":
        #if $data_input.abundance_file:
            ln -s '$data_input.abundance_file' data/abundance.csv &&
            #silent $impute_values['abundances']='min'
        #end if
    #elif str( $data_input.data_input_selector ) == "mean_enrichment":
        #if $data_input.me_or_frac_contrib_file:
            ln -s '$data_input.me_or_frac_contrib_file' data/me_or_frac_contrib.csv &&
            #silent $impute_values['mean_enrichment']='min'
        #end if
    #elif str( $data_input.data_input_selector ) == "isotop_prop":
        #if $data_input.isotop_prop_file:
            ln -s '$data_input.isotop_prop_file' data/isotop_prop.csv &&
            #silent $impute_values['isotopologue_proportions']='min'
        #end if
    #else
        #if $data_input.isotop_abs_file:
            ln -s '$data_input.isotop_abs_file' data/isotop_abs.csv &&
            #silent $impute_values['isotopologues']='min'
        #end if
    #end if
    ]]></token>
    <token name="@INIT_DIFF_ANALYSIS@"><![CDATA[

    mkdir -p data &&

    #if $metadata_path:
        ln -s '$metadata_path' data/metadata.csv &&
    #end if

    #set $impute_values  = {}
    #if str( $data_input.data_input_selector ) == "abundance":
        #if $data_input.abundance_file:
            ln -s '$data_input.abundance_file' data/abundance.csv &&
            #silent $impute_values['abundances']='min'
        #end if
    #elif str( $data_input.data_input_selector ) == "mean_enrichment":
        #if $data_input.me_or_frac_contrib_file:
            ln -s '$data_input.me_or_frac_contrib_file' data/me_or_frac_contrib.csv &&
            #silent $impute_values['mean_enrichment']='min'
        #end if
    #elif str( $data_input.data_input_selector ) == "isotop_prop":
        #if $data_input.isotop_prop_file:
            ln -s '$data_input.isotop_prop_file' data/isotop_prop.csv &&
            #silent $impute_values['isotopologue_proportions']='min'
        #end if
    #else
        #if $data_input.isotop_abs_file:
            ln -s '$data_input.isotop_abs_file' data/isotop_abs.csv &&
            #silent $impute_values['isotopologues']='min'
        #end if
    #end if
    ]]></token>
    <token name="@INIT_METABOLOGRAM@"><![CDATA[
    #import json
    #import re
    #import os
    #import csv
    #import subprocess

    mkdir -p data &&

    #if $path_kegg_metabolites:
        ln -s '$path_kegg_metabolites' data/pathways_kegg_metabolites.csv &&
    #end if
    #if $path_kegg_transcripts:
        ln -s '$path_kegg_transcripts' data/pathways_kegg_transcripts.csv &&
    #end if

    #if $metadata_path:
        ln -s '$metadata_path' data/metadata.csv &&
    #end if

    #set $impute_values  = {}
    #if str( $data_input.data_input_selector ) == "abundance":
        #if $data_input.abundance_file:
            ln -s '$data_input.abundance_file' data/abundance.csv &&
            #silent $impute_values['abundances']='min'
        #end if
    #else:
        #if $data_input.me_or_frac_contrib_file:
            ln -s '$data_input.me_or_frac_contrib_file' data/me_or_frac_contrib.csv &&
            #silent $impute_values['mean_enrichment']='min'
        #end if
    #end if

    #for $i, $s in enumerate($deg_list)
        #set $cpt = str($i+1)
        ln -s '${s.input}' data/DEG_comparison'${cpt}'.csv &&
    #end for


    ]]></token>
    <token name="@INIT_DIFF_MULTIGROUP_ANALYSIS@"><![CDATA[

    mkdir -p data &&

    #if $metadata_path:
        ln -s '$metadata_path' data/metadata.csv &&
    #end if

    #set $impute_values  = {}
    #if str( $data_input.data_input_selector ) == "abundance":
        #if $data_input.abundance_file:
            ln -s '$data_input.abundance_file' data/abundance.csv &&
            #silent $impute_values['abundances']='min'
        #end if
    #elif str( $data_input.data_input_selector ) == "mean_enrichment":
        #if $data_input.me_or_frac_contrib_file:
            ln -s '$data_input.me_or_frac_contrib_file' data/me_or_frac_contrib.csv &&
            #silent $impute_values['mean_enrichment']='min'
        #end if
    #elif str( $data_input.data_input_selector ) == "isotop_prop":
        #if $data_input.isotop_prop_file:
            ln -s '$data_input.isotop_prop_file' data/isotop_prop.csv &&
            #silent $impute_values['isotopologue_proportions']='min'
        #end if
    #else
        #if $data_input.isotop_abs_file:
            ln -s '$data_input.isotop_abs_file' data/isotop_abs.csv &&
            #silent $impute_values['isotopologues']='min'
        #end if
    #end if
    ]]></token>
    <token name="@INIT_IMPUTE_VALUES@"><![CDATA[
    #import re
    #set $impute_values  = {}
    #if $abundance_file:
        #silent $impute_values['abundances']='min'
    #end if
    #if $me_or_frac_contrib_file:
        #silent $impute_values['mean_enrichment']='min'
    #end if
    ]]></token>
    <token name="@INIT_DATATYPES@"><![CDATA[
    #import re
    #set $datatypes_avail = list()
    #if str( $data_input.data_input_selector ) == "abundance":
        #if $data_input.abundance_file:
            $datatypes_avail.append(re.sub('"', '', "abundances"))
        #end if
    #elif str( $data_input.data_input_selector ) == "mean_enrichment":
        #if $data_input.me_or_frac_contrib_file:
            $datatypes_avail.append(re.sub('"', '', "mean_enrichment"))
        #end if
    #elif str( $data_input.data_input_selector ) == "isotop_prop":
        #if $data_input.isotop_prop_file:
            $datatypes_avail.append(re.sub('"', '', "isotopologue_proportions"))
        #end if
    #else
        #if $data_input.isotop_abs_file:
            $datatypes_avail.append(re.sub('"', '', "isotopologues"))
        #end if
    #end if
    ]]></token>
    <token name="@INIT_STAT_TEST@"><![CDATA[
    #import re
    #set $statistical_test  = {}
    #if str( $data_input.data_input_selector ) == "abundance":
        #if $data_input.abundance_file:
            #silent $statistical_test['abundances']=str($data_input.stat_test)
        #end if
    #elif str( $data_input.data_input_selector ) == "mean_enrichment":
        #if $data_input.me_or_frac_contrib_file:
            #silent $statistical_test['mean_enrichment']=str($data_input.stat_test)
        #end if
    #elif str( $data_input.data_input_selector ) == "isotop_prop":
        #if $data_input.isotop_prop_file:
            #silent $statistical_test['isotopologue_proportions']=str($data_input.stat_test)
        #end if
    #else
        #if $data_input.isotop_abs_file:
            #silent $statistical_test['isotopologues']=str($data_input.stat_test)
        #end if
    #end if
    ]]></token>
    <token name="@INIT_CONDITIONS@"><![CDATA[
    #import re
    #set $conds = list()
    #for $co in $conditions:
        $conds.append(re.sub('"', '', str($co)))
    #end for
    ]]></token>
    <token name="@INIT_PLOT_CONDITIONS@"><![CDATA[
    #set $conditions = list()
    #for $i, $s in enumerate($plot_factor_list)
        #set $cpt = str($i+1)
        $conditions.append(re.sub('"', '', str($s.condition)))
    #end for
    ]]></token>
    <token name="@INIT_ABUNDANCE_PLOT_CONDITIONS@"><![CDATA[
    #set $conditions = list()
    #for $i, $s in enumerate($plot_abundance_factor_list)
        #set $cpt = str($i+1)
        $conditions.append(re.sub('"', '', str($s.condition)))
    #end for
    ]]></token>
    <token name="@INIT_TIMEPOINTS@"><![CDATA[

    #import re
    #set $timepoints = list()
    #for $tp in $timepoint:
        $timepoints.append(re.sub('"', '', str($tp)))
    #end for
    ]]></token>
    <token name="@INIT_GROUPS@"><![CDATA[
    #import re
    #set $groups = list()
    $groups.append(re.sub('"', '', str("condition")))
    $groups.append(re.sub('"', '', str("timepoint")))

    ]]></token>
    <token name="@INIT_ENRICHMENT_METABOLITES@"><![CDATA[
    #import json
    #import re
    #set $metabolites = {}
    #for $cp in $compartments:
        #silent $metabolites[re.sub('"', '', str($cp))]=list()
        #for $met in $metabolites_list:
            #set tmp_met=re.sub('\,', '%%',str($met))
            #set tmp_met_bis=str(re.split('_m', str($tmp_met))[0])
            #set tmp_met_ter=re.sub('%%', '\,',str($tmp_met_bis))
            $metabolites[re.sub('"', '', str($cp))].append(re.sub('"', '\'', str(tmp_met_ter)))
        #end for
    #end for
    ]]></token>
    <token name="@INIT_ISOTOPOLOGUE_METABOLITES@"><![CDATA[
    #set $metabolites = {}
    #for $cp in $compartments:
        #silent $metabolites[re.sub('"', '', str($cp))]=list()
        #for $met in $metabolites_list:
            #set tmp_met=re.sub('\,', '--',str($met))
            #set tmp_met_bis=str(re.split('_m', str($tmp_met))[0])
            #set tmp_met_ter=re.sub('--', '\,',str($tmp_met_bis))
            $metabolites[re.sub('"', '', str($cp))].append(re.sub('"', '\'', str(tmp_met_ter)))
        #end for
    #end for
    ]]></token>
    <token name="@INIT_MULTIGROUP_COMPARISONS@"><![CDATA[
    #set $comparisons = list()
    #for $tp in $timepoint:
        #set $ctrl_found=False
        #set $ctrl=""

        #for $co in $conditions:
            #set $sub_comparisons = list()
            #if str($co) in ["Control", "control","ctrl"]:
                 #set $ctrl_found=True
                 #set $ctrl=str($co)
                 $sub_comparisons.append(re.sub('"', '', str($co)))
                 $sub_comparisons.append(re.sub('"', '', str($tp)))
            #else:
                $sub_comparisons.append(re.sub('"', '', str($co)))
                $sub_comparisons.append(re.sub('"', '', str($tp)))

            #end if
            $comparisons.append($sub_comparisons)
        #end for
    #end for
    ]]></token>
    <token name="@INIT_CONDITIONS_TIMECOURSE@"><![CDATA[
    #import re
    #set $conditions = list()
    #for $i, $s in enumerate($factor_list)
        #set $cpt = str($i+1)
        $conditions.append(re.sub('"', '', str($s.condition)))
    #end for

    ]]></token>
    <token name="@INIT_BIVAR_COMPARISONS@"><![CDATA[
    #import re
    #set $conditions = list()
    #for $i, $s in enumerate($plot_factor_list)
        #set $cpt = str($i+1)
        $conditions.append(re.sub('"', '', str($s.condition)))
    #end for
    ]]></token>
    <token name="@INIT_COMPARISONS_METABOLOGRAM@"><![CDATA[
    #import re
    #set $conditions = list()
    #set $timepoints = list()
    #set $comparisons = list()
    #for $i, $s in enumerate($deg_list)
        #set $cpt = str($i+1)
        #set $comparisons_bis = list()
        #for $j, $t in enumerate($s.factor_list)
            #set $sub_comparisons = list()
            #if str($t.condition) not in $conditions:
                $conditions.append(re.sub('"', '', str($t.condition)))
            #end if
            $sub_comparisons.append(re.sub('"', '', str($t.condition)))
            $sub_comparisons.append(re.sub('"', '', str($s.timepoint)))
            $comparisons_bis.append($sub_comparisons)
        #end for
        $timepoints.append(re.sub('"', '', str($s.timepoint)))
        $comparisons.append($comparisons_bis)
    #end for



    ]]></token>
    <token name="@INIT_COMPARISONS@"><![CDATA[
    #import re
    #set $conds = list()
    #for $co in $conditions:
        $conds.append(re.sub('"', '', str($co)))
    #end for
    #set $timepoints = list()
    #for $tp in $timepoint:
        $timepoints.append(re.sub('"', '', str($tp)))
    #end for

    #set $comparisons = list()
    #if len($conds) > 1:
        #if len($timepoints) > 0:
            #for $tp in $timepoint:
                #set $ctrl_found=False
                #set $ctrl=""
                #set $comparisons_bis = list()
                #for $co in $conditions:
                    #set $sub_comparisons = list()
                    #if str($co) in ["'Control'", "'control'", "'ctrl'"]:
                        #set $ctrl_found=True
                        #set $ctrl=str($co)
                    #else:
                        $sub_comparisons.append(re.sub('"', '', str($co)))
                        $sub_comparisons.append(re.sub('"', '', str($tp)))

                    #end if
                    $comparisons_bis.append($sub_comparisons)
                #end for

                #if $ctrl_found:
                    $sub_comparisons.append(str($ctrl))
                    $sub_comparisons.append(str($tp))
                    $comparisons_bis.append($sub_comparisons)
                #end if

                $comparisons.append($comparisons_bis)
            #end for
         #else
            #for $co in $conditions:
                $comparisons.append(re.sub('"', '', str($co)))
            #end for
        #end if

    #else
        #if len($conds) > 0:
            #if len($timepoints) > 1:
                #for $co in $conditions:
                    #set $comparisons_bis = list()
                    #for $tp in $timepoint:
                        #set $sub_comparisons = list()
                        $sub_comparisons.append(re.sub('"', '', str($co)))
                        $sub_comparisons.append(re.sub('"', '', str($tp)))
                        $comparisons_bis.append($sub_comparisons)
                    #end for
                    $comparisons.append($comparisons_bis)
                #end for
            #end if
        #else
            #for $tp in $timepoint:
                $comparisons.append(re.sub('"', '', str($tp)))
            #end for
        #end if
    #end if
    ]]></token>
    <token name="@INIT_DIFF_ANALYSIS_COMPARISONS@"><![CDATA[
    #import re
    #set $conditions = list()
    #for $i, $s in enumerate($factor_list)
        #set $cpt = str($i+1)
        $conditions.append(re.sub('"', '', str($s.condition)))
    #end for

    #set $timepoints = list()
    #for $tp in $timepoint:
        $timepoints.append(re.sub('"', '', str($tp)))
    #end for

    #set $comparisons = list()
    #if len($conditions) > 1:
        #if len($timepoints) > 0:
            #for $tp in $timepoint:
                #set $ctrl_found=False
                #set $ctrl=""
                #set $comparisons_bis = list()

                #for $co in $conditions:
                    #set $sub_comparisons = list()
                    #if str($co) in ["'Control'", "'control'", "'ctrl'"]:
                        #set $ctrl_found=True
                        #set $ctrl=str($co)
                    #else:
                        $sub_comparisons.append(re.sub('"', '', str($co)))
                        $sub_comparisons.append(re.sub('"', '', str($tp)))

                    #end if
                    $comparisons_bis.append($sub_comparisons)
                #end for

                #if $ctrl_found:
                    $sub_comparisons.append(str($ctrl))
                    $sub_comparisons.append(str($tp))
                    $comparisons_bis.append($sub_comparisons)
                #end if

                $comparisons.append($comparisons_bis)
            #end for
         #else
            #for $co in $conditions:
                $comparisons.append(re.sub('"', '', str($co)))
            #end for
        #end if

    #else
        #if len($conditions) > 0:
            #if len($timepoints) > 1:
                #for $co in $conditions:
                    #set $comparisons_bis = list()
                    #for $tp in $timepoint:
                        #set $sub_comparisons = list()
                        $sub_comparisons.append(re.sub('"', '', str($co)))
                        $sub_comparisons.append(re.sub('"', '', str($tp)))
                        $comparisons_bis.append($sub_comparisons)
                    #end for
                    $comparisons.append($comparisons_bis)
                #end for
            #end if
        #else
            #for $tp in $timepoint:
                $comparisons.append(re.sub('"', '', str($tp)))
            #end for
        #end if
    #end if
    ]]></token>
    <token name="@INIT_TRANSCRIPTS@"><![CDATA[
    #import re
    #import os
    #import subprocess
    #set $transcripts  = list()

    #for $i, $s in enumerate($deg_list)
        #set $cpt = str($i+1)
        $transcripts.append(re.sub('"', '', "DEG_comparison"+str($i+1)))
        #set $deg_one_values = os.fsdecode(subprocess.check_output('head -n1 ' + str($s.input) + '| cut -f' + str($s.valuecol), shell=True))
        #set $deg_one_id = os.fsdecode(subprocess.check_output('head -n1 ' + str($s.input) + '| cut -f' + str($s.idcol), shell=True))
    #end for
    ]]></token>
    <token name="@INIT_PATHWAYS@"><![CDATA[
    #set $pathways  = {}
    #if $path_kegg_metabolites:
        #silent $pathways['metabolites']='pathways_kegg_metabolites'
    #end if
    #if $path_kegg_transcripts:
        #silent $pathways['transcripts']='pathways_kegg_transcripts'
    #end if
    ]]></token>
</macros>