view bio_hansel.xml @ 9:4654c51dae72 draft default tip

planemo upload for repository https://github.com/phac-nml/bio_hansel commit a7add3a4ffc9275f78d4583aac1ef3281c0def21
author nml
date Wed, 09 May 2018 15:06:32 -0400
parents e9fd173fc7ee
children
line wrap: on
line source

<tool id="bio_hansel" name="bio_hansel" version="2.0.0">
  <description>SNV subtyping of genome sequence reads or assemblies</description>
  <requirements>
    <requirement type="package" version="2.0.0">bio_hansel</requirement>
  </requirements>
  <command detect_errors="exit_code">
<![CDATA[

#import re

#def is_gzipped_fastq($data_input)
  ## Is FASTQ data param gzipped type? i.e. either 'fastq.gz' or 'fastqsanger.gz'?
  #return $data_input.is_of_type('fastqsanger.gz') or $data_input.is_of_type('fastq.gz')
#end def

#def get_fastq_ext($data_input)
  ## Get file extension for FASTQ data param
  #return '.fastq.gz' if $is_gzipped_fastq($data_input) else '.fastq'
#end def

#def base_sample_name($name)
  #if $re.search(r'_R(1|2)', $name):
    #return $re.sub(r'(.+)_R(1|2)([^\.]*)(\..+)', r'\1\3', $name)
  #elif $re.match(r'.+_\d\.', $name):
    #return $re.sub(r'(.+)_(\d)(\..+)', r'\1', $name)
  #else
    #return $name
  #end if
#end def

#def get_paired_fastq_filename($data_input, $name=None, $is_forward=True)
  ## Get paired FASTQ filename for a data param with appropriate file extension 
  ## with '_1' or '_2' appended if forward or reverse reads, respectively.
  #set $name = $name if $name is not None else $data_input.name
  #set $name = $base_sample_name($name)
  #set $postfix = '1' if $is_forward else '2'
  #set $ending = '_{}{}'.format($postfix, $get_fastq_ext($data_input))
  #return '"{}"'.format($name) if $ending in $name else '"{}{}"'.format($name, $ending)
#end def

## Create symlinks from Galaxy *.dat to <sample_name>(.fasta|.fastq|.fastq.gz)
#if $input.type == 'fasta'
#set $input_files = '"{}"'.format($input.fasta.name)
  ln -s "$input.fasta" $input_files &&
#elif $input.type == 'paired'
#set $forward_filename = $get_paired_fastq_filename($input.forward)
#set $reverse_filename = $get_paired_fastq_filename($input.reverse, is_forward=False)
#set $input_files = '{} {}'.format($forward_filename, $reverse_filename)
  ln -s "$input.forward" $forward_filename &&
  ln -s "$input.reverse" $reverse_filename &&
#elif $input.type == 'single'
#set $input_files = '"{}"'.format($input.single.name)
  ln -s "$input.single" $input_files &&
#elif $input.type == 'paired_collection'
#set $forward_filename = $get_paired_fastq_filename($input.paired_collection.forward, $input.paired_collection.name)
#set $reverse_filename = $get_paired_fastq_filename($input.paired_collection.reverse, $input.paired_collection.name, is_forward=False)
#set $input_files = '{} {}'.format($forward_filename, $reverse_filename)
  ln -s "$input.paired_collection.forward" $forward_filename &&
  ln -s "$input.paired_collection.reverse" $reverse_filename &&
#end if

## Checking for custom scheme.
#if $type_of_scheme.scheme_type == "custom":
  #if $type_of_scheme.scheme_input.is_of_type('fasta'):
    ln -s '$type_of_scheme.scheme_input' '$type_of_scheme.scheme_input.name' &&
  #end if
#end if

hansel
  -vvv
  -t "\${GALAXY_SLOTS:-1}"
  -o results.tab
  -O match_results.tab
  -S tech_results.tab
  $dev_args.use_json
  $input_files
  --scheme
#if $type_of_scheme.scheme_type == "custom":
  '$type_of_scheme.scheme_input.name'
#else:
  $type_of_scheme.scheme_type
#end if
#if $kmer_vals.kmer_min
  --min-kmer-freq $kmer_vals.kmer_min
#end if
#if $kmer_vals.kmer_max
  --max-kmer-freq $kmer_vals.kmer_max
#end if
#if $qc_vals.low_cov_depth_freq
  --low-cov-depth-freq $qc_vals.low_cov_depth_freq
#end if
#if $qc_vals.max_missing_tiles
  --max-missing-tiles $qc_vals.max_missing_tiles
#end if
#if $qc_vals.min_ambiguous_tiles
  --min-ambiguous-tiles $qc_vals.min_ambiguous_tiles
#end if
#if $qc_vals.max_intermediate_tiles
  --max-intermediate-tiles $qc_vals.max_intermediate_tiles
#end if
#if $qc_vals.low_coverage_warning
  --low-cov-warning $qc_vals.low_coverage_warning
#end if
]]>
  </command>
  <inputs>
    <conditional name="input">
      <param name="type" type="select" label="Sequence input type">
        <option value="fasta">FASTA</option>
        <option value="paired">Paired-end FASTQs</option>
        <option value="single">Single-end FASTQ</option>
        <option value="paired_collection">Paired-end FASTQ collection</option>
      </param>
      <when value="fasta">
        <param name="fasta"
          type="data" format="fasta"
          optional="false"
          label="FASTA file"
          />
      </when>
      <when value="paired">
        <param name="forward"
          type="data" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz"
          optional="false"
          label="Forward FASTQ file"
          help="Must have ASCII encoded quality scores"
          />
        <param name="reverse"
          type="data" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz"
          optional="false"
          label="Reverse FASTQ file"
          help="File format must match the Forward FASTQ file"
          />
      </when>
      <when value="single">
        <param name="single"
          type="data" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz"
          optional="false"
          label="Single-end FASTQ file"
          />
      </when>
      <when value="paired_collection">
        <param name="paired_collection"
          type="data_collection" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz,txt"
          collection_type="paired"
          optional="false"
          label="Paired-end FASTQ collection"
          help=""
          />
      </when>
    </conditional>
    <conditional name="type_of_scheme">
      <param name="scheme_type" type="select" label="Specify scheme to use. (Heidelberg is default)">
        <option value="heidelberg">Salmonella Heidelberg subtyping scheme</option>
        <option value="enteritidis">Salmonella Enteritidis subtyping scheme</option>
        <option value="custom">Specify your own custom scheme</option>
      </param>
      <when value="heidelberg"/>
      <when value="enteritidis"/>
      <when value="custom">
        <param name="scheme_input" type="data" format="fasta" label="Scheme Input"/>
      </when>
    </conditional>
    <!-- K-mer frequencies. -->
    <section name="kmer_vals" title="K-mer Frequency Thresholds" expanded="False">
      <param name="kmer_min" type="integer"
        argument="--min-kmer-freq"
        optional="true"
        min="0" value="8"
        label="Min k-mer frequency/coverage"
        help="default = 8"/>
      <param name="kmer_max" type="integer"
        argument="--max-kmer-freq"
        optional="true"
        min="1" value="1000"
        label="Max k-mer frequency/coverage"
        help="default = 1000"/>
    </section>
    <!-- Quality Checking Parameters -->
    <section name="qc_vals" title="Quality Checking Thresholds" expanded="False">
      <param name="low_cov_depth_freq" type="integer"
        argument="--low-cov-depth-freq"
        value="20" min="0"
        optional="true"
        label="QC: Frequency below this coverage are considered low coverage"
        help="default = 20"/>
      <param name="min_ambiguous_tiles" type="integer"
        argument="--min-ambiguous-tiles"
        optional="true"
        value="3" min="0"
        label="QC: Min number of tiles missing for Ambiguous Result"
        help="default = 3"/>
      <param name="max_missing_tiles" type="float"
        argument="--max-missing-tiles"
        optional="true"
        value="0.05" min="0" max="1"
        label="QC: Decimal Proportion of max allowed missing tiles" help="default = 0.05, valid values {0.0 - 1.0}"/>
      <param name="max_intermediate_tiles" type="float"
        argument="--max-intermediate-tiles"
        optional="true"
        value="0.05" min="0" max="1"
        label="QC: Decimal Proportion of max allowed missing tiles for an intermediate subtype"
        help="default = 0.05, valid values {0.0 - 1.0}"/> 
      <param name="low_coverage_warning" type="integer"
        argument="--low-cov-warning"
        optional="true"
        value="20"
        label="QC: Overall tile coverage below this value will trigger a low coverage warning"
        help="default = 20"/> 
    </section>
    <section name="dev_args" title="Developer Options" expanded="False">
      <param name="use_json"
        type="boolean"
        checked="false"
        truevalue="--json"
        falsevalue=""
        label="Output JSON results"
        help="Use this option of you need json representations of analysis' details"/>
    </section>
  </inputs>
  <outputs>
    <data format="tabular" name="results.tab" from_work_dir="results.tab" label="results.tab"/>
    <data format="tabular" name="match_results.tab" from_work_dir="match_results.tab" label="match_results.tab"/>
    <data format="tabular" name="tech_results.tab" from_work_dir="tech_results.tab" label="tech_results.tab"/>
    <data format="json" name="results.json" from_work_dir="results.tab.json" label="results.json">
      <filter>dev_args['use_json']</filter>
    </data>
    <data format="json" name="match_results.json" from_work_dir="match_results.tab.json" label="match_results.json">
      <filter>dev_args['use_json']</filter>
    </data>
    <data format="json" name="tech_results.json" from_work_dir="tech_results.tab.json" label="tech_results.json">
      <filter>dev_args['use_json']</filter>
    </data>
  </outputs>
  <tests>
    <test>
      <conditional name="input">
        <param name="type" value="fasta"/>
        <param name="fasta" value="SRR1002850_SMALL.fasta"/>
      </conditional>
      <param name="type_of_scheme" value="heidelberg"/>
      <output name="results.tab"
        value="SRR1002850_SMALL.fasta-results.tab"
        ftype="tabular"
        compare="sim_size"
        delta="1000">
      </output>
      <output name="match_results.tab"
        value="SRR1002850_SMALL.fasta-match_results.tab"
        ftype="tabular"
        compare="sim_size"
        delta="16000">
      </output>
      <output name="tech_results.tab"
        value="SRR1002850_SMALL.fasta-tech_results.tab"
        ftype="tabular"
        lines_diff="0">
      </output>
    </test>
    <test>
      <conditional name="input">
        <param name="type" value="paired"/>
        <param name="forward" value="SRR5646583_SMALL_1.fastq"/>
        <param name="reverse" value="SRR5646583_SMALL_2.fastq"/>
      </conditional>
      <param name="type_of_scheme" value="heidelberg"/>
      <output name="tech_results.tab"
        value="SRR5646583_SMALL-tech_results.tab"
        ftype="tabular"
        lines_diff="0">
      </output>
      <output name="results.tab"
        value="SRR5646583_SMALL-results.tab"
        ftype="tabular"
        compare="sim_size"
        delta="1000">
      </output>
      <output name="match_results.tab"
        value="SRR5646583_SMALL-match_results.tab"
        ftype="tabular"
        compare="sim_size"
        delta="16000">
      </output>
    </test>
  </tests>
  <help><![CDATA[
***********************************************************
bio_hansel
***********************************************************

Subtype microbial whole-genome sequencing (WGS) data using single-nucleotide variant (SNV) targeting k-mer subtyping schemes.

Includes 33 bp k-mer SNV subtyping schemes for Salmonella enterica subsp. enterica serovar Heidelberg and Enteritidis genomes developed by Genevieve Labbe et al.
 
Usage
=====
1) Enter your FASTA/FASTQ file(s)
2) Select which scheme you would like to use (e.g. heidelberg, enteritidis, or specify your own)
3) Click Execute

For more information visit `https://github.com/phac-nml/bio_hansel`


Example Usage
=============

Analysis of a single FASTA file
-------------------------------


Contents of ``results.tab``:

    +------------------+------------+----------------+-------------+------------------------------------------------+---------------------------------------------------------------+-------------------------+-----------------------+----------------------+-------------------------------+---------------------------+------------------------------------+--------------------------+-----------------------------------+------------------------+-----------+------------+
    | sample           | scheme     | scheme_version | subtype     | all_subtypes                                   | tiles_matching_subtype                                        | are_subtypes_consistent | inconsistent_subtypes | n_tiles_matching_all | n_tiles_matching_all_expected | n_tiles_matching_positive | n_tiles_matching_positive_expected | n_tiles_matching_subtype | n_tiles_matching_subtype_expected | file_path              | qc_status | qc_message |
    +------------------+------------+----------------+-------------+------------------------------------------------+---------------------------------------------------------------+-------------------------+-----------------------+----------------------+-------------------------------+---------------------------+------------------------------------+--------------------------+-----------------------------------+------------------------+-----------+------------+
    | SRR1002850_SMALL | heidelberg | 0.5.0          | 2.2.2.2.1.4 | 2; 2.2; 2.2.2; 2.2.2.2; 2.2.2.2.1; 2.2.2.2.1.4 | 2154958-2.2.2.2.1.4; 1037658-2.2.2.2.1.4; 3785187-2.2.2.2.1.4 | True                    |                       | 202                  | 202                           | 17                        | 17                                 | 3                        | 3                                 | SRR1002850_SMALL.fasta | PASS      |            |
    +------------------+------------+----------------+-------------+------------------------------------------------+---------------------------------------------------------------+-------------------------+-----------------------+----------------------+-------------------------------+---------------------------+------------------------------------+--------------------------+-----------------------------------+------------------------+-----------+------------+


Contents of ``match_results.tab``:

    +---------------------------+-----------------------------------+------------+---------------------------------------+-------------+-------------+-------------+-------------+------------------+------------------------+------------+----------------+-----------+------------+
    | tilename                  | seq                               | is_revcomp | contig_id                             | match_index | refposition | subtype     | is_pos_tile | sample           | file_path              | scheme     | scheme_version | qc_status | qc_message |
    +---------------------------+-----------------------------------+------------+---------------------------------------+-------------+-------------+-------------+-------------+------------------+------------------------+------------+----------------+-----------+------------+
    | 2154958-2.2.2.2.1.4       | GGCGCGCCACGGTTACTCCCCGGTGGTCAGCCG | True       | NODE_1_length_726282_cov_40.4705_ID_1 | 13732       | 2154958     | 2.2.2.2.1.4 | True        | SRR1002850_SMALL | SRR1002850_SMALL.fasta | heidelberg | 0.5.0          | PASS      |            |
    +---------------------------+-----------------------------------+------------+---------------------------------------+-------------+-------------+-------------+-------------+------------------+------------------------+------------+----------------+-----------+------------+
    | negative2131791-2.2.3.1.3 | GCTGGGCGAAATGATGCAGTTCACCACTTGCTC | True       | NODE_1_length_726282_cov_40.4705_ID_1 | 36900       | 2131791     | 2.2.3.1.3   | False       | SRR1002850_SMALL | SRR1002850_SMALL.fasta | heidelberg | 0.5.0          | PASS      |            |
    +---------------------------+-----------------------------------+------------+---------------------------------------+-------------+-------------+-------------+-------------+------------------+------------------------+------------+----------------+-----------+------------+

    *Next 201 lines omitted.*



Analysis of a single FASTQ readset
----------------------------------

Contents of ``results.tab``:

    +------------------+------------+----------------+-------------+------------------------------------------------+------------------------------------------+-------------------------+-----------------------+----------------------+-------------------------------+---------------------------+------------------------------------+--------------------------+-----------------------------------+----------------------------------------------------------+-------------------+-----------+------------+
    | sample           | scheme     | scheme_version | subtype     | all_subtypes                                   | tiles_matching_subtype                   | are_subtypes_consistent | inconsistent_subtypes | n_tiles_matching_all | n_tiles_matching_all_expected | n_tiles_matching_positive | n_tiles_matching_positive_expected | n_tiles_matching_subtype | n_tiles_matching_subtype_expected | file_path                                                | avg_tile_coverage | qc_status | qc_message |
    +------------------+------------+----------------+-------------+------------------------------------------------+------------------------------------------+-------------------------+-----------------------+----------------------+-------------------------------+---------------------------+------------------------------------+--------------------------+-----------------------------------+----------------------------------------------------------+-------------------+-----------+------------+
    | SRR5646583_SMALL | heidelberg | 0.5.0          | 2.2.1.1.1.1 | 2; 2.2; 2.2.1; 2.2.1.1; 2.2.1.1.1; 2.2.1.1.1.1 | 1983064-2.2.1.1.1.1; 4211912-2.2.1.1.1.1 | True                    |                       | 202                  | 202                           | 20                        | 20                                 | 2                        | 2                                 | ['SRR5646583_SMALL_1.fastq', 'SRR5646583_SMALL_2.fastq'] | 42.631            | PASS      |            |
    +------------------+------------+----------------+-------------+------------------------------------------------+------------------------------------------+-------------------------+-----------------------+----------------------+-------------------------------+---------------------------+------------------------------------+--------------------------+-----------------------------------+----------------------------------------------------------+-------------------+-----------+------------+

Contents of ``match_results.tab``:

    +---------------------+-----------------------------------+------+-------------+-----------+-------------+-------------------+------------------+------------+----------------+-----------+------------+
    | tilename            | seq                               | freq | refposition | subtype   | is_pos_tile | is_kmer_freq_okay | sample           | scheme     | scheme_version | qc_status | qc_message |
    +---------------------+-----------------------------------+------+-------------+-----------+-------------+-------------------+------------------+------------+----------------+-----------+------------+
    | negative4642573-1.2 | TACCAGGAAGTGCTGGAAGAGTTTAACGAACAT | 62   | 4642573     | 1.2       | False       | True              | SRR5646583_SMALL | heidelberg | 0.5.0          | PASS      |            |
    +---------------------+-----------------------------------+------+-------------+-----------+-------------+-------------------+------------------+------------+----------------+-----------+------------+
    | 21097-2.2.1.1.1     | GCAAATCGCGCCAGTCAAGTCCTCTTTTACCGT | 42   | 21097       | 2.2.1.1.1 | True        | True              | SRR5646583_SMALL | heidelberg | 0.5.0          | PASS      |            |
    +---------------------+-----------------------------------+------+-------------+-----------+-------------+-------------------+------------------+------------+----------------+-----------+------------+

    *Next 202 lines omitted.*

Galaxy wrapper written by Matthew Gopez and Peter Kruczkiewicz at the Public Health Agency of Canada, National Microbiology Laboratory.

    ]]></help>
  <citations>
    <citation type="bibtex">@ARTICLE{a1,
      title = {A robust genotyping scheme for Salmonella enterica serovar Heidelberg clones circulating in North America},
      author = {Geneviève Labbé, James Robertson, Peter Kruczkiewicz, Marisa Rankin, Matthew Gopez, Chad R. Laing, Philip Mabon, Kim Ziebell, Aleisha R. Reimer, Lorelee Tschetter, Gary Van Domselaar, Sadjia Bekal, Kimberley A. MacDonald, Linda Hoang, Linda Chui, Danielle Daignault, Durda Slavic, Frank Pollari, E. Jane Parmley, Elissa Giang, Lok Kan Lee, Jonathan Moffat, Joanne MacKinnon, Roger Johnson, John H.E. Nash},
      url = {https://github.com/phac-nml/bio_hansel}
      }
    }</citation>
  </citations>
</tool>