view vcf2snvalignment.xml @ 1:d2096d0c149e draft default tip

"planemo upload for repository https://github.com/phac-nml/snvphyl-galaxy commit 57067916cb7b9c5b65c1da59d4bbb846c3e3af2f"
author nml
date Tue, 23 Jun 2020 10:27:53 -0400
parents 7d66bf698382
children
line wrap: on
line source

<tool id="vcf2snvalignment" name="VCF 2 snvalignment" version="@VERSION@+galaxy1">
  <description>create a snv alignment from multiple merged VCF files</description>
  <macros>
    <import>macros.xml</import>
  </macros>
  <expand macro="requirements"/>
  <command detect_errors="exit_code"><![CDATA[


        #for $f in $vcf_collection.keys#
          #set $name = str($vcf_collection[$f]).split('/')[-1]
          ln -f -s '$vcf_collection[$f]' &&

          #if $vcf_collection[$f].metadata.bcf_index:
	     ln -s '${$vcf_collection[$f].metadata.bcf_index}' ${name}.csi &&
	  #else
	     bcftools index $name &&
	  #end if
        #end for#

        vcf2snv_alignment.pl

        -r "$reference"
        #if str($invalid) != 'None':
              --invalid-pos "$invalid"
        #end if
        -f fasta
        -f phylip
        --numcpus \${GALAXY_SLOTS:-2}
        --fasta "$ref_fasta"

        #for $f in $vcf_collection.keys#
          #set $path = str($vcf_collection[$f]).split('/')[-1]
          --consolidate_vcf "$f=$path"
        #end for#

        #if $strain_list.select_list == "include":
              --include '$strain_list.include'
        #elif $strain_list.select_list == "exclude":
              --exclude '$strain_list.exclude'
        #end if

        ##mark where the output files will be sent to, simply have to match them up later in the xml output section
        -o 'snvalign'
  ]]>
  </command>
  <inputs>
    <param name="reference" type="text"  label="Reference Name" value='reference' />
    <param name="ref_fasta" type="data"  label="Reference Fasta File" format="fasta"/>
    <param name="invalid" type="data"  label="Invalid position file" format="gff,bed" optional="true"/>
    <conditional name="strain_list">
      <param name="select_list" type="select" label="Strain Selecting options">
        <option value="all">Use all strains in collection</option>
        <option value="include">Provide list of subset of strains to only include</option>
        <option value="exclude">Provide list of subset of strains to exclude</option>
      </param>
      <when value="include">
        <param name="include" type="data"  label="List of strains to be include" format="text" optional="false"/>
      </when>
      <when value="exclude">
        <param name="exclude" type="data"  label="List of strains to be excluded" format="text" optional="false"/>
      </when>
      <when value="all"/>
    </conditional>
    <param name="vcf_collection" type="data_collection" label="Combined VCF Files" help="" optional="false" format="bcf,bcf_bgzip" collection_type="list" />
  </inputs>
  <outputs>
    <data format="tabular" name="positions" from_work_dir="snvalign-positions.tsv" />
    <data format="fasta" name="fasta" from_work_dir="snvalign.fasta"/>
    <data format="phylip" name="phylip" from_work_dir="snvalign.phy" />
    <data format="tabular" name="vcf2core" from_work_dir="snvalign-stats.csv" />
  </outputs>
  <tests>
    <test>
      <param name="reference" value="ref"/>
      <param name="ref_fasta" value="reference.fasta"/>
      <param name="vcf_collection">
        <collection type="list">
          <element name="v1" value="consolidate_vcf/v1.bcf.gz"/>
          <element name="v2" value="consolidate_vcf/v2.bcf.gz"/>
        </collection>
      </param>
      <output name="positions" file="expected_positions.tsv"/>
      <output name="fasta" file="expected_fasta.fasta"/>
      <output name="phylip" file="expected_phylip.phy"/>
      <output name="vcf2core" file="expected_stats.csv"/>
    </test>
  </tests>

  <help>
  Produces an alignment of SNVs from the merged variant/non-variant calls produced from the "consolidate_vcfs" tool.
  </help>
  <expand macro="citations"/>
</tool>