view maxquant.xml @ 21:8934bc76bb52 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 419e4f6608f60f0d73987b890d6b7f8854e874fb
author galaxyp
date Mon, 19 Jun 2023 17:02:17 +0000
parents 163452d1e255
children 9c52362ae7bb
line wrap: on
line source

<tool id="maxquant" name="MaxQuant" version="@VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="required_files"/>
    <command detect_errors="exit_code"><![CDATA[
    ## this is needed to avoid dotnet from crashing, in a newer dotnet version we can remove that
    export COMPlus_EnableDiagnostics=0 &&
    #import re
    maxquant -c mqpar.xml 2>/dev/null  ## MQ writes success of creation to stderr

    #if 'config' in $output_opts.output:
      &&
      cp '$mq_conf' '$config'
    #end if
    #set infiles = [$name for $pg in $paramGroups for $name in $pg.files]
    #set names = [re.sub('@SUBSTITUTION_RX@', '_', str($n.element_identifier)) for $n in $infiles]
    #set names_with_ext = [($name if ($name).lower().endswith(str($input_opts.ftype)) else $name + str($input_opts.ftype)) for $name in $names]
    #for $target, $link in zip($infiles, $names_with_ext)
        &&
        #if str($input_opts.ftype) == '.thermo.raw':
        cp '$target' '$link'
        #else:
        ln -s '$target' '$link'
        #end if
    #end for
    &&
    python3 '$__tool_directory__/create_mqpar.py'
    #if $search_opts.template
        --exp_design='$search_opts.template'
    #end if
    --version=@VERSION@ 
    --num_threads=\${GALAXY_SLOTS:-1}
    --substitution_rx='@SUBSTITUTION_RX@'
    --yaml='$mq_conf'
    mqpar.xml

    #if $output_opts.dry_run:
      &&
      mkdir -p combined/txt
      &&
      mv mqpar.xml combined/txt/mqpar.xml
    #else:
      && 
      maxquant mqpar.xml
      #if 'log' in $output_opts.output:
          > '$log'
      #end if
      &&
      mv mqpar.xml combined/txt/mqpar.xml
      #if 'output_all' in $output_opts.output:
          &&
          tar -zcf '$output_all' ./combined/txt
      #end if
      
      #if $qc.do_it == 'true':
        &&
        Rscript '$qr' '$qr_yaml'
          #if 'log' in $output_opts.output:
              >> '$log' 2>&1
          #end if
        &&
        cp './combined/txt/report_v@VERSION_PTXQC@_combined.pdf' '$ptxqc_report'
      #end if
    #end if
    ]]></command>

    <configfiles>
        <configfile name="mq_conf">
            #import re
            fastaFiles: [${input_opts.fasta_files}]
            parseRules:
              identifierParseRule: '${input_opts.identifier_parse_rule}'
              descriptionParseRule: '${input_opts.description_parse_rule}'
            minUniquePeptides: ${search_opts.min_unique_pep}
            minPepLen: ${search_opts.min_peptide_len}
            maxPeptideMass: ${search_opts.max_peptide_mass}
            calcPeakProperties: ${search_opts.calc_peak_properties}
            #set writeMzTab = "mzTab" in $output_opts.output
            writeMzTab: $writeMzTab
            #if $protein_quant.lfq_opts.do_ibaq.ibaq == 'True':
            ibaq: ${protein_quant.lfq_opts.do_ibaq.ibaq}
            ibaqLogFit: ${protein_quant.lfq_opts.do_ibaq.ibaqLogFit}
            #end if
            separateLfq: ${protein_quant.lfq_opts.separateLfq}
            lfqStabilizeLargeRatios: ${protein_quant.lfq_opts.lfqStabilizeLargeRatios}
            lfqRequireMsms: ${protein_quant.lfq_opts.lfqRequireMsms}
            advancedSiteIntensities: ${protein_quant.lfq_opts.advancedSiteIntensities}
            matchBetweenRuns: ${search_opts.mbr.match_between_runs}
            #if $search_opts.mbr.match_between_runs == 'True':
            matchingTimeWindow: ${search_opts.mbr.matching_time_window}
            matchingIonMobilityWindow: ${search_opts.mbr.matching_ion_mobility_window}
            alignmentTimeWindow: ${search_opts.mbr.alignment_time_window}
            alignmentIonMobilityWindow: ${search_opts.mbr.alignment_ion_mobility_window}
            matchUnidentifiedFeatures: ${search_opts.mbr.match_unidentified_features}
            #end if
            includeContaminants: ${search_opts.incl_contaminants}
            minPeptideLengthForUnspecificSearch: ${search_opts.min_pep_length}
            maxPeptideLengthForUnspecificSearch: ${search_opts.max_pep_length}
            decoyMode: ${search_opts.decoy_mode}
            peptideFdr: ${search_opts.psm_fdr}
            proteinFdr: ${search_opts.protein_fdr}
            quantMode: ${protein_quant.peptides_for_quantification}
            restrictProteinQuantification: ${protein_quant.only_unmod_prot.unmod_prot}
            #if $protein_quant.only_unmod_prot.unmod_prot == 'True':
            #if $protein_quant.only_unmod_prot.mods_used_prot_quant:
            restrictMods: [${protein_quant.only_unmod_prot.mods_used_prot_quant}]
            #else:
            restrictMods: []
            #end if
            useCounterparts: $protein_quant.only_unmod_prot.discard_unmod_cpart_peptides
            #end if
            paramGroups:
            #for $pg in $paramGroups:
              #set names = [re.sub('@SUBSTITUTION_RX@', '_', str($n.element_identifier)) for $n in $pg.files]
              #set names_with_ext = [($name if ($name).lower().endswith(str($input_opts.ftype)) else $name + str($input_opts.ftype)) for $name in $names]
              - files: $names_with_ext
                maxMissedCleavages: ${pg.maxMissedCleavages}
                #if $pg.fixedModifications:
                fixedModifications: [${pg.fixedModifications}]
                #else:
                fixedModifications: []
                #end if
                #if $pg.variableModifications:
                variableModifications: [${pg.variableModifications}]
                #else:
                variableModifications: []
                #end if
                #if $pg.enzymes:
                enzymes: [${pg.enzymes}]
                #else:
                enzymes: []
                #end if
                enzymeMode: ${pg.digestion_mode}
                #if $pg.quant_method.select_quant_method == 'silac':
                labelMods:
                  #if $pg.quant_method.light_labels:
                  - [${pg.quant_method.light_labels}]
                  #else:
                  - []
                  #end if
                  #if $pg.quant_method.medium_labels:
                  - [${pg.quant_method.medium_labels}]
                  #else:
                  - []
                  #end if
                  #if $pg.quant_method.heavy_labels:
                  - [${pg.quant_method.heavy_labels}]
                  #else:
                  - []
                  #end if
                #end if
                #if $pg.quant_method.select_quant_method == 'lfq':
                lfqMode: 1
                lfqNormType: ${pg.quant_method.lfqNormType}
                lfqMinEdgesPerNode: ${pg.quant_method.lfqMinEdgesPerNode}
                lfqAvEdgesPerNode: ${pg.quant_method.lfqAvEdgesPerNode}
                lfqMinRatioCount: ${pg.quant_method.lfqMinRatioCount}
                #end if
                #if $pg.quant_method.select_quant_method == 'reporter_ion_ms2':
                lcmsRunType: 'Reporter ion MS2'
                reporterMassTolerance: 0.003
                #if $pg.quant_method.filter_by_pif.filter_pif == 'True':
                reporterPif: ${pg.quant_method.filter_by_pif.reporter_pif}
                #else:
                reporterPif: 0
                #end if
                reporterFraction: 0
                reporterBasePeakRatio: 0
                filterPif: ${pg.quant_method.filter_by_pif.filter_pif}
                isobaricLabels:
                  #if $pg.quant_method.iso_labels.labeling == 'custom':
                    #for $l in $pg.quant_method.iso_labels.iso_label:
                      - ['$l.internallabel','$l.terminallabel',$l.cm2,$l.cm1,$l.cp1,$l.cp2,$l.tmtlike]
                    #end for
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt2plex':
                    @TMT2PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt6plex':
                    @TMT6PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt8plex':
                    @TMT8PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt10plex':
                    @TMT10PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt11plex':
                    @TMT11PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmtpro16plex':
                    @TMTPRO16PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmtpro18plex':
                    @TMTPRO18PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'itraq4plex':
                    @ITRAQ4PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'itraq8plex':
                    @ITRAQ8PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'iodotmt6plex':
                    @IODOTMT6PLEX@
                  #end if
                #end if
                #if $pg.quant_method.select_quant_method == 'reporter_ion_ms3':
                lcmsRunType: 'Reporter ion MS3'
                reporterMassTolerance: 0.003
                #if $pg.quant_method.filter_by_pif.filter_pif == 'True':
                reporterPif: ${pg.quant_method.filter_by_pif.reporter_pif}
                #else:
                reporterPif: 0
                #end if
                reporterFraction: 0
                reporterBasePeakRatio: 0
                filterPif: ${pg.quant_method.filter_by_pif.filter_pif}
                isobaricLabels:
                  #if $pg.quant_method.iso_labels.labeling == 'custom':
                    #for $l in $pg.quant_method.iso_labels.iso_label:
                      - ['$l.internallabel','$l.terminallabel',$l.cm2,$l.cm1,$l.cp1,$l.cp2,$l.tmtlike]
                    #end for
                  #end if
                   #if $pg.quant_method.iso_labels.labeling == 'tmt2plex':
                    @TMT2PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt6plex':
                    @TMT6PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt8plex':
                    @TMT8PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt10plex':
                    @TMT10PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmt11plex':
                    @TMT11PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmtpro16plex':
                    @TMTPRO16PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'tmtpro18plex':
                    @TMTPRO18PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'itraq4plex':
                    @ITRAQ4PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'itraq8plex':
                    @ITRAQ8PLEX@
                  #end if
                  #if $pg.quant_method.iso_labels.labeling == 'iodotmt6plex':
                    @IODOTMT6PLEX@
                  #end if
                #end if
            #end for
        </configfile>
        <expand macro="ptxqc"/>
    </configfiles>

    <inputs>
        <section name="input_opts" title="Input Options" expanded="True">
            <param name="ftype" type="select" label="choose the type of your input files">
                <option value=".thermo.raw">thermo.raw</option>
                <option value=".mzxml">mzxml</option>
                <option value=".mzml">mzml</option>
            </param>
            <param format="fasta" multiple="true" name="fasta_files"
                   type="data" label="FASTA files"
                   help="Specify one or more FASTA databases."/>
            <param name="identifier_parse_rule" type="text"
                   label="identifier parse rule" value="&gt;([^\s]*)">
                <sanitizer>
                    <valid initial="string.printable">
                        <remove value="&apos;"/>
                    </valid>
                </sanitizer>
            </param>
            <param name="description_parse_rule" type="text"
                   label="description parse rule" value="&gt;(.*)"
                   help="Modify parse rules if needed.">
                <sanitizer>
                    <valid initial="string.printable">
                        <remove value="&apos;"/>
                    </valid>
                </sanitizer>
            </param>
        </section>

        <section name="search_opts" title="Search Options" expanded="true">
            <param format="tabular" name="template" type="data" optional="true"
                   label="Specify an experimental design template (if needed). For detailed
                          instructions see the help text."/>
            <param type="integer" name="min_peptide_len"
                   label="minimum peptide length" value="7"
                   help="Peptides shorter than this value will not be reported nor be considered during protein identification and quantification
short peptides are usually not unique in the protein database and therefore not statistically informative."/>
            <param type="integer" name="max_peptide_mass"
                   label="maximum peptide mass [Da]" value="4600"
                   help="Peptides that are heavier than this mass will be discarded in the Andromeda search."/>
            <param type="integer" name="min_unique_pep"
                   label="minimum unique peptides" value="0"
                   help="The minimum number of unique peptides a protein group should have to be considered as identified and reported in the final table."/>
            <param name="calc_peak_properties" type="boolean" checked="false"
                   label="Calculate peak properties"
                   truevalue="True" falsevalue="False"
                   help="If checked, several quantities characterizing peaks and isotopes patterns are calculated. This may lead to a substantial increase in computation time."/>
            <conditional name="mbr">
                <param name="match_between_runs" type="select"
                       label="Match between runs"
                       help="Identifications are transferred to non-sequenced or non-identified MS features in other LC-MS runs.">
                    <option value="False" selected="true">No</option>
                    <option value="True">Yes</option>
                </param>
                <when value="False"/>
                <when value="True">
                    <param name="matching_time_window" type="float" label="Match Time Window [min]" min="0" value="0.7"
                       help="The time window that is used in 'Match between runs' for the transfer of identifications."/>
                    <param name="matching_ion_mobility_window" type="float" label="Match Ion Mobility Window" min="0" value="0.05"
                       help="The ion mobility window that is used in 'Match between runs' for the transfer of identifications."/>
                    <param name="alignment_time_window" type="integer" label="Alignment Time Window [min]" min="0" value="20"
                       help="The time window that is used in retention time alignment to search for the best alignment function."/>
                    <param name="alignment_ion_mobility_window" type="integer" label="Alignment Ion Mobility" min="0" value="1"
                       help="The ion mobility window that is used in ion mobility alignment to search for the best alignment function."/>
                    <param name="match_unidentified_features" type="boolean" checked="false"
                           label="Match unidentified Features"
                           truevalue="True" falsevalue="False"
                       help="Also unidentified peptide features will be matched between runs. Their expression profiles over multiple samples are written into the table called 'matchedFeatures.txt'."/>
                </when>
            </conditional>
            <param name="incl_contaminants" type="boolean" checked="true"
                   label="Include contaminants"
                   truevalue="True" falsevalue="False"
                   help="‘Yes’ means that proteins from a contaminant list are automatically added to the list of proteins for in silico digestion (in the fasta file)"/>
            <param name="decoy_mode" type="select"
                   label="Decoy mode"
                   help="The decoy sequences can be generated by reversing or randomizing the original protein sequences. Reversing is recommended.">
                <option value="revert" selected="true">Revert</option>
                <option value="randomize">Randomize</option>
            </param>
            <param name="psm_fdr" type="float" label="PSM FDR" min="0" value="0.01"
                   help="Specify the desired false discovery rate (FDR) at the peptide spectrum match (PSM) level. It is determined by the target-decoy approach. A value of 0.01 stands for 1% FDR."/>
            <param name="protein_fdr" type="float" label="Protein FDR" min="0" value="0.01"
                   help="Specify the desired false discovery rate (FDR) at the protein level. It is determined by the target-decoy approach. A value of 0.01 stands for 1% FDR."/>
            <param name="min_pep_length" type="integer" label="Minimum peptide length for unspecific searches" min="1" value="8"
                   help="During unspecific searches peptides that have fewer amino acids than this value will be discarded. This applies also to semi-specific (e.g. semi tryptic) searches"/>
            <param name="max_pep_length" type="integer" label="Maximum peptide length for unspecific searches" min="1" value="25"
                   help="During unspecific searches peptides that have more amino acids than this value will be discarded. This applies also to semi-specific (e.g. semi tryptic) searches"/>
        </section>

        <section name="protein_quant" title="Protein quantification" expanded="true">

            <param name="peptides_for_quantification" type="select" label="Peptides for quantification"
                   help="Specify how the protein ratios will be calculated. When ‘All’ is selected the quantification is done on all peptides. With ‘Unique’, only the peptides unique for that specific protein group are used for quantification. The ‘unique + razor’ mode calculates protein ratios from the unique and razor peptides. Razor peptides are non-unique peptides assigned to the protein group with the most other peptides (Occam’s razor principle).">
                <option value="0">All</option>
                <option value="1" selected="true">Unique + razor</option>
                <option value="2">Unique</option>
            </param>

            <conditional name="only_unmod_prot">
                <param name="unmod_prot" type="select"
                       label="Use only unmodified peptides"
                       help="Indicate here which kind of peptides should be used for protein quantification. If ‘No’, all peptides are used irrespective of their modification state. If ‘Yes’, all unmodified peptides are used plus those peptides that have only the modifications specified in the field below.">
                    <option value="False">No</option>
                    <option value="True" selected="true">Yes</option>
                </param>
                <when value="True">
                    <param name="mods_used_prot_quant" type="select" multiple="true"
                           label="Modifications used in protein quantification"
                           help="Peptides containing only these modifications will be used for the quantification of proteins in addition to unmodified peptides. This includes ratio and intensity calculations including iBAQ">
                        <expand macro="default_mod_option" value="Oxidation (M)"/>
                        <expand macro="default_mod_option" value="Acetyl (Protein N-term)"/>
                        <expand macro="mod_option" value="Carbamidomethyl (C)"/>
                        <expand macro="modification"/>
                    </param>
                    <!-- note: the following default is different to the mquant default -->
                    <param name="discard_unmod_cpart_peptides" type="boolean" label="Discard unmodified counterpart peptides" checked="true"
                           truevalue="True" falsevalue="False"
                           help="If selected, also unmodified peptides will be discarded for which a modified counterpart has been identified with a modification that is not specified in the field above."/>
                </when>
                <when value="False">
                </when>
            </conditional>

            <section name="lfq_opts" title="LFQ Options" expanded="false">
                <param name="separateLfq" type="boolean" checked="false"
                       label="Separate LFQ in parameter Groups"
                       truevalue="True" falsevalue="False"
                       help="The MaxLFQ algorithm will be applied independently to samples in different parameter groups."/>
                <param name="lfqStabilizeLargeRatios" type="boolean" checked="true"
                       label="Stabilize large LFQ ratios"
                       truevalue="True" falsevalue="False"
                       help="Large protein ratios will get an admixture of the total protein intensity ratio as described in the MaxLFQ paper"/>
                <param name="lfqRequireMsms" type="boolean" checked="true"
                       label="Require MS/MS for LFQ comparisons"
                       truevalue="True" falsevalue="False"
                       help="Requires for each pari-wise peptide intensity comparison that at least one of two peptides has been identified by MS/MS"/>
                <conditional name="do_ibaq">
                    <param name="ibaq" type="select"
                           label="iBAQ (calculates absolute protein abundances by normalizing to copy number and not protein mass)">
                        <option value="False">No</option>
                        <option value="True">Yes</option>
                    </param>
                    <when value="True">
                        <param name="ibaqLogFit" type="boolean" checked="true"
                               label="Logarithmic fit"
                               truevalue="True" falsevalue="False"/>
                    </when>
                    <when value="False">
                    </when>
                </conditional>
                <param name="advancedSiteIntensities" type="boolean" checked="true"
                       label="Advanced site intensities"
                       truevalue="True" falsevalue="False"/>
            </section>

        </section>


        <repeat name="paramGroups" title="Parameter Group" min="1" default="1">
            <param type="data" format="thermo.raw,mzxml,mzml" name="files" label="Infiles" multiple="true"
                   help="Only select infiles matching the filetype specified in the input options."/>
            <param type="integer" name="maxMissedCleavages"
                   label="missed cleavages" value="2"
                   help="The number of missed cleavages that are maximally tolerated in the in-silico digestion of the protien sequences."/>
            <param name="fixedModifications" type="select" label="fixed modifications"
                   multiple="true"
                   help="Select zero or more fixed modifications. They will always be attached to any occurence of the respective amino acid.">
                <expand macro="mod_option" value="Acetyl (Protein N-term)"/>
                <expand macro="default_mod_option" value="Carbamidomethyl (C)"/>
                <expand macro="mod_option" value="Oxidation (M)"/>
                <expand macro="modification"/>
            </param>
            <param name="variableModifications" type="select" label="variable modifications"
                   multiple="true"
                   help="Select zero or more variable modifications. Do not specify label modifications here, neither ms1 level labels, like SILAC, nor isobaric labels.">
                <expand macro="mod_option" value="Carbamidomethyl (C)"/>
                <expand macro="default_mod_option" value="Oxidation (M)"/>
                <expand macro="mod_option" value="Acetyl (Protein N-term)"/>
                <expand macro="modification"/>
            </param>
            <param name="enzymes" type="select" label="enzyme"
                   multiple="true"
                   help="Select zero or more enzymes. The enzymes used for generating the in silico peptides for the Andromeda search.">
                <expand macro="default_mod_option" value="Trypsin/P"/>
                <expand macro="proteases"/>
            </param>
            <param name="digestion_mode" type="select" label="Digestion mode"
                   help="'Unspecific means that no cleavage rule is applied but instead all peptides up to a maximal length are considered">
                <option value="0" selected="true">Specific</option>
                <option value="1">Semi-specific free N-terminus</option>
                <option value="2">Semi-specific free C-terminus</option>
                <option value="3">Semi-specific</option>
                <option value="4">Unspecific</option>
                <option value="5">No digestion</option>
            </param>
            <conditional name="quant_method">
                <param name="select_quant_method" type="select" label="Quantitation Methods"
                       help="Select a method if needed.">
                    <option value="">None</option>
                    <option value="lfq">label free quantification</option>
                    <option value="silac">label based quantification</option>
                    <option value="reporter_ion_ms2">reporter ion MS2</option>
                    <option value="reporter_ion_ms3">reporter ion MS3</option>
                </param>
                <when value=""/>
                <when value="silac">
                    <param name="light_labels" type="select" label="light labels"
                           multiple="true" help="Select zero or more light modifications.">
                        <expand macro="label"/>
                    </param>
                    <param name="medium_labels" type="select" label="medium labels"
                           multiple="true"
                           help="Select zero modifications if you have two labels. Select a medium modification if you have three labels.">
                        <expand macro="label"/>
                    </param>
                    <param name="heavy_labels" type="select" label="heavy labels"
                           multiple="true" help="Select zero or more heavy modifications.">
                        <expand macro="label"/>
                    </param>
                </when>
                <when value="lfq">
                    <param type="integer" name="lfqMinRatioCount"
                           label="LFQ minimum ratio count" value="2"
                           help="Minimum number of peptides that has to be available in pair-wise comparisons between two samples for a protein."/>
                    <param type="integer" name="lfqMinEdgesPerNode"
                           label="LFQ minimum number of neighbours" value="3"
                           help="Defines the network to normalize the samples in the fast LFQ mode."/>
                    <param type="integer" name="lfqAvEdgesPerNode"
                           label="LFQ average number of neighbours" value="6"
                           help="Defines the network to normalize the samples in the fast LFQ mode."/>
                    <param name="lfqNormType" type="select" label="Normalization type"
                           multiple="false" help="">
                        <option value="0">None</option>
                        <option value="1" selected="true">Classic</option>
                    </param>
                </when>
                <when value="reporter_ion_ms2">
                    <expand macro="reporter_ion_macro"/>
                </when>
                <when value="reporter_ion_ms3">
                    <expand macro="reporter_ion_macro"/>
                </when>
            </conditional>
        </repeat>

        <expand macro="ptxqc-opts"/>

        <section title="Output Options" name="output_opts" expanded="true">
            <param name="dry_run" type="boolean" checked="false"
                   label="Only create config files? (i.e. for testing)"
                   truevalue="True" falsevalue=""/>
            <param type="select" name="output" label="Select the desired outputs."
                   multiple="true" optional="false">
                <option value="proteinGroups">Protein Groups</option>
                <option value="mqpar">mqpar.xml</option>
                <option value="peptides">Peptides</option>
                <option value="evidence">Evidence</option>
                <option value="parameters">Tabular Parameters</option>
                <option value="msms">MSMS</option>
                <option value="mzTab">mzTab</option>
                <option value="allPeptides">all peptides</option>
                <option value="libraryMatch">library match</option>
                <option value="matchedFeatures">matched features</option>
                <option value="modificationSpecificPeptides">modification specific peptides</option>
                <option value="ms3Scans">ms3 scans</option>
                <option value="msmsScans">msms scans</option>
                <option value="mzRange">mz range</option>
                <option value="peptideSection">peptide section</option>
                <option value="summary">summary</option>
                <option value="output_all">complete 'combined/txt/' directory (compressed)</option>
                <option value="log">MaxQuant and PTXQC log</option>
                <option value="config">yaml config file</option>
            </param>
        </section>
    </inputs>
    
    <expand macro="outputs"/>

    <tests>
        <!-- functional test with small mzXML file, no quantitation methods -->
        <test expect_num_outputs="14">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="bsa.fasta" />
            <param name="identifier_parse_rule" value="&gt;([^\s]*)" />
            <param name="description_parse_rule" value="&gt;(.*)" />
            <repeat name="paramGroups">
                <param name="files" value="BSA_min_23.mzXML"/>
                <param name="maxMissedCleavages" value="1"/>
                <param name="fixedModifications" value="Carbamidomethyl (C)" />
                <param name="variableModifications" value="Oxidation (M)" />
                <param name="enzymes" value="Trypsin/P" />
            </repeat>
            <param name="output" value="evidence,msms,allPeptides,msmsScans,mzTab,mzRange,parameters,peptides,proteinGroups,summary,modificationSpecificPeptides,output_all,config,mqpar" />
            <output name="mqpar" file="01/mqpar.xml" lines_diff="6"/>
            <output name="evidence">
                <assert_contents>
                    <has_n_lines n="7"/>
                    <has_n_columns n="58"/>
                </assert_contents>
            </output>
            <output name="msms" file="01/combined/txt/msms.txt" />
            <output name="mzTab" file="01/combined/txt/mzTab.mzTab" lines_diff="34" ftype="mztab"/>
            <output name="allPeptides">
                <assert_contents>
                    <has_n_lines n="159"/>
                    <has_n_columns n="35"/>
                </assert_contents>
            </output>
            <output name="msmsScans">
                <assert_contents>
                    <has_n_lines n="82"/>
                    <has_n_columns n="46"/>
                </assert_contents>
            </output>
            <output name="mzRange">
                <assert_contents>
                    <has_n_lines n="1881"/>
                    <has_n_columns n="12"/>
                </assert_contents>
            </output>
            <output name="parameters" file="01/combined/txt/parameters.txt" lines_diff="10"/>
            <output name="peptides">
                <assert_contents>
                    <has_n_lines n="7"/>
                    <has_n_columns n="57"/>
                </assert_contents>
            </output>
            <output name="proteinGroups">
                <assert_contents>
                    <has_n_lines n="7"/>
                    <has_n_columns n="39"/>
                </assert_contents>
            </output>
            <output name="summary">
                <assert_contents>
                    <has_n_lines n="3"/>
                    <has_n_columns n="51"/>
                </assert_contents>
            </output>
            <output name="modificationSpecificPeptides">
                <assert_contents>
                    <has_n_lines n="7"/>
                    <has_n_columns n="32"/>
                </assert_contents>
            </output>
            <output name="config" file="01/config.yml" lines_diff="2"/>
        </test>
        <!-- 2 reporter ion ms2 + multiple param groups, testing yaml conf file and mqpar.xml only -->
        <test expect_num_outputs="3">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="bsa.fasta" />
            <param name="identifier_parse_rule" value="&gt;([^\s]*)" />
            <param name="description_parse_rule" value="&gt;(.*)" />
            <param name="incl_contaminants" value="False" /> <!-- non-default value -->
            <param name="min_pep_length" value="7" /> <!-- non-default value -->
            <param name="max_pep_length" value="24" /> <!-- non-default value -->
            <param name="decoy_mode" value="randomize" /> <!-- non-default value -->
            <param name="psm_fdr" value="0.5" /> <!-- non-default value -->
            <param name="protein_fdr" value="0.4" /> <!-- non-default value -->
            <section name="protein_quant">
                <param name="peptides_for_quantification" value="0"/><!-- non-default value -->
                <conditional name="only_unmod_prot">
                    <param name="unmod_prot" value="True"/>
                    <param name="mods_used_prot_quant" value="Pro5,Pro6"/>
                </conditional>
            </section>
            <repeat name="paramGroups">
                <param name="files" value="BSA_min_23.mzXML"/>
                <param name="variableModifications" value="Oxidation (M)" />
                <param name="fixedModifications" value="" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="reporter_ion_ms2" />
                    <conditional name="iso_labels">
                        <param name="labeling" value="custom" />
                        <repeat name="iso_label">
                            <param name="internallabel" value="TMT2plex-Lys126" />
                            <param name="terminallabel" value="TMT2plex-Nter126" />
                            <param name="tmtlike" value="True" />
                            <param name="cp1" value="6.7" />
                            <param name="cp2" value="3" />
                        </repeat>
                        <repeat name="iso_label">
                            <param name="internallabel" value="TMT2plex-Lys127" />
                            <param name="terminallabel" value="TMT2plex-Nter127" />
                            <param name="tmtlike" value="True" />
                        </repeat>
                    </conditional>
                    <conditional name="filter_by_pif">
                        <param name="filter_pif" value="False"/>
                        <param name="reporter_pif"
                               value="0.6"/> <!-- as filter_pif is False this value will be ignored and 0 used instead -->
                    </conditional>
                </conditional>
            </repeat>
            <repeat name="paramGroups">
                <param name="files" value="BSA_min_22"/>
                <param name="variableModifications" value="" />
                <param name="fixedModifications" value="" />
                <param name="enzymes" value="" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="reporter_ion_ms2"/>
                    <conditional name="iso_labels">
                        <param name="labeling" value="itraq4plex"/>
                    </conditional>
                    <conditional name="filter_by_pif">
                        <param name="filter_pif" value="True"/>
                        <param name="reporter_pif" value="0.8"/> <!-- as filter_pif is True this value is used -->
                    </conditional>
                </conditional>
            </repeat>
            <param name="dry_run" value="True" />
            <param name="output" value="config,mqpar,mzTab" />
            <output name="config" file="02/config.yml" lines_diff="7" />
            <output name="mqpar" file="02/mqpar.xml" lines_diff="8" />
        </test>
        <!-- 3 reporter ion ms3 + multiple param groups, testing yaml conf file and mqpar.xml only -->
        <test expect_num_outputs="3">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="bsa.fasta" />
            <param name="identifier_parse_rule" value="&gt;([^\s]*)" />
            <param name="description_parse_rule" value="&gt;(.*)" />
            <param name="incl_contaminants" value="False" /> <!-- non-default value -->
            <param name="min_pep_length" value="7" /> <!-- non-default value -->
            <param name="max_pep_length" value="24" /> <!-- non-default value -->
            <param name="decoy_mode" value="randomize" /> <!-- non-default value -->
            <param name="psm_fdr" value="0.5" /> <!-- non-default value -->
            <param name="protein_fdr" value="0.4" /> <!-- non-default value -->
            <section name="protein_quant">
                <param name="peptides_for_quantification" value="0"/><!-- non-default value -->
                <conditional name="only_unmod_prot">
                    <param name="unmod_prot" value="True"/>
                    <param name="mods_used_prot_quant" value="Pro5,Pro6"/>
                </conditional>
            </section>
            <repeat name="paramGroups">
                <param name="files" value="BSA_min_23.mzXML"/>
                <param name="variableModifications" value="Oxidation (M)" />
                <param name="fixedModifications" value="" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="reporter_ion_ms3" />
                    <conditional name="iso_labels">
                        <param name="labeling" value="custom" />
                        <repeat name="iso_label">
                            <param name="internallabel" value="TMT2plex-Lys126" />
                            <param name="terminallabel" value="TMT2plex-Nter126" />
                            <param name="tmtlike" value="True" />
                            <param name="cp1" value="6.7" />
                            <param name="cp2" value="3" />
                        </repeat>
                        <repeat name="iso_label">
                            <param name="internallabel" value="TMT2plex-Lys127" />
                            <param name="terminallabel" value="TMT2plex-Nter127" />
                            <param name="tmtlike" value="True" />
                        </repeat>
                    </conditional>
                    <conditional name="filter_by_pif">
                        <param name="filter_pif" value="False"/>
                        <param name="reporter_pif"
                               value="0.6"/> <!-- as filter_pif is False this value will be ignored and 0 used instead -->
                    </conditional>
                </conditional>
            </repeat>
            <repeat name="paramGroups">
                <param name="files" value="BSA_min_22"/>
                <param name="variableModifications" value="" />
                <param name="fixedModifications" value="" />
                <param name="enzymes" value="" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="reporter_ion_ms3"/>
                    <conditional name="iso_labels">
                        <param name="labeling" value="itraq4plex"/>
                    </conditional>
                    <conditional name="filter_by_pif">
                        <param name="filter_pif" value="True"/>
                        <param name="reporter_pif" value="0.8"/> <!-- as filter_pif is True this value is used -->
                    </conditional>
                </conditional>
            </repeat>
            <param name="dry_run" value="True" />
            <param name="output" value="config,mqpar,mzTab" />
            <output name="config" file="06/config.yml" lines_diff="7">
                <assert_contents>
                    <has_text_matching expression="lcmsRunType\: \'Reporter ion MS3\'" />
                </assert_contents>
            </output>
            <output name="mqpar" file="06/mqpar.xml" lines_diff="8">
                <assert_contents>
                    <has_text_matching expression=".lcmsRunType.Reporter ion MS3.\/lcmsRunType." />
                </assert_contents>
            </output>
        </test>
        <!-- 4 lfq, testing yaml conf file and mqpar.xml only -->
        <test expect_num_outputs="2">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="bsa.fasta" />
            <param name="identifier_parse_rule" value="^&gt;.*\|(.*)\|.*$" />
            <param name="description_parse_rule" value="^&gt;.*\|.*\|[^ ]+ (.*) OS.*$" />
            <param name="min_unique_pep" value="1" />
            <param name="ibaq" value="True" />
            <param name="ibaqLogFit" value="False" />
            <repeat name="paramGroups">
                <param name="files" value="BSA_min_22"/>
                <param name="maxMissedCleavages" value="1"/>
                <param name="variableModifications" value="Oxidation (M)" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="lfq" />
                </conditional>
            </repeat>
            <param name="dry_run" value="True" />
            <param name="output" value="config,mqpar" />
            <output name="config" file="03/config.yml" lines_diff="2" />
            <output name="mqpar" file="03/mqpar.xml" lines_diff="6" />
        </test>
        <!-- 5  Test for MBR -->
        <test expect_num_outputs="2">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="bsa.fasta" />
            <param name="identifier_parse_rule" value="^&gt;.*\|(.*)\|.*$" />
            <param name="description_parse_rule" value="^&gt;.*\|.*\|[^ ]+ (.*) OS.*$" />
            <param name="min_unique_pep" value="1" />
            <param name="ibaq" value="True" />
            <param name="match_between_runs" value="True" />
            <param name="ibaqLogFit" value="False" />
            <repeat name="paramGroups">
                <param name="files" value="BSA_min_22"/>
                <param name="maxMissedCleavages" value="1"/>
                <param name="variableModifications" value="Oxidation (M)" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="lfq" />
                </conditional>
            </repeat>
            <param name="dry_run" value="True" />
            <param name="output" value="config,mqpar" />
            <output name="config" file="05/config.yml" lines_diff="2">
                <assert_contents>
                    <has_text_matching expression="matchBetweenRuns\: True" />
                </assert_contents>
            </output>
            <output name="mqpar" file="05/mqpar.xml" lines_diff="6">
                <assert_contents>
                    <has_text_matching expression=".matchBetweenRuns.True.\/matchBetweenRuns." />
                </assert_contents>
            </output>
        </test>
        <!-- 6 silac + fractions with experimental design template, testing yaml conf file and mqpar.xml only -->
        <test expect_num_outputs="2">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="bsa.fasta" />
            <param name="identifier_parse_rule" value="&gt;([^\s]*)" />
            <param name="description_parse_rule" value="&gt;(.*)" />
            <param name="template" value="04/exp_design" />
            <repeat name="paramGroups">
                <param name="files" value="BSA_min_23.mzXML,BSA_min_22"/>
                <param name="fixedModifications" value="Carbamidomethyl (C)" />
                <param name="variableModifications" value="Oxidation (M)" />
                <param name="enzymes" value="Trypsin/P" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="silac" />
                    <param name="light_labels" value="Arg6,Lys4" />
                    <param name="heavy_labels" value="Arg10,DimethLys8" />
                </conditional>
            </repeat>
            <param name="dry_run" value="True" />
            <param name="output" value="config,mqpar" />
            <output name="config" file="04/config.yml" lines_diff="2" />
            <output name="mqpar" file="04/mqpar.xml" lines_diff="12" />
        </test>
        <!-- 7 PTXQC Test -->
        <test expect_num_outputs="3">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="tmt_data.fasta" />
            <param name="identifier_parse_rule" value="&gt;([^\s]*)" />
            <param name="description_parse_rule" value="&gt;(.*)" />
            <repeat name="paramGroups">
                <param name="files" value="tmt_data.mzXML"/>
                <param name="variableModifications" value="Oxidation (M)" />
                <param name="fixedModifications" value="" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="reporter_ion_ms2" />
                    <conditional name="iso_labels">
                        <param name="labeling" value="tmt10plex" />
                    </conditional>
                </conditional>
            </repeat>
            <param name="do_it" value="true" />
            <param name="output" value="config,mqpar" />
            <output name="config" file="07/config.yml" lines_diff="2" />
            <!-- high difference due to unconsistant xml formatting in MQ -->
            <output name="mqpar" file="07/mqpar.xml" lines_diff="6" />
            <output name="ptxqc_report">
                <assert_contents>
                    <has_line line="%PDF-1.4"/>
                    <!-- was 50k for older versions, now 88K (for 30-pages) -->
                    <has_size min="40K" max="100K"/>
                </assert_contents>
            </output>
        </test>
        <!-- 8 TMTpro16plex test -->
        <test expect_num_outputs="3">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="tmt_data_16.fasta" />
            <param name="identifier_parse_rule" value="&gt;([^\s]*)" />
            <param name="description_parse_rule" value="&gt;(.*)" />
            <repeat name="paramGroups">
                <param name="files" value="tmt_data.mzXML"/>
                <param name="variableModifications" value="Oxidation (M)" />
                <param name="fixedModifications" value="" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="reporter_ion_ms2" />
                    <conditional name="iso_labels">
                        <param name="labeling" value="tmtpro16plex" />
                    </conditional>
                </conditional>
            </repeat>
            <param name="do_it" value="false" />
            <param name="output" value="config,mqpar,proteinGroups" />
            <output name="config" file="08/config.yml" lines_diff="2" />
            <!-- high difference due to unconsistant xml formatting in MQ -->
            <output name="mqpar" file="08/mqpar.xml" lines_diff="24" />
            <output name="proteinGroups" file="08/combined/txt/proteinGroups.txt" />
        </test>
        <!-- 9 TMTpro18plex test -->
        <test expect_num_outputs="2">
            <param name="ftype" value=".mzxml" />
            <param name="fasta_files" value="tmt_data_18.fasta" />
            <param name="identifier_parse_rule" value="&gt;([^\s]*)" />
            <param name="description_parse_rule" value="&gt;(.*)" />
            <repeat name="paramGroups">
                <param name="files" value="tmt_data_18.mzXML"/>
                <param name="variableModifications" value="Oxidation (M)" />
                <param name="fixedModifications" value="" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="reporter_ion_ms2" />
                    <conditional name="iso_labels">
                        <param name="labeling" value="tmtpro18plex" />
                    </conditional>
                </conditional>
            </repeat>
            <param name="do_it" value="false" />
            <param name="output" value="msmsScans" />
            <output name="msmsScans" file="09/combined/txt/msmsScans.txt">
                <assert_contents>
                    <has_text text="GANDSMMM" />
                </assert_contents>
            </output>
        </test>
        <!-- 10 Thermo RAW file test -->
        <test expect_num_outputs="2">
            <param name="ftype" value=".thermo.raw" />
            <param name="fasta_files" value="bsa.fasta" />
            <param name="identifier_parse_rule" value="^&gt;.*\|(.*)\|.*$" />
            <param name="description_parse_rule" value="^&gt;.*\|.*\|[^ ]+ (.*) OS.*$" />
            <param name="min_unique_pep" value="1" />
            <repeat name="paramGroups">
                <param name="files" value="thermo.raw"/>
                <param name="maxMissedCleavages" value="1"/>
                <param name="variableModifications" value="Oxidation (M)" />
                <conditional name="quant_method">
                    <param name="select_quant_method" value="lfq" />
                </conditional>
            </repeat>
            <param name="output" value="config,mqpar" />
            <output name="config" file="10/config.yml" lines_diff="2" />
            <output name="mqpar" file="10/mqpar.xml" lines_diff="10" />
        </test>
    </tests>

    <help><![CDATA[
MaxQuant is a quantitative proteomics software package designed for analyzing large mass-spectrometric data sets. 

This tool is a wrapper for MaxQuant v@VERSION@. The current version of the wrapper only supports a reduced set of parameters, but another version of the tool that gets its parameters directly from a mqpar.xml file is available, too.

**Input files**

- Thermo raw, mzML, or mzXML files (in parameter group section)

    - The datatype of all files has to be either 'thermo.raw', 'mzml' or 'mzxml'. Make sure to specify the correct datatype either during upload to Galaxy or afterwards (edit attributes --> datatypes)
- Fasta file: specify parse rules according to your fasta file (header). Some examples for different fasta headers:  

                ::

                                            identifier parse rule     description parse rule

                    Uniprot identifier          >.*\|(.*)\|           >.*\|.*\|[^ ]+ (.*) OS

                    NCBI accession              >(gi\|[0-9]*)

                    IPI accession               >IPI:([^\| .]*)

                    Everything after '>'        >(.*)

                    Up to first space           >([^ ]*)

                    Up to first tab character   >([^\t]*)


- Optional files:

    - Tabular file with experimental design template:

        - Currently four columns are needed: Name, Fraction, Experiment and PTM. The headers must have this exact naming. Name and Experiment are abitrary strings, Fraction is an integer or emtpy, PTM is either 'True', 'False' or empty. Consider you uploaded files named File1.mzxml, ..., File5.mzxml. Thermo RAW files are handled differently (see table below). This is a (syntactically) correct experimental design template:

                ::

                    Name     Fraction    Experiment   PTM
                    File1        1          E1       False
                    File2        2          E1       False
                    ghost       234        none
                    File3        3          E1       False
                    File4                   E2       True
                    File5                   E1

        - This is the counter-example with one error per line:

                ::

                    Name     Fraction    Experiment   PTM
                    File1       1           E1        no  (wrong PTM value)
                    File2.mzxml 1           E2            (filename with extension)
                    File3       f3          E1            (fraction not an integer)
                    File4       1                         (missing experiment)
                                                          (File5 missing)

        - However, “.raw” (Thermo) is considered a part of the filename:

                ::

                    Name         Fraction    Experiment   PTM
                    File1.raw        1          E1       False
                    File2.raw        2          E1       False
                    File3.raw        3          E1       False
                    File4.raw        1          E2       False
                    File5.raw        2          E2       False
                    File6.raw        3          E2       False

**Parameter Options**

- Quantitation methods (in section parameter groups)

    - label free (LFQ): Protein intensity will be reported as 'LFQ intensity' columns in the proteinGroups table
    - label based: quantifies MS1 labelled samples ('SILAC', 'Dimethyl', 'ICAT', 'ICPL', 'mTRAQ', '18 O')

        - for two channels: choose options from light and heavy sections
        - for three channels: choose options from light, medium and heavy sections
    - reporter ion ms2/ms3: quantifies conventional isobaric labelling samples. Either use the pre-defined labellings with correction factors set to 0 or specify a custom labelling
- PTXQC quality control: quality control software creates an automatic quality control pdf report 


**Output files**

Different output file options are available, most of them are part of the MaxQuant txt directory.
    ]]></help>
    <expand macro="citations"/>
</tool>