view pileup_to_vcf.xml @ 4:fafa105e5f58

Fix base quality
author Jim Johnson <jj@umn.edu>
date Tue, 19 Mar 2013 13:04:40 -0500
parents d6de2d1f4af9
children 8688e29ba96f
line wrap: on
line source

<tool id="pileup_to_vcf" name="Pileup to VCF" version="2.1">
  <description>Converts a pileup to VCF with filtering</description>
  <command interpreter="python">pileup_to_vcf.py -i $input_file -o $output_file 
    #if $min_cvrg.__str__  != '':
      --min_coverage $min_cvrg 
    #end if
    #if $min_base_qual.__str__  != '':
      --min_base_qual $min_base_qual
    #end if
    #if $min_var_pct.__str__  != '':
      --min_allele_freq $min_var_pct 
    #end if
    #if $depth_as.__str__ != 'None':
      --report_depth $depth_as
    #end if
    $allow_multiples
    $snps_only
    #if $cols.select_order == 'yes' :
      #if $chrom_col.__str__  != '':
        --chrom_col $chrom_col 
      #end if
      #if $pos_col.__str__  != '':
        --pos_col $pos_col 
      #end if
      #if $ref_col.__str__  != '':
        --ref_col $ref_col 
      #end if
      #if $cvrg_col.__str__  != '':
        --coverage_col $cvrg_col 
      #end if
      #if $base_call_col.__str__  != '':
        --base_call_col $base_call_col 
      #end if
      #if $base_qual_col.__str__  != '':
        --base_qual_col $base_qual_col 
      #end if
    #end if
  </command>
  <inputs>
    <param name="input_file" type="data" format="pileup,tabular" label="Source File" optional="false"/>
    <conditional name="cols">
      <param name="select_order" type="select" label="Set column positions for non-standard pileup">
        <option value="no" selected="true">Use the default pileup columns</option>
        <option value="yes">Select the column position that represents each pileup column</option>
      </param>
      <when value="no"/>
      <when value="yes">
        <param name="chrom_col" type="data_column" data_ref="input_file" label="Chromosome Column"/>
        <param name="pos_col" type="data_column" data_ref="input_file" label="Position Column"/>
        <param name="ref_col" type="data_column" data_ref="input_file" label="Reference Base Column"/>
        <param name="cvrg_col" type="data_column" data_ref="input_file" label="Depth Column"/>
        <param name="base_call_col" type="data_column" data_ref="input_file" label="Base Call Column"/>
        <param name="base_qual_col" type="data_column" data_ref="input_file" label="Base Quality Column"/>
      </when>
    </conditional>
    <param name="min_base_qual" type="integer" label="Minimum Base Quality" optional="true" value="20" help="Don't consider a read if the base call quality is below this threshold"/>
    <param name="min_cvrg" type="integer" label="Minimum Coverage Depth" optional="true" value="5" help="Any position below the threshold will be omitted from the resulting VCF"/>
    <param name="min_var_pct" type="float" label="Minimum Frequency of a Specific Allele" option="true" value="0.5" help="If an allele does not meet the minimum frequency it will be omitted from the resulting VCF."/>
    <param name="allow_multiples" type="boolean" truevalue="-m" falsevalue="" chacked="true" label="Allow Multiple Alleles for a Position?" 
           help="Multiple alleles may be output in the VCF if the allowable frequency is below 0.5, otherwise only one will be reported"/>
    <param name="snps_only" type="boolean" truevalue="-s" falsevalue="" chacked="false" label="Only report SNPs, not indels" />
    <param name="depth_as" type="select" label="Report DP and SAF with read coverage of" help="The reported read voverage depth: DP, and the calculation of specific allele frequency (SAF) of variants">
      <option value="source">Read coverage reported in pileup</option>
      <option value="ref" selected="true">Reads at this position that have a base call</option>
      <option value="qual">Reads at this position taht pass the base call quality threshold</option>
      <option value="all">All reads and indels</option>
    </param>
  </inputs>
  <outputs>
    <data format="vcf" metadata_source="input_file" name="output_file" />
  </outputs>
  <stdio>
    <exit_code range="1:"  level="fatal"   description="Bad input dataset" />
  </stdio>
  <tests>
    <test>
      <param name="input_file" ftype="pileup" value="test.pileup" />
      <param name="select_order" value="no"/>
      <param name="min_base_qual" value="0"/>
      <param name="min_cvrg" value="0"/>
      <param name="min_var_pct" value=".1"/>
      <param name="allow_multiples" value="True"/>
      <param name="snps_only" value="False"/>
      <param name="depth_as" value="ref"/>
      <output name="output_file">
        <assert_contents>
            <has_text_matching expression="seq2\t156\t.\tA\tG,AAG\t.\tPASS\t.*" />
            <has_text_matching expression="chr1\t158571283\t.\tA\tC,T\t.\tPASS\t.*" />
        </assert_contents>
      </output>
    </test>
    <test>
      <param name="input_file" ftype="pileup" value="test.pileup" />
      <param name="select_order" value="no"/>
      <param name="min_base_qual" value="20"/>
      <param name="min_cvrg" value="5"/>
      <param name="min_var_pct" value=".1"/>
      <param name="allow_multiples" value="True"/>
      <param name="snps_only" value="False"/>
      <param name="depth_as" value="ref"/>
      <output name="output_file">
        <assert_contents>
            <has_text_matching expression="seq2\t156\t.\tA\tG,AAG\t.\tPASS\t.*" />
            <has_text_matching expression="chr1\t158571283\t.\tA\tC\t.\tPASS\t.*" />
        </assert_contents>
      </output>
    </test>

  </tests>
  <help>
    Pileup to VCF converts the output of a pileup tool to a VCF representing any alleles that surpass a user specified frequency, optionally presenting multiple alleles for a given position if the allele frequency is set below 0.5.  This tool assumes that any filtering for base call quality and mapping quality has been done in previous processing.
  </help>
</tool>