<tool id="discosnp_pp" name="DiscoSnp++" version="@TOOL_VERSION@+galaxy1" profile="@PROFILE@">
    <description>is an efficient tool for detecting SNPs without a reference genome.</description>
    <macros>
        <token name="@TOOL_VERSION@">2.5.4</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="discosnp_requirements" />
    <command detect_errors="exit_code"><![CDATA[
        #if str($input_type_options.input_type) == "single":
            @discosnp_single_for@
            @single_reads@
            @discosnp_single_end_for@
        #else if str($input_type_options.input_type) == "paired":
            @discosnp_paired_for@
            @paired_reads@
            @discosnp_paired_end_for@
        #else:
            @discosnp_single_for@
            @single_reads@
            @discosnp_single_end_for@
            @discosnp_paired_for@
            @paired_reads@
            @discosnp_paired_end_for@
        #end if
        #if str($VCF_option.mapping) == 'reference':
            #set $reference_file = os.path.basename(str($VCF_option.G)) + "." + $VCF_option.G.ext
            ln -sf '${VCF_option.G}' '${reference_file}' &&
        #end if
        run_discoSnp++.sh
        @discosnp_inputs@
        ${T}
        -b ${b}
        #if str($VCF_option.mapping) == 'reference':
            -G '${reference_file}'
            ${VCF_option.R}
        #end if
        --max_threads \${GALAXY_SLOTS:-1}
  ]]></command>
  <inputs>
      <expand macro="discosnp_inputs" />
      <param argument="-b" type="select" label="Branching strategy">
          <option value="0">variants for which any of the two paths is branching are discarded</option>
          <option value="1">forbid SNPs for wich the two paths are branching</option>
          <option value="2">No limitation on branching</option>
      </param>
      <expand macro="discosnp_options" />
      <param argument="-T" type="boolean" checked="false" truevalue="-T" falsevalue="" label="Extends each polymorphism with left and right contigs" />
      <conditional name="VCF_option" >
          <param name="mapping" type="select" label="VCF option">
              <option value="default">Do not use reference genome</option>
              <option value="reference">Mapping with a reference genome</option>
          </param>
          <when value="default"></when>
          <when value="reference">
              <param argument="-G" type="data" format="fasta,fasta.gz,fastq,fastq.gz" label="Reference genome file" />
              <param argument="-R" type="boolean" truevalue="-R" falsevalue="" checked="false" label="Use the reference genome also in the variant calling, not only for mapping results" />
          </when>
      </conditional>
  </inputs>
  <outputs>
      <data name="vcf" from_work_dir="*_coherent.vcf" format="vcf" label="${tool.name} on ${on_string}: VCF"/>
      <data name="fasta" from_work_dir="*_coherent.fa" format="fasta" label="${tool.name} on ${on_string}: FASTA"/>
  </outputs>
  <tests>
      <test>
          <conditional name="input_type_options">
              <param name="input_type" value="single"/>
              <param name="list_reads" value="discosnp/reads1.gz,discosnp/reads2.gz" ftype="fasta.gz" />
          </conditional>
          <param name="k" value="25"/>
          <output name="fasta" file="discosnp/multifasta.fa"/>
          <output name="vcf" file="discosnp/vcf_file.vcf" compare="diff" lines_diff="2"/>
      </test>
      <test>
          <conditional name="input_type_options">
              <param name="input_type" value="paired"/>
              <param name="list_paired_reads">
                  <collection type="list:paired">
                      <element name="Pair1">
                          <collection type="paired">
                              <element name="forward" value="discosnp/reads1.gz" ftype="fasta.gz"/>
                              <element name="reverse" value="discosnp/reads2.gz" ftype="fasta.gz"/>
                          </collection>
                      </element>
                  </collection>
              </param>
          </conditional>
          <conditional name="VCF_option">
              <param name="mapping" value="reference"/>
              <param name="G" value="discosnp/reads1.gz" ftype="fasta.gz"/>
          </conditional>
          <output name="fasta" file="discosnp/multifasta_paired.fa"/>
          <output name="vcf" file="discosnp/vcf_file_paired.vcf" compare="diff" lines_diff="2"/>
      </test>
  </tests>
  <help><![CDATA[

**Description**

Software discoSnp is designed for discovering Single Nucleotide Polymorphism (SNP) from raw set(s) of reads obtained with Next Generation Sequencers (NGS).

Note that number of input read sets is not constrained, it can be one, two, or more. Note also that no other data as reference genome or annotations are needed.

The software is composed by two modules. First module, kissnp2, detects SNPs from read sets. A second module, kissreads, enhance the kissnp2 results by computing per read set  and for each found SNP i/ its mean read coverage and ii/ the (phred) quality of reads generating the polymorphism.

Note that from release of DiscoSnp++-2.0.6, the tool also detects close SNPs and indels.

@discosnp_help@

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