view InternalCalibration.xml @ 13:f49a58e03ada draft default tip

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/openms commit 3d1e5f37fd16524a415f707772eeb7ead848c5e3
author galaxyp
date Thu, 01 Dec 2022 19:14:27 +0000
parents 6c58aa0ed5c1
children
line wrap: on
line source

<?xml version='1.0' encoding='UTF-8'?>
<!--This is a configuration file for the integration of a tools into Galaxy (https://galaxyproject.org/). This file was automatically generated using CTDConverter.-->
<!--Proposed Tool Section: [Signal processing and preprocessing]-->
<tool id="InternalCalibration" name="InternalCalibration" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.05">
  <description>Applies an internal mass recalibration.</description>
  <macros>
    <token name="@EXECUTABLE@">InternalCalibration</token>
    <import>macros.xml</import>
  </macros>
  <expand macro="requirements"/>
  <expand macro="stdio"/>
  <command detect_errors="exit_code"><![CDATA[@QUOTE_FOO@
@EXT_FOO@
#import re

## Preprocessing
mkdir in &&
ln -s '$in' 'in/${re.sub("[^\w\-_]", "_", $in.element_identifier)}.$gxy2omsext($in.ext)' &&
mkdir out &&
#if $cal.id_in:
  mkdir cal.id_in &&
  ln -s '$cal.id_in' 'cal.id_in/${re.sub("[^\w\-_]", "_", $cal.id_in.element_identifier)}.$gxy2omsext($cal.id_in.ext)' &&
#end if
#if $cal.lock_in:
  mkdir cal.lock_in &&
  ln -s '$cal.lock_in' 'cal.lock_in/${re.sub("[^\w\-_]", "_", $cal.lock_in.element_identifier)}.$gxy2omsext($cal.lock_in.ext)' &&
#end if
#if "lock_out_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  mkdir cal_lock_out &&
#end if
#if "lock_fail_out_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  mkdir cal_lock_fail_out &&
#end if
#if "models_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  mkdir quality_control_models &&
#end if
#if "models_plot_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  mkdir quality_control_models_plot &&
#end if
#if "residuals_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  mkdir quality_control_residuals &&
#end if
#if "residuals_plot_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  mkdir quality_control_residuals_plot &&
#end if

## Main program call

set -o pipefail &&
@EXECUTABLE@ -write_ctd ./ &&
python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hardcoded_json' &&
@EXECUTABLE@ -ini @EXECUTABLE@.ctd
-in
'in/${re.sub("[^\w\-_]", "_", $in.element_identifier)}.$gxy2omsext($in.ext)'
-out
'out/output.${gxy2omsext("mzml")}'
#if $cal.id_in:
  -cal:id_in
  'cal.id_in/${re.sub("[^\w\-_]", "_", $cal.id_in.element_identifier)}.$gxy2omsext($cal.id_in.ext)'
#end if
#if $cal.lock_in:
  -cal:lock_in
  'cal.lock_in/${re.sub("[^\w\-_]", "_", $cal.lock_in.element_identifier)}.$gxy2omsext($cal.lock_in.ext)'
#end if
#if "lock_out_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  -cal:lock_out
  'cal_lock_out/output.${gxy2omsext("mzml")}'
#end if
#if "lock_fail_out_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  -cal:lock_fail_out
  'cal_lock_fail_out/output.${gxy2omsext("mzml")}'
#end if
#if "models_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  -quality_control:models
  'quality_control_models/output.${gxy2omsext("csv")}'
#end if
#if "models_plot_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  -quality_control:models_plot
  'quality_control_models_plot/output.${gxy2omsext("png")}'
#end if
#if "residuals_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  -quality_control:residuals
  'quality_control_residuals/output.${gxy2omsext("csv")}'
#end if
#if "residuals_plot_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  -quality_control:residuals_plot
  'quality_control_residuals_plot/output.${gxy2omsext("png")}'
#end if
#if len(str($OPTIONAL_OUTPUTS).split(',')) == 0
  | tee '$stdout'
#end if

## Postprocessing
&& mv 'out/output.${gxy2omsext("mzml")}' '$out'
#if "lock_out_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  && mv 'cal_lock_out/output.${gxy2omsext("mzml")}' '$cal_lock_out'
#end if
#if "lock_fail_out_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  && mv 'cal_lock_fail_out/output.${gxy2omsext("mzml")}' '$cal_lock_fail_out'
#end if
#if "models_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  && mv 'quality_control_models/output.${gxy2omsext("csv")}' '$quality_control_models'
#end if
#if "models_plot_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  && mv 'quality_control_models_plot/output.${gxy2omsext("png")}' '$quality_control_models_plot'
#end if
#if "residuals_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  && mv 'quality_control_residuals/output.${gxy2omsext("csv")}' '$quality_control_residuals'
#end if
#if "residuals_plot_FLAG" in str($OPTIONAL_OUTPUTS).split(',')
  && mv 'quality_control_residuals_plot/output.${gxy2omsext("png")}' '$quality_control_residuals_plot'
#end if
#if "ctd_out_FLAG" in $OPTIONAL_OUTPUTS
  && mv '@EXECUTABLE@.ctd' '$ctd_out'
#end if]]></command>
  <configfiles>
    <inputs name="args_json" data_style="paths"/>
    <configfile name="hardcoded_json"><![CDATA[{"rscript_executable": "Rscript", "log": "log.txt", "threads": "\${GALAXY_SLOTS:-1}", "no_progress": true}]]></configfile>
  </configfiles>
  <inputs>
    <param argument="-in" type="data" format="mzml" optional="false" label="Input peak file" help=" select mzml data sets(s)"/>
    <param argument="-ppm_match_tolerance" type="float" optional="true" value="25.0" label="Finding calibrants in raw data uses this tolerance (for lock masses and ID's)" help=""/>
    <param argument="-ms_level" type="text" optional="true" value="1 2 3" label="Target MS levels to apply the transformation onto" help="Does not affect calibrant collection (space separated list, in order to allow for spaces in list items surround them by single quotes)">
      <expand macro="list_integer_valsan" name="ms_level"/>
    </param>
    <param argument="-RT_chunking" type="float" optional="true" value="300.0" label="RT window (one-sided" help="i.e. left-&gt;center, or center-&gt;right) around an MS scan in which calibrants are collected to build a model. Set to -1 to use ALL calibrants for all scans, i.e. a global model"/>
    <section name="cal" title="Chose one of two optional input files ('id_in' or 'lock_in') to define the calibration masses/function" help="" expanded="false">
      <param name="id_in" argument="-cal:id_in" type="data" format="featurexml,idxml" optional="true" label="Identifications or features whose peptide ID's serve as calibration masses" help=" select featurexml,idxml data sets(s)"/>
      <param name="lock_in" argument="-cal:lock_in" type="data" format="csv" optional="true" label="Input file containing reference m/z values (text file with each line as: m/z ms-level charge) which occur in all scans" help=" select csv data sets(s)"/>
      <param name="lock_require_mono" argument="-cal:lock_require_mono" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Require all lock masses to be monoisotopic" help="i.e. not the iso1, iso2 etc ('charge' column is used to determine the spacing). Peaks which are not mono-isotopic are not used"/>
      <param name="lock_require_iso" argument="-cal:lock_require_iso" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Require all lock masses to have at least the +1 isotope" help="Peaks without isotope pattern are not used"/>
      <param name="model_type" argument="-cal:model_type" type="select" optional="true" label="Type of function to be fitted to the calibration points" help="">
        <option value="linear">linear</option>
        <option value="linear_weighted" selected="true">linear_weighted</option>
        <option value="quadratic">quadratic</option>
        <option value="quadratic_weighted">quadratic_weighted</option>
        <expand macro="list_string_san" name="model_type"/>
      </param>
    </section>
    <section name="RANSAC" title="Robust outlier removal using RANSAC" help="" expanded="false">
      <param name="enabled" argument="-RANSAC:enabled" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Apply RANSAC to calibration points to remove outliers before fitting a model" help=""/>
      <param name="threshold" argument="-RANSAC:threshold" type="float" optional="true" value="10.0" label="Threshold for accepting inliers (instrument precision (not accuracy!) as ppm^2 distance)" help=""/>
      <param name="pc_inliers" argument="-RANSAC:pc_inliers" type="integer" optional="true" min="1" max="99" value="30" label="Minimum percentage (of available data) of inliers (&lt;threshold away from model) to accept the model" help=""/>
      <param name="iter" argument="-RANSAC:iter" type="integer" optional="true" value="70" label="Maximal # iterations" help=""/>
    </section>
    <section name="goodness" title="Thresholds for accepting calibration success" help="" expanded="false">
      <param name="median" argument="-goodness:median" type="float" optional="true" value="4.0" label="The median ppm error of calibrated masses must be smaller than this threshold" help=""/>
      <param name="MAD" argument="-goodness:MAD" type="float" optional="true" value="2.0" label="The median absolute deviation of the ppm error of calibrated masses must be smaller than this threshold" help=""/>
    </section>
    <expand macro="adv_opts_macro">
      <param argument="-force" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Overrides tool-specific checks" help=""/>
      <param argument="-test" type="hidden" optional="true" value="False" label="Enables the test mode (needed for internal use only)" help="">
        <expand macro="list_string_san" name="test"/>
      </param>
    </expand>
    <param name="OPTIONAL_OUTPUTS" type="select" optional="true" multiple="true" label="Optional outputs">
      <option value="lock_out_FLAG">lock_out (Optional output file containing peaks from 'in' which were matched to reference m/z values)</option>
      <option value="lock_fail_out_FLAG">lock_fail_out (Optional output file containing lock masses which were NOT found or accepted(!) in data from 'in')</option>
      <option value="models_FLAG">models (Table of model parameters for each spectrum)</option>
      <option value="models_plot_FLAG">models_plot (Plot image of model parameters for each spectrum)</option>
      <option value="residuals_FLAG">residuals (Table of pre- and post calibration errors)</option>
      <option value="residuals_plot_FLAG">residuals_plot (Plot image of pre- and post calibration errors)</option>
      <option value="ctd_out_FLAG">Output used ctd (ini) configuration file</option>
    </param>
  </inputs>
  <outputs>
    <data name="out" label="${tool.name} on ${on_string}: out" format="mzml"/>
    <data name="cal_lock_out" label="${tool.name} on ${on_string}: cal:lock_out" format="mzml">
      <filter>OPTIONAL_OUTPUTS is not None and "lock_out_FLAG" in OPTIONAL_OUTPUTS</filter>
    </data>
    <data name="cal_lock_fail_out" label="${tool.name} on ${on_string}: cal:lock_fail_out" format="mzml">
      <filter>OPTIONAL_OUTPUTS is not None and "lock_fail_out_FLAG" in OPTIONAL_OUTPUTS</filter>
    </data>
    <data name="quality_control_models" label="${tool.name} on ${on_string}: quality_control:models" format="csv">
      <filter>OPTIONAL_OUTPUTS is not None and "models_FLAG" in OPTIONAL_OUTPUTS</filter>
    </data>
    <data name="quality_control_models_plot" label="${tool.name} on ${on_string}: quality_control:models_plot" format="png">
      <filter>OPTIONAL_OUTPUTS is not None and "models_plot_FLAG" in OPTIONAL_OUTPUTS</filter>
    </data>
    <data name="quality_control_residuals" label="${tool.name} on ${on_string}: quality_control:residuals" format="csv">
      <filter>OPTIONAL_OUTPUTS is not None and "residuals_FLAG" in OPTIONAL_OUTPUTS</filter>
    </data>
    <data name="quality_control_residuals_plot" label="${tool.name} on ${on_string}: quality_control:residuals_plot" format="png">
      <filter>OPTIONAL_OUTPUTS is not None and "residuals_plot_FLAG" in OPTIONAL_OUTPUTS</filter>
    </data>
    <data name="ctd_out" format="xml" label="${tool.name} on ${on_string}: ctd">
      <filter>OPTIONAL_OUTPUTS is not None and "ctd_out_FLAG" in OPTIONAL_OUTPUTS</filter>
    </data>
  </outputs>
  <tests><!-- TOPP_InternalCalibration_1 -->
    <test expect_num_outputs="4">
      <section name="adv_opts">
        <param name="force" value="false"/>
        <param name="test" value="true"/>
      </section>
      <param name="in" value="InternalCalibration_1_BSA1.mzML"/>
      <output name="out" file="InternalCalibration_1_BSA1_out.mzML.tmp" compare="sim_size" delta_frac="0.7" ftype="mzml"/>
      <param name="ppm_match_tolerance" value="25.0"/>
      <param name="ms_level" value="1"/>
      <param name="RT_chunking" value="-1.0"/>
      <section name="cal">
        <param name="id_in" value="InternalCalibration_1_BSA1_OMSSA.idXML"/>
        <param name="lock_require_mono" value="false"/>
        <param name="lock_require_iso" value="false"/>
        <param name="model_type" value="linear"/>
      </section>
      <section name="RANSAC">
        <param name="enabled" value="true"/>
        <param name="threshold" value="1.0"/>
        <param name="pc_inliers" value="30"/>
        <param name="iter" value="500"/>
      </section>
      <section name="goodness">
        <param name="median" value="4.0"/>
        <param name="MAD" value="2.0"/>
      </section>
      <section name="quality_control"/>
      <output name="quality_control_models" file="InternalCalibration_1_models.csv" compare="sim_size" delta_frac="0.7" ftype="csv"/>
      <output name="quality_control_residuals" file="InternalCalibration_1_residuals.csv" compare="sim_size" delta_frac="0.7" ftype="csv"/>
      <param name="OPTIONAL_OUTPUTS" value="ctd_out_FLAG,models_FLAG,residuals_FLAG"/>
      <output name="ctd_out" ftype="xml">
        <assert_contents>
          <is_valid_xml/>
        </assert_contents>
      </output>
    </test>
    <!-- TOPP_InternalCalibration_2 -->
    <test expect_num_outputs="4">
      <section name="adv_opts">
        <param name="force" value="false"/>
        <param name="test" value="true"/>
      </section>
      <param name="in" value="InternalCalibration_2_lockmass.mzML.gz"/>
      <output name="out" file="InternalCalibration_2_lockmass.mzML.tmp" compare="sim_size" delta_frac="0.7" ftype="mzml"/>
      <param name="ppm_match_tolerance" value="25.0"/>
      <param name="ms_level" value="1 2 3"/>
      <param name="RT_chunking" value="60.0"/>
      <section name="cal">
        <param name="lock_in" value="InternalCalibration_2_lock.csv" ftype="csv"/>
        <param name="lock_require_mono" value="true"/>
        <param name="lock_require_iso" value="false"/>
        <param name="model_type" value="linear"/>
      </section>
      <section name="RANSAC">
        <param name="enabled" value="false"/>
        <param name="threshold" value="10.0"/>
        <param name="pc_inliers" value="30"/>
        <param name="iter" value="70"/>
      </section>
      <section name="goodness">
        <param name="median" value="4.0"/>
        <param name="MAD" value="2.0"/>
      </section>
      <section name="quality_control"/>
      <output name="quality_control_models" file="InternalCalibration_2_models.csv" compare="sim_size" delta_frac="0.7" ftype="csv"/>
      <output name="quality_control_residuals" file="InternalCalibration_2_residuals.csv" compare="sim_size" delta_frac="0.7" ftype="csv"/>
      <param name="OPTIONAL_OUTPUTS" value="ctd_out_FLAG,models_FLAG,residuals_FLAG"/>
      <output name="ctd_out" ftype="xml">
        <assert_contents>
          <is_valid_xml/>
        </assert_contents>
      </output>
    </test>
  </tests>
  <help><![CDATA[Applies an internal mass recalibration.


For more information, visit http://www.openms.de/doxygen/release/2.8.0/html/TOPP_InternalCalibration.html]]></help>
  <expand macro="references"/>
</tool>