view vsnp_statistics.xml @ 0:c21d338dbdc4 draft

Uploaded
author greg
date Tue, 21 Apr 2020 10:19:53 -0400
parents
children 14e29f7d59ca
line wrap: on
line source

<tool id="vsnp_statistics" name="vSNP: statistics" version="1.0.0">
    <description></description>
    <requirements>
        <requirement type="package" version="0.5.1">humanize</requirement>
        <requirement type="package" version="1.16.5">numpy</requirement>
        <requirement type="package" version="0.25.3">pandas</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
#import os
#import re
#set gzipped = 'false'
#set input_type = $input_type_cond.input_type
#set input_idxstats_dir = 'input_idxstats'
#set input_metrics_dir = 'input_metrics'
#set input_reads_dir = 'input_reads'
#set output_dir = 'output'
mkdir -p $input_idxstats_dir &&
mkdir -p $input_metrics_dir &&
mkdir -p $input_reads_dir &&
mkdir -p $output_dir &&
#if str($input_type) == "single":
    #set read_type_cond = $input_type_cond.read_type_cond
    #set read1 = $read_type_cond.read1
    #set read1_identifier = re.sub('[^\s\w\-]', '_', str($read1.element_identifier))
    #if str($read_type_cond.read_type) == "single":
        ln -s '${read1}' '${read1_identifier}' &&
        #if $read1.is_of_type('fastqsanger.gz'):
            #set gzipped = 'true'
        #end if
    #else:
        #set read2 = $read_type_cond.read2
        #set read2_identifier = re.sub('[^\s\w\-]', '_', str($read2.element_identifier))
        ln -s '${read1}' '${read1_identifier}' &&
        ln -s '${read2}' '${read2_identifier}' &&
        #if $read1.is_of_type('fastqsanger.gz') and $read2.is_of_type('fastqsanger.gz'):
            #set gzipped = 'true'
        #end if
    #end if
    #set dbkey = $input_type_cond.vsnp_azc.metadata.dbkey
#else:
    #for $i in $input_type_cond.reads_collection:
        #if $i.is_of_type('fastqsanger.gz'):
            #set gzipped = 'true'
        #end if
        #set filename = $i.file_name
        #set identifier = re.sub('[^\s\w\-]', '_', str($i.element_identifier))
        ln -s $filename $input_reads_dir/$identifier &&
    #end for
    #for $i in $input_type_cond.samtools_idxstats_collection:
        #set filename = $i.file_name
        #set identifier = re.sub('[^\s\w\-]', '_', str($i.element_identifier))
        ln -s $filename $input_idxstats_dir/$identifier &&
    #end for
    #for $i in $input_type_cond.azc_metrics_collection:
        #set dbkey = $i.metadata.dbkey
        #set filename = $i.file_name
        #set identifier = re.sub('[^\s\w\-]', '_', str($i.element_identifier))
        ln -s $filename $input_metrics_dir/$identifier &&
    #end for
#end if
python '$__tool_directory__/vsnp_statistics.py'
--processes $processes
--dbkey '$dbkey'
--gzipped '$gzipped'
#if str($input_type) == "single":
    #if str($read_type_cond.read_type) == "single":
        --read1 '${read1_identifier}'
    #else:
        --read1 '${read1_identifier}'
        --read2 '${read2_identifier}'
    #end if
    --samtools_idxstats '$samtools_idxstats'
    --vsnp_azc '$vsnp_azc'
    --output '$output'
#end if
]]></command>
    <inputs>
        <conditional name="input_type_cond">
            <param name="input_type" type="select" label="Choose the category of the files to be analyzed">
                <option value="single" selected="true">Single files</option>
                <option value="collection">Collections of files</option>
            </param>
            <when value="single">
                <conditional name="read_type_cond">
                    <param name="read_type" type="select" label="Choose the read type">
                        <option value="paired" selected="true">Paired</option>
                        <option value="single">Single</option>
                    </param>
                    <when value="paired">
                        <param name="read1" type="data" format="fastqsanger.gz,fastqsanger" label="Read1 fastq file"/>
                        <param name="read2" type="data" format="fastqsanger.gz,fastqsanger" label="Read2 fastq file"/>
                    </when>
                    <when value="single">
                        <param name="read1" type="data" format="fastqsanger.gz,fastqsanger" label="Read1 fastq file"/>
                    </when>
                </conditional>
                <param name="samtools_idxstats" type="data" format="tabular" label="Samtools idxstats file">
                    <validator type="unspecified_build"/>
                </param>
                <param name="vsnp_azc" type="data" format="tabular" label="vSNP zero coverage metrics file">
                    <validator type="unspecified_build"/>
                </param>
            </when>
            <when value="collection">
                <param name="reads_collection" type="data_collection" format="fastqsanger,fastqsanger.gz" collection_type="list" label="Collection of fastqsanger files"/>
                <param name="samtools_idxstats_collection" type="data_collection" format="tabular" collection_type="list" label="Collection of samtools idxstats files"/>
                <param name="azc_metrics_collection" type="data_collection" format="tabular" collection_type="list" label="Collection of vSNP zero-coverage metrics files"/>
            </when>
        </conditional>
        <param name="processes" type="integer" min="1" max="20" value="8" label="Number of processes for job splitting"/>
    </inputs>
    <outputs>
        <data name="output" format="tabular">
            <filter>input_type_cond['input_type'] == 'single'</filter>
        </data>
        <collection name="output_collection" type="list">
            <discover_datasets pattern="__name__" directory="output" format="tabular" />
            <filter>input_type_cond['input_type'] == 'collection'</filter>
        </collection>
    </outputs>
    <tests>
        <test>
            <param name="read1" value="13-1941-6_S4_L001_R1_600000.fastq.gz" ftype="fastqsanger.gz" dbkey="89"/>
            <param name="read2" value="13-1941-6_S4_L001_R2_600000.fastq.gz" ftype="fastqsanger.gz" dbkey="89"/>
            <param name="samtools_idxstats" value="samtools_idxstats.tabular" ftype="tabular" dbkey="89"/>
            <param name="vsnp_azc" value="add_zc_metrics.tabular" ftype="tabular" dbkey="89"/>
            <output name="output" file="vsnp_statistics.tabular" ftype="tabular" compare="contains"/>
        </test>
    </tests>
    <help>
**What it does**

Accepts a single fastqsanger read, a set of paired reads, or a collections of reads along with associated SAMtools
idxstats and vSNP zero coverage metrics files and extracts information from the files to produce a tabular statistics
dataset that includes total reads, mean read length and quality, reads passing Q30, mapped and unmapped reads, depth
of coverage, good SNP count and more.

**Required options**

 * **Choose the type for files to be analyzed** - select "Single files" or "Collections of files", then select the appropriate history items (single or paired fastqsanger reads or collections of fastqsanger reads and associated idxstats and vSNP zero coverage metrics files) based on the selected option..
 * **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>