<macros>
    <token name="@TOOL_VERSION@">0.12.0</token>
    <xml name="requirements">
        <requirements>
            <requirement type="package" version="@TOOL_VERSION@">r-recetox-aplcms</requirement>
            <requirement type="package" version="2.5.2">pymzml</requirement>
        </requirements>
    </xml>

    <xml name="annotation">
       <edam_topics>
              <edam_topic>topic_3172</edam_topic>
              <edam_topic>topic_0091</edam_topic>
              <edam_topic>topic_3520</edam_topic>       
       </edam_topics>
       <xrefs>
              <xref type="bio.tools">recetox-aplcms</xref>
       </xrefs>
    </xml>

    <xml name="creator">
        <creator>
            <person
                givenName="Maksym"
                familyName="Skoryk"
                url="https://github.com/maximskorik"
                identifier="0000-0003-2056-8018" />
            <person
                givenName="Matej"
                familyName="Troják"
                url="https://github.com/xtrojak"
                identifier="0000-0003-0841-2707" />
            <person
                givenName="Martin"
                familyName="Čech"
                url="https://github.com/martenson"
                identifier="0000-0002-9318-1781" />
            <person
                givenName="Jiří"
                familyName="Novotný"
                url="https://github.com/xtracko"
                identifier="0000-0001-5449-3523" />
            <person
                givenName="Helge"
                familyName="Hecht"
                url="https://github.com/hechth"
                identifier="0000-0001-6744-996X" />
            <organization
                url="https://www.recetox.muni.cz/"
                email="GalaxyToolsDevelopmentandDeployment@space.muni.cz"
                name="RECETOX MUNI"/>
        </creator>
    </xml>

    <xml name="remove_noise_params">
        <param name="min_pres" type="float" value="0.5" label="Minimal signal presence [fraction of scans]" min="0.0" max="1.0"
               help="The minimum proportion of presence in the time period for a series of signals grouped by m/z to be considered a peak." />
        <param name="min_run" type="float" value="12" label="Minimal elution time [unit corresponds to the retention time]"
               help="The minimum length of elution time for a series of signals grouped by m/z to be considered a peak." />
        <param name="mz_tol" type="float" value="10" label="m/z tolerance [ppm]"
               help="The m/z tolerance level for the grouping of data points. This value is expressed as the fraction of the m/z value.
               This value, multiplied by the m/z value, becomes the cutoff level.
               The recommended value is the machine's nominal accuracy level (e.g. for FTMS, it is 10)." />
        <param name="baseline_correct" type="float" value="0" label="Baseline correction [unit of signal intensity]"
               help="After grouping the observations, the highest intensity in each group is found. If the highest is lower than this value, the entire group will be deleted." />
        <param name="intensity_weighted" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Weight intensity"
               help="Whether to weight the local density by signal intensities in initial peak detection." />
    </xml>

    <xml name="generate_feature_table_params">
        <param name="BIC_factor" type="float" value="2.0" label="BIC factor"
               help="A factor influencing Bayesian information criterion (BIC) in estimation of RT peak shape.
               If the value is larger than 1, models with more peaks are penalized more." />
        <section name="advanced" title="Advanced" expanded="false">
            <param name="component_eliminate" type="float" value="0.01" label="Component eliminate"
                   help="In fitting mixture of bi-Gaussian model of an EIC, when a component accounts for a proportion of intensities less than this value, the component will be ignored." />
            <section name="shape_model" title="Shape model deviations" expanded="true">
                 <param name="sigma_ratio_lim_min" type="float" optional="true" label="Minimal sigma ratio"
                        help="The lower limit of the ratio range between the left-standard deviation and the right-standard deviation of the bi-Gaussian function to fit the data." />
                 <param name="sigma_ratio_lim_max" type="float" optional="true" label="Maximal sigma ratio"
                        help="The upper limit of the ratio range between the left-standard deviation and the right-standard deviation of the bi-Gaussian function to fit the data." />
            </section>
            <conditional name="sd_cut">
                <param name="sd_cut_bounds" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Standard deviations boundaries."
                       help="Limit the standard deviations by setting boundaries." />
                <when value="TRUE">
                    <param name="sd_cut_min" type="float" value="0.01" label="Minimal standard deviation"
                           help="The minimum standard deviation - features with a standard deviation lower than this number are eliminated." />
                    <param name="sd_cut_max" type="float" value="500" label="Maximal standard deviation"
                            help="The maximum standard deviation - features with a standard deviation greater than this number are eliminated." />
                </when>
            </conditional>
            <conditional name="peak_estim">
                <param name="peak_estim_method" type="select" display="radio" label="Peak estimation method"
                       help="The estimation method for parameters of the bi-Gaussian peak model. Two possible algorithms: moment and EM (expectation maximization).">
                    <option value="moment">Moment</option>
                    <option value="EM" selected="true">EM</option>
                </param>
                <when value="moment">
                    <param name="moment_power" type="float" value="1" label="Moment power"
                           help="The power parameter for data transformation when fitting the bi-Gaussian mixture model in an EIC." />
                </when>
            </conditional>
        </section>
    </xml>

    <xml name="tolerances">
       <param name="mz_tol_relative_ppm" type="float" value="10" label="Relative m/z tolerance [ppm]"
              help="Relative m/z tolerance to use for grouping features." />
       <param name="rt_tol" type="float" value="5" label="Retention time tolerance [unit corresponds to the retention time]"
              help="Retention time tolerance to use for grouping features." />
    </xml>

    <xml name="recover_weaker_params">
        <param name="mz_tol" type="float" value="10" label="m/z tolerance [ppm]"
               help="The m/z tolerance level for the grouping of data points. This value is expressed as the fraction of the m/z value.
               This value, multiplied by the m/z value, becomes the cutoff level.
               The recommended value is the machine's nominal accuracy level (e.g. for FTMS, it is 10)." />
        <param name="recover_mz_range" type="float" optional="true" label="Range for m/z recovery [ppm]"

               help="The m/z around the feature m/z to search for observations. If not given, 1.5 times the m/z tolerance
               in the aligned object will be used." />
        <param name="recover_rt_range" type="float" optional="true" label="Range for rt recovery [unit of retention time]"
               help="The retention time around the feature retention time to search for observations.
               If not given, 0.5 times the retention time tolerance in the aligned object will be used." />
        <param name="use_observed_range" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE"
               label="Use observed rt range" help="Use the minimal and maximal rt values per feature." />
        <param name="recover_min_count" type="integer" value="3" label="Minimal count to recover"
               help="The minimum number of raw data points to be considered as a true feature." />
        <param name="intensity_weighted" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE"
               label="Weight intensity" help="Whether to weight the local density by signal intensities in initial peak detection." />
    </xml>

    <xml name="bandwidth_params">
        <param name="bandwidth" type="float" value="0.5" label="Bandwidth factor" min="0" max="1"
               help="Parameter used to scale down the overall range of retention times (the bandwidth) assumed in the kernel smoother
               used for peak identification. The value is between zero and one. The minimal and maximal bandwidth can be limited by explicit values." />
        <param name="min_bandwidth" type="float" optional="true" label="Minimal bandwidth [unit corresponds to the retention time]"
               help="The lower limit on the resulting bandwidth. If not given, it is estimated based on the overall range of retention times in the profile." />
        <param name="max_bandwidth" type="float" optional="true" label="Maximal bandwidth [unit corresponds to the retention time]"
               help="The upper limit on the resulting bandwidth. If not given, it is estimated based on the overall range of retention times in the profile" />

    </xml>

    <xml name="citations">
        <citations>
            <citation type="doi">10.1093/bioinformatics/btp291</citation>
            <citation type="doi">10.1186/1471-2105-11-559</citation>
            <citation type="doi">10.1021/pr301053d</citation>
            <citation type="doi">10.1093/bioinformatics/btu430</citation>
            <citation type="doi">10.1038/s41598-020-70850-0</citation>
            <yield />
        </citations>
    </xml>
</macros>
