view rmassbank.xml @ 0:0b28816c1c2c draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
author recetox
date Thu, 18 May 2023 13:01:04 +0000
parents
children c1a9c990d4b0
line wrap: on
line source

<tool id="rmassbank" name="RMassBank" version="@TOOL_VERSION@+galaxy2">
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="creator"/>

    <requirements>
        <requirement type="package" version="3.7">python</requirement>
        <requirement type="package" version="2.4.1">openbabel</requirement>
        <requirement type="package" version="3.0.0">bioconductor-rmassbank</requirement>
        <requirement type="package" version="3.1.1">r-gplots</requirement>
        <requirement type="package" version="3.0">zip</requirement>
    </requirements>
    <stdio>
        <exit_code range="1:"/>
        <exit_code range=":-1"/>
    </stdio>
    <command detect_errors="aggressive"><![CDATA[
         #for $infile in $param_in:
            ln -s '${infile}' '${infile.element_identifier}' &&
         #end for

         ln -s '${compounds}' '${compounds.element_identifier}' &&

         mkdir -p ./infolists &&
         ln -s $infolist ./infolists/${infolist.element_identifier} &&

         #if $select_settings.setting_file == "template"
           python3 '${__tool_directory__}/createSettingsFile.py'
           '${__tool_directory__}/mysettings.ini'
           '${select_settings.general_param.rtMargin}'
           '${select_settings.general_param.rtShift}'
           '${select_settings.general_param.use_version}'
           '${select_settings.general_param.use_rean_peaks}'
           '${select_settings.general_param.add_annotation}'
           '${select_settings.shifts.pH}'
           '${select_settings.shifts.pM}'
           '${select_settings.shifts.pNa}'
           '${select_settings.shifts.mH}'
           '${select_settings.shifts.mFA}'
           '${select_settings.noise_recalibration.electronicNoiseWidth}'
           '${select_settings.noise_recalibration.recalibrateBy}'
           '${select_settings.noise_recalibration.recalibrateMS1}'
           '${select_settings.noise_recalibration.recalibrateMS1Window}'
           '${select_settings.noise_recalibration.multiplicityFilter}'
           '${select_settings.data_filtering.ppmHighMass}'
           '${select_settings.data_filtering.ppmLowMass}'
           '${select_settings.data_filtering.massRangeDivision}'
           '${select_settings.data_filtering.ppmFine}'
           '${select_settings.data_filtering.prelimCut}'
           '${select_settings.data_filtering.prelimCutRatio}'
           '${select_settings.data_filtering.fineCut}'
           '${select_settings.data_filtering.fineCutRatio}'
           '${select_settings.data_filtering.specOkLimit}'
           '${select_settings.data_filtering.dbeMinLimit}'
           '${select_settings.data_filtering.satelliteMzLimit}'
           '${select_settings.data_filtering.satelliteIntLimit}'
           '${select_settings.raw_settings.ppmFine}'
           '${select_settings.raw_settings.mzCoarse}'
           '${select_settings.raw_settings.fillPrecursorScan}'
           \$(echo `which babel` | sed s/babel//)
           '${select_settings.general_param.include_sp_tags}'
           '${select_settings.raw_settings.unknownMass}'
           &&
         #else
           python3 '${__tool_directory__}/addBabelPath.py'
           '${select_settings.setting_file_ext}'
           \$(echo `which babel` | sed s/babel//)
           &&
         #end if

         Rscript '${__tool_directory__}/rmassbank.r'
          mysettings_galaxy.ini
          '${compounds.element_identifier}'
          '${mode}'
          ./infolists
          #for $infile in $param_in:
            '${infile.element_identifier}'
          #end for
         &&

         mv mysettings_galaxy.ini $outputINI &&
         mv results_RA.RData $rafile &&
         mv results_RF.RData $rffile &&
         mv Rplots.pdf $pdfplot &&
         mv results.RData $fllrdata &&
         zip -r mb_records.zip XX &&
         mv mb_records.zip $output &&

         [ ! -f ./results_Failpeaks.csv ] && touch ./results_Failpeaks.csv &&
         mv results_Failpeaks.csv $csvfile
        ]]>
    </command>
    <inputs>
        <param name="param_in" type="data" format="mzML" multiple="true" label="Input mzML files."/>
        <param format="csv" name="compounds" type="data" label="Compound list in CSV format."/>
        <param format="csv" name="infolist" type="data" label="Infolist in CSV format."/>
        <param name="mode" type="text" label="Mode for RMassBank pipeline."/>

        <conditional name="select_settings">
            <param name="setting_file" type="select"
                   label="Choose the source if you want to generate settings file or you will supply with your own settings file.">
                <option value="template" selected="true">Generate settings file for me</option>
                <option value="external">Use external settings file</option>
            </param>
            <when value="template">

                <section name="general_param" title="Setting of general parameters.">
                    <param name="rtMargin" type="float" value="0.4"
                           label="Deviation (in minutes) allowed the for retention time."/>
                    <param name="rtShift" type="float" value="0.0" label="Systematic retention time shift."/>
                    <param name="use_version" type="select" value="2"
                           label="Which MassBank record version to use; version 2 is advised.">
                        <option value="2" selected="true">2</option>
                        <option value="1">1</option>
                    </param>
                    <param name="use_rean_peaks" type="select" value="TRUE" label="Include reanalyzed peaks?">
                        <option value="TRUE" selected="true">TRUE</option>
                        <option value="FALSE">FALSE</option>
                    </param>
                    <param name="add_annotation" type="select" value="TRUE"
                           label="Annotate the spectra files with (putative) molecular formulas for fragments?">
                        <option value="TRUE" selected="true">TRUE</option>
                        <option value="FALSE">FALSE</option>
                    </param>
                    <param name="include_sp_tags" type="select" value="FALSE" label="Include sp tags?">
                        <option value="FALSE" selected="true">FALSE</option>
                        <option value="TRUE">TRUE</option>
                    </param>
                </section>

                <section name="shifts" title="Shifts of the starting points for RMassBank accession numbers.">
                    <param name="pH" type="integer" value="0" label="pH ([M+H]+: accession numbers 1-14) "/>
                    <param name="pM" type="integer" value="16" label="pM ([M]+: 17-30)"/>
                    <param name="pNa" type="integer" value="32" label="pNa ([M+Na]+: 33-46)"/>
                    <param name="mH" type="integer" value="50" label="mH ([M-H]-: 51-64)"/>
                    <param name="mFA" type="integer" value="66" label="mFA ([M+FA]-: 67-80)"/>
                </section>

                <section name="noise_recalibration" title="Noise and recalibration settings">
                    <param name="electronicNoiseWidth" type="float" value="0.3"
                           label="Exclusion width of electronic noise peaks (from unmatched peaks, prior to reanalysis)."/>
                    <param name="recalibrateBy" type="select" value="dppm" label="Recalibration settings:">
                        <option value="dppm" selected="true">dppm</option>
                        <option value="dmz">dmz</option>
                    </param>
                    <param name="recalibrateMS1" type="select" value="common" label="Recalibrate MS1:">
                        <option value="common" selected="true">with common curve</option>
                        <option value="separate">separately</option>
                        <option value="none">none (do not recalibrate)</option>
                    </param>
                    <param name="recalibrateMS1Window" type="integer" value="15"
                           label="Window width to look for MS1 peaks to recalibrate (in ppm integer values):"/>
                    <param name="multiplicityFilter" type="integer" value="2"
                           label="Define the multiplicity filtering level, default is 2 (peak occurs at least twice,
                           set this to 1 if you want to turn this option off, set this to anything > 2 if you want harder filtering"/>
                </section>

                <section name="data_filtering" title="Data filtering settings">
                    <param name="ppmHighMass" type="integer" value="10" label="ppmHighMass"/>
                    <param name="ppmLowMass" type="integer" value="15" label="ppmLowMass"/>
                    <param name="massRangeDivision" type="integer" value="120" label="massRangeDivision"/>
                    <param name="ppmFine" type="integer" value="5" label="ppmFine"/>
                    <param name="prelimCut" type="integer" value="1000" label="prelimCut"/>
                    <param name="prelimCutRatio" type="float" value="0.0" label="prelimCutRatio"/>
                    <param name="fineCut" type="float" value="0.0" label="fineCut"/>
                    <param name="fineCutRatio" type="float" value="0.0" label="fineCutRatio"/>
                    <param name="specOkLimit" type="integer" value="1000" label="specOkLimit"/>
                    <param name="dbeMinLimit" type="float" value="-0.5" label="dbeMinLimit"/>
                    <param name="satelliteMzLimit" type="float" value="0.5" label="satelliteMzLimit"/>
                    <param name="satelliteIntLimit" type="float" value="0.05" label="satelliteIntLimit"/>
                </section>

                <section name="raw_settings" title="Degine raw MS retrieval settings">
                    <param name="ppmFine" type="integer" value="10" label="ppmFine"/>
                    <param name="mzCoarse" type="float" value="0.5" label="mzCoarse"/>
                    <param name="fillPrecursorScan" type="select" value="FALSE"
                           label="fillPrecursorScan (FALSE for 'good' mzML files which have all the info needed)">
                        <option value="TRUE">TRUE</option>
                        <option value="FALSE" selected="true">FALSE</option>
                    </param>
                    <param name="unknownMass" type="select" value="charged"
                           label="Select how to treat unknown compound masses.">
                        <option value="charged" selected="true">charged</option>
                        <option value="neutral">neutral</option>
                    </param>
                </section>
            </when>
            <when value="external">
                <param name="setting_file_ext" type="data" format="txt" label="Settings file"/>
            </when>
        </conditional>

    </inputs>

    <outputs>
        <data format="txt" name="outputINI" label="mysettings_galaxy.ini"/>
        <data format="csv" name="csvfile" label="CSV file with failed peaks."/>
        <data format="pdf" name="pdfplot" label="PDF plot."/>
        <data format="rdata" name="fllrdata" label="Full R environment."/>
        <data format="rdata" name="rafile" label="RData file with re-analyzed spectra (_RA.RData)."/>
        <data format="rdata" name="rffile" label="RData file with refiltered spectra (_RF.RData)."/>
        <data format="zip" name="output" label="Zipped folder with results."/>
    </outputs>
    <tests>
        <test>
            <param name="compounds" value="compoundList.csv"/>
            <param name="infolist" value="infolist.csv"/>
            <param name="mode" value="pH"/>
            <param name="param_in" value="1_3_Trifluoromethylphenyl_piperazin_2819_pos.mzML"/>
            <param name="ppmFine" value="5"/>

            <output name="outputINI" value="mysettings_galaxy.ini" ftype="txt" lines_diff="2"/>
            <output name="csvfile" value="failedPeaks.csv" ftype="csv" lines_diff="1"/>
            <output name="pdfplot" value="plot.pdf" compare="sim_size" delta_frac="0.1"/>
            <output name="fllrdata" value="resultsFull.RData" compare="sim_size" delta_frac="0.1"/>
            <output name="rafile" value="results_RA.RData" compare="sim_size" delta_frac="0.1"/>
            <output name="rffile" value="results_RF.RData" compare="sim_size" delta_frac="0.1"/>
            <output name="output" value="output.zip" compare="sim_size" delta_frac="0.1"/>
        </test>
    </tests>

    <help>
        <![CDATA[
        @HELP@
        ]]>
    </help>

    <citations>
        <citation type="doi">10.1002/jms.3131</citation>
    </citations>
</tool>