view searchgui.xml @ 1:fa76abf69433 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/peptideshaker commit e09348a0c372d4355c5dda6519e52ff17e0e8621-dirty
author jjohnson
date Fri, 08 Jun 2018 15:58:53 -0400
parents 8b99cb00e1c4
children eea7e945f479
line wrap: on
line source

<tool id="search_gui" name="Search GUI" version="@SEARCHGUI_VERSION@.0">
    <description>
        Perform protein identification using various search engines and prepare results for input to Peptide Shaker
    </description>
    <macros>
        <import>macros_basic.xml</import>
    </macros>
    <requirements>
	<requirement type="package" version="@SEARCHGUI_VERSION@">searchgui</requirement>
	<requirement type="package" version="3.0">zip</requirement>
    </requirements>
    <expand macro="stdio" />
    <command>
<![CDATA[
        #from datetime import datetime
        #import json
        #import os
        #set $exp_str = "Galaxy_Experiment_%s" % datetime.now().strftime("%Y%m%d%H%M%s")
        #set $samp_str = "Sample_%s" % datetime.now().strftime("%Y%m%d%H%M%s")
        #set $temp_stderr = "searchgui_stderr"
        #set $bin_dir = "bin"

        mkdir output;
        mkdir output_reports;
        cwd=`pwd`;
        export HOME=\$cwd;

        ## echo the search engines to run
        echo '$search_engines_options.engines';

        ##Create a searchgui.properties file for the version, which will be added to the searchgui_results if not already present
        echo "searchgui.version=@SEARCHGUI_VERSION@" >> searchgui.properties;

        #for $mgf in $peak_lists:
            #set $input_name = $mgf.display_name.split('/')[-1].replace(".mgf", "") + ".mgf"
            ln -s -f '${mgf}' '${input_name}';
            #set $encoded_id = $__app__.security.encode_id($mgf.id)
            echo 'Spectrums:${mgf.display_name}(API:${encoded_id}) ';
        #end for

        ## copy the input .par file to the working folder
        cp '${input_zip}' './input_par_fasta.zip';
        echo '-.zip source file:';
        echo '${input_zip}';


        ## Necessary for executing tests. Specific par files need to be uncompressed to be used by the tool.
        jar xvf './input_par_fasta.zip' 'Identification_Parameters_default.par' 'searchgui_tinydb1_concatenated_target_decoy.fasta';
        jar xvf './input_par_fasta.zip' Identification_Parameters_specific.par searchgui_tinydb1_concatenated_target_decoy.fasta;
        if [ -f ./Identification_Parameters_default.par ];then
            mv ./Identification_Parameters_default.par ./SEARCHGUI_IdentificationParameters.par;
        fi;
        if [ -f ./Identification_Parameters_specific.par ];then
            mv './Identification_Parameters_specific.par' './SEARCHGUI_IdentificationParameters.par';
        fi;

        ## By default we will always try to uncompress SEARCHGUI_IdentificationParameters.par and input_database.fasta
        jar xvf './input_par_fasta.zip' SEARCHGUI_IdentificationParameters.par input_database.fasta;


        ################
        ## Search CLI ##
        ################
        (searchgui -Djava.awt.headless=true eu.isas.searchgui.cmd.SearchCLI
            --exec_dir="\$cwd/${bin_dir}"
            -temp_folder `pwd`
            -spectrum_files \$cwd
            -output_folder \$cwd/output
            -id_params ./SEARCHGUI_IdentificationParameters.par

            -threads "\${GALAXY_SLOTS:-12}"

            #if $searchgui_advanced.searchgui_advanced_selector == 'advanced'
                -correct_titles "${searchgui_advanced.correct_titles}"
                $searchgui_advanced.missing_titles
                -mgf_splitting "${searchgui_advanced.mgf_splitting}"
                -mgf_spectrum_count "${searchgui_advanced.mgf_spectrum_count}"
            #end if

            ## Turn of the protein tree generation as it can produce errors if the search is finished before the tree is created
            ## the tree is generated afterwards in PeptideShaker
            ## -protein_index 0

            ##-makeblastdb_folder \$BLAST_ROOT_DIR

            #set $engines_list = str($search_engines_options.engines).split(',')
            #if 'X!Tandem' in $engines_list:
                -xtandem 1
            #else
                -xtandem 0
            #end if

            #if 'MyriMatch' in $engines_list:
                -myrimatch 1
            #else
                -myrimatch 0
            #end if

            #if 'MSGF' in $engines_list:
                -msgf 1
            #else
                -msgf 0
            #end if

            #if 'OMSSA' in $engines_list:
                -omssa 1
            #else
                -omssa 0
            #end if

            #if 'Comet' in $engines_list:
                -comet 1
            #else
                -comet 0
            #end if

            #if 'Tide' in $engines_list:
                -tide 1
            #else
                -tide 0
            #end if

            #if 'MS_Amanda' in $engines_list:
                -ms_amanda 1
            #else
                -ms_amanda 0
            #end if

            #if 'Andromeda' in $engines_list:
                -andromeda 1
            #else
                -andromeda 0
            #end if

            #if 'Novor' in $engines_list:
                -novor 1
            #else
                -novor 0
            #end if

            #if 'DirecTag' in $engines_list:
                -directag 1
            #else
                -directag 0
            #end if

            ## single zip file
            -output_option 0

            ## mgf and database in output
            -output_data 1

        2>> $temp_stderr)

        &&

        (mv output/searchgui_out.zip searchgui_out.zip 2>> $temp_stderr)

        &&

        (zip -u searchgui_out.zip searchgui.properties 2>> $temp_stderr);

        exit_code_for_galaxy=\$?;
        cat $temp_stderr 2>&1;
        (exit \$exit_code_for_galaxy)
]]>
    </command>
    <inputs>
        <param format="zip" name="input_zip" type="data" label="Identification Parameters and fasta file"
          help="Select a zip file with Identification Parameters (.par) and a fasta file from history"/>

        <param name="peak_lists" format="mgf" type="data" multiple="true" label="Input Peak Lists (mgf)"
            help="Select appropriate MGF dataset(s) from history" />

        <!-- Search Engine Selection -->
        <section name="search_engines_options" expanded="true" title="Search Engine Options">
            <param name="engines" type="select" display="checkboxes" multiple="True" label="DB-Search Engines">
                <help>Comet and Tide shouldn't both be selected since they use a similar algoritm.</help>
                <option value="X!Tandem" selected="True">X!Tandem</option>
                <option value="MSGF" selected="True">MS-GF+</option>
                <option value="OMSSA" selected="True">OMSSA</option>
                <option value="Comet">Comet</option>
                <option value="Tide">Tide</option>
                <option value="MyriMatch">MyriMatch</option>
                <option value="MS_Amanda">MS_Amanda</option>
                <!-- Windows only
                <option value="Andromeda">Andromeda</option>
                -->
                <!-- New with version 3.0
                -->
                <!--working in tests
                -->
                <option value="DirecTag">DirecTag</option>
                <option value="Novor">Novor (Select for non-commercial use only)</option>
                <validator type="no_options" message="Please select at least one output file" />
            </param>
        </section>

        <conditional name="searchgui_advanced">
            <param name="searchgui_advanced_selector" type="select" label="SearchGUI Options">
                <option value="basic" selected="True">Default</option>
                <option value="advanced">Advanced</option>
            </param>
            <when value="basic" />
            <when value="advanced">
            <param name="correct_titles" type="select" label="How should PeptideShaker deal with duplicate spectra?"
                help="Unless you suspect some input files to be genuine duplicates then rename spectra is the safest option">
                <option value="0">no correction</option>
                <option value="1" selected="True">rename spectra</option>
                <option value="2">delete spectra</option>
            </param>

            <param name="missing_titles" type="boolean" checked="false" truevalue="-missing_titles 1" falsevalue="-missing_titles 0"
                label="Add missing spectrum titles" help="(-missing_titles)"/>

            <param name="mgf_splitting" type="integer" value="1000" label="The maximum mgf file size in MB before splitting the mgf"
                help="Choose a smaller value if you are running on a machine with limited memory"/>

            <param name="mgf_spectrum_count" type="integer" value="25000" label="The maximum number of spectra per mgf file when splitting"
                help="Choose a smaller value if you are running on a machine with limited memory"/>
            </when>
        </conditional>

    </inputs>
    <outputs>
        <data name="searchgui_results" format="searchgui_archive" from_work_dir="searchgui_out.zip" label="${tool.name} on ${on_string}" />
    </outputs>
    <tests>

        <!-- Test that specifying non-default search engines works -->
        <test>
            <param name="peak_lists" value="searchgui_tinyspectra1.mgf"/>
          <!--  <param name="input_par" value="Identification_Parameters_specific.par"/>-->
            <param name="input_zip" value="IdentificationParametersAndFastaSpecific.zip" ftype="zip" />
            <param name="engines" value="X!Tandem,MSGF,MyriMatch,OMSSA,Comet"/>
            <output name="searchgui_results" file="tiny_searchgui_result1.zip" ftype="searchgui_archive" compare="sim_size" delta="30000" />
        </test>
        <!-- Test that search works with MSAmanda -->
        <test>
            <param name="peak_lists" value="searchgui_smallspectra.mgf"/>
          <!--  <param name="input_par" value="Identification_Parameters_default.par"/>-->
            <param name="input_zip" value="IdentificationParametersAndFastaDefault.zip" ftype="zip" />
            <param name="engines" value="MS_Amanda"/>
            <output name="searchgui_results" file="smallsearch_result_amandaonly.zip" ftype="searchgui_archive" compare="sim_size" delta="5000" />
        </test>

    </tests>
    <help>
**What it does**

Runs multiple search engines on any number of MGF peak lists using the SearchGUI.

Default:     X! Tandem, OMSSA and MS-GF+ are executed.

Optional:     MyriMatch, MS-Amanda, Comet and Tide can be executed.

    </help>
    <expand macro="citations" />
</tool>