view vsnp_get_snps.xml @ 0:ee4ef1fc23c6 draft

Uploaded
author greg
date Tue, 21 Apr 2020 10:14:11 -0400
parents
children 770834ba75e4
line wrap: on
line source

<tool id="vsnp_get_snps" name="vSNP: get SNPs" version="1.0.0">
    <description></description>
    <requirements>
        <requirement type="package" version="0.25.3">pandas</requirement>
        <requirement type="package" version="0.6.8">pyvcf</requirement>
        <requirement type="package" version="1.2.0">xlrd</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
#import os
#set input_vcf_dir = 'input_vcf_dir'
#set input_zc_vcf_type = $input_zc_vcf_type_cond.input_zc_vcf_type
#set output_json_avg_mq_dir = 'output_json_avg_mq_dir'
#set output_json_snps_dir = 'output_json_snps_dir'
#set output_snps_dir = 'output_snps_dir'
mkdir -p $input_vcf_dir &&
mkdir -p $output_json_avg_mq_dir &&
mkdir -p $output_json_snps_dir &&
mkdir -p $output_snps_dir &&
#set reference = '?'
#for $i in $input_vcf_collection:
    #set reference = $i.metadata.dbkey
    #set filename = $i.file_name
    #set name = $i.name
    ln -s $filename $input_vcf_dir/$name &&
#end for
#if str($input_zc_vcf_type) == "single":
    #set input_zc_vcf = $input_zc_vcf_type_cond.input_zc_vcf
    #set file_name_base = $os.path.basename($input_zc_vcf.file_name)
    ln -s $input_zc_vcf $input_vcf_dir/$file_name_base &&
#else
    #for $i in $input_zc_vcf_type_cond.input_zc_vcf_collection:
        #set filename = $i.file_name
        #set name = $i.name
        ln -s $filename $input_vcf_dir/$name &&
    #end for
#end if
#if str($excel_grouper_cond.excel_grouper) == "yes":
    #set excel_grouper_source = $excel_grouper_cond.excel_grouper_source_cond.excel_grouper_source
    #if str($excel_grouper_source) == "cached":
        #set excel_fields = $__app__.tool_data_tables['vsnp_excel'].get_fields()
        #for $i in $excel_fields:
            #if str($i[0]) == $reference:
                #set excel_file = $i[2]
                #break
            #end if
        #end for
    #else:
        #set excel_file = $excel_grouper_cond.excel_grouper_source_cond.excel_grouper_file
    #end if
#end if
python '$__tool_directory__/vsnp_get_snps.py'
--processes $processes
--reference '$reference'
#if str($excel_grouper_cond.excel_grouper) == "yes":
    --excel_grouper_file '$excel_file'
#end if
#if str($all_isolates) == "Yes":
    --all_isolates '$all_isolates'
#end if
--output_summary '$output_summary'
]]></command>
    <inputs>
        <conditional name="input_zc_vcf_type_cond">
            <param name="input_zc_vcf_type" type="select" label="Choose the category of the files to be analyzed">
                <option value="single" selected="true">A single zero coverage VCF file</option>
                <option value="collection">A collection of zero coverage VCF files</option>
            </param>
            <when value="single">
                <param name="input_zc_vcf" type="data" format="vcf" label="Zero coverage VCF file">
                    <validator type="unspecified_build"/>
                </param>
            </when>
            <when value="collection">
                <param name="input_zc_vcf_collection" format="vcf" type="data_collection" collection_type="list" label="Collection of zero coverage VCF files">
                    <validator type="unspecified_build"/>
                </param>
            </when>
        </conditional>
        <param name="input_vcf_collection" format="vcf" type="data_collection" collection_type="list" label="Collection of VCF files against which to analyze the zero coverages VCF file(s)">
            <validator type="unspecified_build"/>
        </param>
        <conditional name="excel_grouper_cond">
            <param name="excel_grouper" type="select" label="Use Excel file for grouping and filtering?">
                <option value="yes" selected="true">Yes</option>
                <option value="no">No</option>
            </param>
            <when value="yes">
                <conditional name="excel_grouper_source_cond">
                    <param name="excel_grouper_source" type="select" label="Choose the source for the Excel file">
                        <option value="cached">locally cached</option>
                        <option value="history">from history</option>
                    </param>
                    <when value="cached">
                        <param name="excel_grouper_file" type="select" label="Excel file" help="Selection will be overridden if it does not match the dbkeys associated with the collection of VCF files being analyzed">
                            <options from_data_table="vsnp_excel"/>
                            <validator type="no_options" message="No built-in Excel grouping and filtering datasets are available"/>
                        </param>
                    </when>
                    <when value="history">
                        <param name="excel_grouper_file" type="data" format="xlsx" label="Excel file">
                            <validator type="no_options" message="The current history does not include an xlsx dataset that can be used for grouping and filtering"/>
                        </param>
                    </when>
                </conditional>
            </when>
            <when value="no"/>
        </conditional>
        <param name="all_isolates" type="select" display="radio" label="Create table with all isolates?">
            <option value="No" selected="true">No</option>
            <option value="Yes">Yes</option>
        </param>
        <param name="processes" type="integer" min="1" max="20" value="8" label="Number of processes for job splitting"/>
    </inputs>
    <outputs>
        <collection name="snps" type="list" label="${tool.name} (SNPs) on ${on_string}">
            <discover_datasets pattern="__name__" directory="output_snps_dir" format="fasta" />
        </collection>
        <collection name="json_avg_mq" type="list" label="${tool.name} (average MQ) on ${on_string}">
            <discover_datasets pattern="__name__" directory="output_json_avg_mq_dir" format="json" />
        </collection>
        <collection name="json_snps" type="list" label="${tool.name} (SNPs as json) on ${on_string}">
            <discover_datasets pattern="__name__" directory="output_json_snps_dir" format="json" />
        </collection>
        <data name="output_summary" format="html" label="${tool.name} (summary) on ${on_string}"/>
    </outputs>
    <tests>
        <test>
            <param name="input_zc_vcf" value="input_zc_vcf.vcf" ftype="vcf" dbkey="89"/>
            <param name="input_vcf_collection">
                <collection type="list">
                    <element name="SRR8073662_zc.vcf" value="SRR8073662_zc.vcf" dbkey="89"/>
                    <element name="SRR1792272_zc.vcf" value="SRR1792272_zc.vcf" dbkey="89"/>
                </collection>
            </param>
            <param name="excel_grouper" value="no"/>
            <output_collection name="snps" type="list">
                <element name="all_vcf.fasta" file="all_vcf.fasta" ftype="fasta" compare="contains"/>
            </output_collection>
            <output_collection name="json_avg_mq" type="list">
                <element name="all_vcf.json" file="json_avg_mq_all_vcf.json" ftype="json" compare="contains"/>
            </output_collection>
            <output_collection name="json_snps" type="list">
                <element name="all_vcf.json" file="json_all_vcf.json" ftype="json" compare="contains"/>
            </output_collection>
            <output name="output_summary" file="output_summary.html" ftype="html" compare="contains"/>
        </test>
    </tests>
    <help>
**What it does**

Accepts a zero-coverage VCF file (or a collection of them) produced by the **vSNP: add zero coverage** tool
along with a collection of VCF files that have been aligned with the same reference. The inputs are analyzed
to discover quality parsimonious SNPs in the zero-coverage VCF file(s).  An Excel spreadsheet containing
specified SNPs can optiomally be used to filter desired SNP positions by group.  Users can choose whether to
select a locally cached Excel spreadsheet or one from their current history.

**Required Options**

 * **Choose the category of the files to be analyzed** - select single file or a collection of files, then select the appropriate history item (single VCF item or dataset collection of VCF elements) based on the selected option.
 * **Collection of VCF files against which to analyze the zero coverages VCF file(s)**  - select a dataset collection from the current history that is associated with the same reference as the selected zero-coverage VCF file(s).

**Additional Options**

 * **Use Excel file for grouping and filtering?** - select Yes to filter desired SNP positions by group.  A cached Excel spreadsheet provides the most widely used SNP positions for grouping, but a custom spreadhseet can be selected from the current history.
 * **Job Resource Parameters** - an administrator for the Galaxy instance must configure this tool to display this option, so it may not be available.  If it is, you can choose the number of processors to use for tool execution.
 * **Number of processes for job splitting** - Select the number of processes for splitting the job to shorten execution time.
</help>
    <citations>
        <citation type="bibtex">
            @misc{None,
            journal = {None},
            author = {1. Stuber T},
            title = {Manuscript in preparation},
            year = {None},
            url = {https://github.com/USDA-VS/vSNP},}
        </citation>
    </citations>
</tool>