view searchgui.xml @ 0:8b99cb00e1c4 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/peptideshaker commit 3c83b8f8ca60d6399bc5dd7096b830ca1f1c457e-dirty
author jjohnson
date Tue, 15 May 2018 14:50:35 -0400
parents
children fa76abf69433
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>
  <requirement type="package">JQ</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



        ## Necessary for executing tests. The FASTA file has to be manually copied from the test-data folder to the working directory in order it can be found when using the PAR file.
        cp '$__tool_directory__/test-data/searchgui_tinydb1_concatenated_target_decoy.fasta' "\$cwd/searchgui_tinydb1_concatenated_target_decoy.fasta";



        ## copy the input .par file to the working folder
        cp "${input_par}" "\$cwd/SEARCHGUI_IdentificationParameters.par";
        echo "-.par source file:";
        echo "${input_par}";

        ## (local) PAR file points to a FASTA file with .dat extension, which gives problems with many search engines. We should rename it to a .fasta file before passing it to SearchGUI
        #set $par_target_path = "$cwd/SEARCHGUI_IdentificationParameters.par";
        echo "-.par target file:";
        echo $par_target_path;

        ## reading from the original .par file the path of the source .dat (fasta) file  to be used
        content_par_target_path=`cat $par_target_path`;
        dat_path=`jq -r '.searchParameters.fastaFile.path' <<< "\$content_par_target_path"`;
        echo "-.dat file path from target .par: ";
        echo "\$dat_path";

        ## copy original .data fasta file to a local .fasta file
        new_fasta_file_path="\$cwd/input_database.fasta";
        cp "\$dat_path" "\$new_fasta_file_path";
        echo "-new .fasta file path copied from source .dat file: ";
        echo "\$new_fasta_file_path";

        ## modifying the .par file!!
        ## First we establish the new content for the path: .searchParameters.fastaFile.path
        new_content_par_target_path=`jq '.searchParameters.fastaFile.path = \$newVal' --arg newVal "\$new_fasta_file_path" <<< "\$content_par_target_path"`;
        ## Secondly, for .proteinInferencePreferences.proteinSequenceDatabase.path
        new_content_par_target_path=`jq '.proteinInferencePreferences.proteinSequenceDatabase.path = \$newVal' --arg newVal "\$new_fasta_file_path" <<< "\$new_content_par_target_path"`;

        ## we generate a new .par file filled with the new fasta path.
        #set $new_par_target_path = "$cwd/SEARCHGUI_IdentificationParameters_new.par";
        echo "\$new_content_par_target_path" >> $new_par_target_path;
        echo "-new par target path: ";
        echo $new_par_target_path;

        ## As PeptideShaker waits for "SEARCHGUI_IdentificationParameters.par" name, we overwrite the original file with the "_new" file
        ##mv "\$cwd/SEARCHGUI_IdentificationParameters_new.par" "\$cwd/SEARCHGUI_IdentificationParameters.par"
        rm $par_target_path;
        mv $new_par_target_path $par_target_path;


        ################
        ## 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 $par_target_path

            -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="par" name="input_par" type="data" label="Identification Parameters file"
          help="Select PAR 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="engines" value="X!Tandem,MSGF,MyriMatch,OMSSA,Comet"/>
            <output name="output" 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="engines" value="MS_Amanda"/>
            <output name="output" 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>