view consolidate_vcfs.xml @ 1:4c249c0aebad draft default tip

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

<tool id="consolidate_vcfs" name="Consolidate VCFs" version ="@VERSION@+galaxy1">
  <description>combine freebayes and mpileup files for use by vcf2snvalignment</description>
  <macros>
    <import>macros.xml</import>
  </macros>
  <expand macro="requirements"/>
  <command detect_errors="exit_code"><![CDATA[

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

        #if $freebayes.metadata.bcf_index:
          ln -s '${$freebayes.metadata.bcf_index}' ${name}.csi &&
        #else
	  bcftools index $name &&
	#end if


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

        #if $mpileup.metadata.bcf_index:
          ln -s '${$mpileup.metadata.bcf_index}' ${name}.csi &&
        #else
	  bcftools index $name &&
	#end if

	## If there is no density filtering performed we still need to output an empty file
	#if not $use_density_filter:
	  echo '#No density filtering' > '$filtered_density' &&
	#end if

        consolidate_vcfs.pl


        -c "$coverage"
      	--min-mean-mapping "$mean_mapping"
      	--snv-abundance-ratio "$snv_abundance_ratio"

        #set $path = str($freebayes).split('/')[-1]
        --vcfsplit "$path"

        #set $path = str($mpileup).split('/')[-1]
        --mpileup "$path"

        #if not $use_density_filter:
          --skip-density-filter
        #else
          #if $filtered_density:
            --filtered-density-out '$filtered_density'
          #end if

          #if $window_size:
            --window-size "$window_size"
          #end if
          #if $threshold:
            --density-threshold "$threshold"
          #end if
        #end if

        ##mark where the output files will be sent to, simply have to match them up later in the xml output section
        -o $bcf_combined

  ]]>
  </command>
  <inputs>
    <param name="coverage" type="integer" value="15" label="Minimum coverage" help="(--coverage-cutoff)" />
    <param name="mean_mapping" type="integer" value="30" label="Minimum mean mapping quality" help="(--min-mean-mapping)" />
    <param name="snv_abundance_ratio" type="text" value="0.75" optional="false" label="SNV abundance ratio" help="(--snv-abundance-ratio)" />
    <param name="freebayes" type="data" label="FreeBayes filtered BCF" optional="false" format="bcf_bgzip,bcf" help="(--vcfsplit)" />
    <param name="mpileup" type="data" label="Mpileup BCF" optional="false" format="bcf_bgzip,bcf" help="(--mpileup)" />
    <param name="use_density_filter" type="boolean" checked="true" label="Apply SNV density filtering" help="(--skip-density-filter)" />
    <param name="window_size" type="integer" min="1" label="SNV Density Filtering: Size of search window" format="" optional="false" value="500"
      help="(--window-size) Size of the search window used to find high-density SNV regions. Only valid if density filtering is enabled." />
    <param name="threshold" type="integer" min="1" label="SNV Density Filtering: Density threshold cutoff" format="" optional="false" value="2"
      help="(--density-threshold) The SNV threshold within a window to determine of this is a high-density SNV region. Only valid if density filtering is enabled." />
  </inputs>
  <outputs>
    <data format="bcf_bgzip" name="bcf_combined"/>
    <data format="txt" name="filtered_density" label="High density regions"/>
  </outputs>
  <tests>
    <test>
      <param name="coverage" value="5"/>
      <param name="freebayes" value="freebayes/v1.bcf" />
      <param name="mpileup" value="mpileup/v1.bcf" />
      <param name="mean_mapping" value="30" />
      <param name="snv_abundance_ratio" value="0.75" />
      <param name="use_density_filter" value="true" />
      <param name="window_size" value="500" />
      <param name="threshold" value="2" />
      <output name="bcf_combined" file="v1.bcf.gz" compare="sim_size" delta="500"/>
      <output name="filtered_density" file="expected_regions_empty.txt"/>
    </test>
    <test>
      <param name="coverage" value="5"/>
      <param name="freebayes" value="freebayes/v2.bcf" />
      <param name="mpileup" value="mpileup/v2.bcf" />
      <param name="mean_mapping" value="30" />
      <param name="snv_abundance_ratio" value="0.75" />
      <param name="use_density_filter" value="true" />
      <param name="window_size" value="500" />
      <param name="threshold" value="2" />
      <output name="bcf_combined" file="v2.bcf.gz" compare="sim_size" delta="500"/>
      <output name="filtered_density" file="expected_regions_empty.txt"/>
    </test>
    <test>
      <param name="coverage" value="5"/>
      <param name="freebayes" value="freebayes/v3.bcf" />
      <param name="mpileup" value="mpileup/v3.bcf" />
      <param name="mean_mapping" value="30" />
      <param name="snv_abundance_ratio" value="0.75" />
      <param name="use_density_filter" value="true" />
      <param name="window_size" value="10" />
      <param name="threshold" value="3" />
      <output name="bcf_combined" file="v3.bcf.gz" compare="sim_size" delta="250"/>
      <output name="filtered_density" file="expected_regions_v3.txt"/>
    </test>
    <test>
      <param name="coverage" value="5"/>
      <param name="freebayes" value="freebayes/v3.bcf" />
      <param name="mpileup" value="mpileup/v3.bcf" />
      <param name="mean_mapping" value="30" />
      <param name="snv_abundance_ratio" value="0.75" />
      <param name="use_density_filter" value="true" />
      <param name="window_size" value="10" />
      <param name="threshold" value="4" />
      <output name="bcf_combined" file="v3.bcf.gz" compare="sim_size" delta="250"/>
      <output name="filtered_density" file="expected_regions_empty.txt"/>
    </test>
    <test>
      <param name="coverage" value="5"/>
      <param name="freebayes" value="freebayes/v3.bcf" />
      <param name="mpileup" value="mpileup/v3.bcf" />
      <param name="mean_mapping" value="30" />
      <param name="snv_abundance_ratio" value="0.75" />
      <param name="window_size" value="1" />
      <param name="threshold" value="2" />
      <output name="bcf_combined" file="v3.bcf.gz" compare="sim_size" delta="250"/>
      <output name="filtered_density" file="expected_regions_empty.txt"/>
    </test>
    <test>
      <param name="coverage" value="5"/>
      <param name="freebayes" value="freebayes/v3.bcf" />
      <param name="mpileup" value="mpileup/v3.bcf" />
      <param name="mean_mapping" value="30" />
      <param name="snv_abundance_ratio" value="0.75" />
      <param name="use_density_filter" value="false" />
      <param name="window_size" value="10" />
      <param name="threshold" value="3" />
      <output name="bcf_combined" file="v3.bcf.gz" compare="sim_size" delta="250"/>
      <output name="filtered_density" file="expected_regions_disabled.txt"/>
    </test>
  </tests>

  <help>
  Merges variant and non-variant calls (in VCF format) produced from two independent base callers, FreeBayes, and SAMtools/BCFtools. Produces a merged set of high-quality variant and non-variant calls (in BCF format).  Optionally, produces a list of SNV-dense regions above the passed thresholds.
  </help>
  <expand macro="citations"/>
</tool>