<?xml version="1.0"?>
<macros>
    <xml name="requirements">
        <requirements>
           <requirement type="package" version="1.5.4" >bioconductor-mspurity</requirement>
           <requirement type="package" version="1.4.4" >r-optparse</requirement>
            <yield />
        </requirements>

    </xml>

    <xml name="offsets">
            <param name="minoffset" type="float" label="minoffset" value="0.5"
                    help="Offset to the 'left' for the precursor range e.g. if precursor of interest is
                    100.0 then the range would be from 999.5 to 100.0"/>
        <param name="maxoffset" type="float" label="maxoffset" value="0.5"
                    help="Offset to the 'right' for the precursor range  e.g. if precursor of interest is
                    100.0 then the range would be from 100.0 to 100.5"/>
    </xml>
    <xml name="general_params">

        <param name="ilim" type="float" label="ilim" value="0.05"
                    help="All peaks less than this percentage of the target peak will be removed
                    from the purity calculation, default is 5\% (0.05)"/>

        <param name="iw_norm" type="select" label="Normalisation for isolation efficiency">
                <option value="gauss" >Gaussian</option>
                <option value="rcosine" >Raised cosine</option>
                <option value="QE5"> Calculated from Q-Exactive for +/- 0.5 Da windows </option>
                <option value="none" selected="true" >No normalisation</option>
        </param>

        <conditional name="isotopes">
            <param name="isotopes" type="select" label="Handling of isotopic peaks" >
                <option value="keep" >Keep isotopes in precursor ion purity calculation</option>
                <option value="exclude_default" selected="true" >Exclude C12/C13 isotopes in precursor ion purity calculation</option>
                <option value="user" >Exclude a user supplied list of isotopes in purity calculation</option>
            </param>
            <when value="keep">
            </when>
            <when value="exclude_default">
            </when>
            <when value="user">
                <param name="im" type="data" format="tabular" label="Isotope matrix" help="
                 tabular file composing of columns:
                  ['isotope_id', 'mass diff', 'abundance of isotope', 'ppm tol for mz', 'abundance buffer',
                                  'charge', 'relative atomic mass (int)', 'xflag'].
                The xflag indicates if the larger (mass) isotope is the most abundant or less abundant.
                e.g. for c12 to c13, the c13 is less abundant so we flag as 1 for Li6 to Li7, the Li7 is more abundant
                so we would flag as 0.
                Example row: For C13 isotope (single charge) the row could be [1, 1.003355, 1.07, 4, 0.1, 1, 12, 1]"/>
            </when>
        </conditional>
    </xml>


    <xml name="camera_xcms">
            <param name="camera_xcms" type="select" label="Use CAMERA object or XCMS object from RData?"
               help="Within the RData file there should be either an XCMS object called xset or a CAMERA object called
                      xa (or both). The XCMS object is nested within the CAMERA object so either can be used">
                <option value="xcms" selected="true" >XCMS (xset)</option>
                <option value="camera" >CAMERA (xa)</option>
        </param>
    </xml>


    <xml name="fileload">
            <conditional name="file_load_conditional">
                <param name="file_load_select" type="select" label="Resubmit your dataset"
                       help="Use only if you get a message which say that your original dataset or
                                dataset collection can not be found the server." >
                    <option value="no" >no need</option>
                    <option value="yes" >yes</option>
                </param>
                <when value="no">
                </when>
                <when value="yes">
                    <param name="input" type="data_collection" collection_type="list"  format="mzxml,mzml,mzdata,netcdf"
                           multiple="true" label="File(s) from your history containing your chromatograms"
                           help="Select the dataset collection containing the files that were used
                                 for processing" />
                </when>
        </conditional>
    </xml>

    <xml name="grp_peaklist">
        <conditional name="grp_peaklist_opt">
            <param name="grp_peaklist_opt" type="select" label="Add a different grouped peaklist to database?">
                <option value="yes" >Provide group peaklist </option>
                <option value="no" selected="true">Use default grouped peaklist</option>
            </param>
            <when value="no">
            </when>
            <when value="yes">
                <param type="data" name="grp_peaklist" label="grouped peaklist"
                    help="User supplied grouped peaklist to add to the database (if additional columns required e.g.
                          CAMERA annotations" format="tsv,tabular"/>
            </when>
        </conditional>
    </xml>

    <xml name="citations">
        <citations>
            <citation type="doi">10.1021/acs.analchem.6b04358</citation>
            <yield />
        </citations>
    </xml>

</macros>
