changeset 4:8cdffc02d2e2 draft

planemo upload for repository https://github.com/phac-nml/quasitools commit 19e0f266ee455b82432e2d7b987b35de8c7a14d5
author nml
date Wed, 25 Apr 2018 10:38:00 -0400
parents 8dacd75ca8f1
children b69e898b8109
files aacoverage.xml callaavar.xml callcodonvar.xml callntvar.xml consensus.xml distance.xml dnds.xml drmutations.xml hydra.xml test-data/quasi1.bai test-data/quasi1.bam test-data/quasi2.bai test-data/quasi2.bam
diffstat 13 files changed, 171 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/aacoverage.xml	Mon Mar 26 15:38:19 2018 -0400
+++ b/aacoverage.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -1,7 +1,7 @@
 <tool id="aacoverage" name="Amino Acid Coverage" version="0.1.0">
     <description>Builds an aa census and returns its coverage</description>
     <requirements>
-          <requirement type="package" version="0.2.3">quasitools</requirement>
+          <requirement type="package" version="0.3.1">quasitools</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
 
--- a/callaavar.xml	Mon Mar 26 15:38:19 2018 -0400
+++ b/callaavar.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -1,7 +1,7 @@
 <tool id="aavariants" name="Amino Acid Variants" version="0.1.0">
     <description>Identifies amino acid mutations</description>
     <requirements>
-        <requirement type="package" version="0.2.3">quasitools</requirement>
+        <requirement type="package" version="0.3.1">quasitools</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
 
--- a/callcodonvar.xml	Mon Mar 26 15:38:19 2018 -0400
+++ b/callcodonvar.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -1,7 +1,7 @@
 <tool id="callcodonvar" name="Codon Variants" version="0.1.0">
     <description>Identifies codon variants and non-synonymous/synonymous mutations</description>
     <requirements>
-          <requirement type="package" version="0.2.3">quasitools</requirement>
+          <requirement type="package" version="0.3.1">quasitools</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
 
--- a/callntvar.xml	Mon Mar 26 15:38:19 2018 -0400
+++ b/callntvar.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -1,7 +1,7 @@
 <tool id="callntvar" name="Nucleotide Variants" version="0.1.0">
     <description>Identifies nucleotide variants</description>
     <requirements>
-          <requirement type="package" version="0.2.3">quasitools</requirement>
+          <requirement type="package" version="0.3.1">quasitools</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
     
--- a/consensus.xml	Mon Mar 26 15:38:19 2018 -0400
+++ b/consensus.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -1,7 +1,7 @@
 <tool id="consensus" name="Consensus Sequence" version="0.2.0">
     <description>Generate a consensus sequence from a BAM file</description>
     <requirements>
-          <requirement type="package" version="0.2.3">quasitools</requirement>
+          <requirement type="package" version="0.3.1">quasitools</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/distance.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -0,0 +1,127 @@
+<tool id="distance" name="Quasispecies Distance" version="0.1.0">
+    <description>Calculate the evolutionary distance between viral quasispecies.</description>
+    <requirements>
+          <requirement type="package" version="0.3.1">quasitools</requirement>
+    </requirements>
+    <command detect_errors="exit_code"><![CDATA[
+
+        #for $bam_file in $bam_files
+        ln -s $bam_file '${bam_file.name}' &&
+        ln -s $bam_file.metadata.bam_index '${bam_file.name}.bai' &&
+        #end for
+
+        quasitools distance $ref_file
+
+        #for $bam_file in $bam_files
+        '${bam_file.name}'
+        #end for
+
+        -o matrix.csv
+
+        $normalize
+
+        #if $low_coverage.coverage_selector == 'keep':
+            -k
+        #else if $low_coverage.coverage_selector == 'remove':
+            -r
+        #else if $low_coverage.coverage_selector == 'truncate':
+            -t
+        #end if
+
+        #if $select_range.manual_input == 'select_range':
+            -s $select_range.start
+            -e $select_range.end
+        #end if
+
+        $output_similarity
+
+    ]]></command>
+    <inputs>
+        <param name="ref_file" type="data" format="fasta" optional="false" label="Reference file" />
+        <param name="bam_files" type="data" format="bam" optional="false" multiple="true" label="BAM files" min="2" help="At least two BAM files are required to perform quasispecies distance comparison."/>
+        <param name="normalize" type="boolean" truevalue="-n" falsevalue="-dn" checked="True" label="Normalize pileups" help="Normalize read count data so that the read counts per 4-tuple (A, C, T, G) sum to one."/>
+        <param name="output_similarity" type="boolean" truevalue="-os" falsevalue="-od" checked="False" label="Output cosine similarity instead of angular cosine distance." help="Cosine similarity is not a distance metric." />
+        <conditional name="low_coverage">
+            <param name="coverage_selector" type="select" label="Choose how to treat zero coverage positions.">
+                <option value="remove" selected = "true">Remove all zero coverage positions.</option>
+                <option value="keep">Keep all zero coverage positions.</option>
+                <option value="truncate">Truncate zero coverage positions at start and end of pileup.</option>
+            </param>
+            <when value="remove">
+            </when>
+            <when value="keep">
+            </when>
+            <when value="truncate">
+            </when>
+        </conditional>
+        <conditional name="select_range">
+            <param name="manual_input" type="select" label="Select pileup range." help="Currently only supports selection of custom start and end position for one single reference.">
+                <option value="keep_range" selected = "true">Use original pileup for distance calculation.</option>
+                <option value="select_range">Manually select pileup's start and end position for distance calculation.</option>
+            </param>
+            <when value="select_range">
+                <param name="start" type="integer" optional="false" min="1" value="1" label="Select one-indexed start base position." help="Positions before start position will be ignored in the distance calculation." />
+                <param name="end" type="integer" optional="false" min="1" value="1" label="Select one-indexed end base position." help="Positions after end position will be ignored in the distance calculation." />
+            </when>
+            <when value="keep_range">
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+        <data format="csv" name="matrix" from_work_dir="matrix.csv" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="ref_file" value="hxb2_pol.fas" />
+            <param name="bam_files" value="quasi1.bam,quasi2.bam" />
+            <param name="normalize" value="-n" />
+            <param name="coverage_selector" value="truncate" />
+            <param name="manual_input" value="keep_range" />
+            <param name="output_similarity" value="-od" />
+            <output name="matrix" ftype="csv" >
+                <assert_contents>
+                    <has_text_matching expression="Quasispecies"/>
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+    <help><![CDATA[
+
+Quasispecies Distance
+=====================
+
+Determines the evolutionary distance between viral quasispecies.
+Uses the angular cosine distance function by default.
+
+------
+Inputs
+------
+
+1. FASTA Consensus file
+2. Two or more BAM files (otherwise tool will throw an error)
+
+----------
+Parameters
+----------
+1. Normalize pileup (True or False)
+2. Select custom start and end position. Currently only supports selection of custom start and end position for one single reference.
+3. Choose how to treat zero coverage regions (keep, remove all, or truncate)
+
+-------
+Outputs
+-------
+
+CSV containing distance matrix.
+
+    ]]></help>
+    <citations>
+        <citation type="bibtex">
+            @misc{GitHubquasitoolsdistance,
+            title = {quasitools distance},
+            publisher = {phac-nml},
+            journal = {GitHub repository},
+            url = {https://github.com/phac-nml/quasitools},
+            }
+        </citation>
+    </citations>
+</tool>
--- a/dnds.xml	Mon Mar 26 15:38:19 2018 -0400
+++ b/dnds.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -1,7 +1,7 @@
 <tool id="dnds" name="dNdS Report" version="0.1.0">
     <description>Calculate the dN/dS value for each region in a bed file</description>
     <requirements>
-          <requirement type="package" version="0.2.3">quasitools</requirement>
+          <requirement type="package" version="0.3.1">quasitools</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
 
--- a/drmutations.xml	Mon Mar 26 15:38:19 2018 -0400
+++ b/drmutations.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -1,7 +1,7 @@
 <tool id="drmutations" name="Drug Resistance Mutations" version="0.1.0">
     <description></description>
     <requirements>
-        <requirement type="package" version="0.2.3">quasitools</requirement>
+        <requirement type="package" version="0.3.1">quasitools</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
 
--- a/hydra.xml	Mon Mar 26 15:38:19 2018 -0400
+++ b/hydra.xml	Wed Apr 25 10:38:00 2018 -0400
@@ -1,7 +1,7 @@
-<tool id="hydra" name="Hydra pipeline" version="0.1.0">
+<tool id="hydra" name="Hydra pipeline" version="0.2.0">
     <description>Identifies drug resistance within an NGS dataset</description>
     <requirements>
-          <requirement type="package" version="0.2.3">quasitools</requirement>
+          <requirement type="package" version="0.3.1">quasitools</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
 
@@ -64,8 +64,19 @@
             -mf '$min_freq' 
         #end if
 
-        #if $generate_consensus:
+        #if $consensus.consensus_bool == "true_consensus":
             --generate_consensus 
+
+            #if $consensus.fasta_id.type == "default":
+                --id 
+                #if $data_type.type == "paired":
+                    '${fastq_input1.element_identifier}'_'${fastq_input2.element_identifier}'
+                #elif $data_type.type == "single":
+                    '${fastq_input1.element_identifier}'
+                #end if
+            #elif $consensus.fasta_id.type == "custom":
+                --id '$consensus.fasta_id.custom_id' 
+            #end if
         #end if
 
         #if $filter_ns:
@@ -103,7 +114,27 @@
         <param name="min_depth" type="integer" optional="true" min="0" max="5000" label="Minimum depth" value="100" help="Minimum required depth for variant to be considered later on in the pipeline. Defaults to 100." />
         <param name="min_ac" type="integer" optional="true" min="0" max="5000" label="Minimum allele count" value="5" help="Minimum required allele count for variant to be considered later on in the pipeline. Defaults to 5." />
         <param name="min_freq" type="float" optional="true" min="0" max="1" label="Minimum frequency" value="0.01" help="Minimum required frequency for variant to be considered later on in the pipeline. Defaults to 0.01." />
-        <param name="generate_consensus" type="boolean" truevalue="--generate_consensus" falsevalue="" checked="False" label="Generate consensus" />
+        <conditional name="consensus">
+            <param name="consensus_bool" type="select" label="Generate consensus sequence." multiple="false" display="radio">
+                <option value="true_consensus">True</option>
+                <option selected="true" value="false_consensus">False</option>
+            </param>
+            <when value="true_consensus"> 
+                <conditional name="fasta_id">
+                    <param name="type" type="select" label="Specify consensus fasta identifier" multiple="false" display="radio">
+                        <option value="default" >Use fasta dataset name</option>
+                        <option value="custom">Use custom name</option>
+                    </param>
+                    <when value="default">
+                    </when>
+                    <when value="custom">
+                        <param name="custom_id" type="text" optional="false" value="custom_id" label="Fasta identifier" help="Type in a fasta identifier."/>
+                    </when>
+                </conditional>            
+            </when>
+            <when value="false_consensus"> 
+            </when>
+        </conditional>
         <param name="filter_ns" type="boolean" truevalue="--ns" falsevalue="" checked="False" label="Filter out n's" />
     </inputs>
     <outputs>
@@ -115,8 +146,8 @@
         <data format="vcf" label="HyDRA: variants output" name="output_hydra" from_work_dir="output/hydra.vcf" />
         <data format="vcf" label="HyDRA: aa mutations output" name="output_aa_mt" from_work_dir="output/mutation_report.hmcf" />
         <data format="txt" label="HyDRA: stats output" name="output_stats" from_work_dir="output/stats.txt" />
-        <data format="fasta" label="HyDRA: consensus output" name="output_consensus" from_work_dir="output/consensus.fasta">
-            <filter>generate_consensus</filter>
+        <data format="fasta" label="HyDRA: consensus output" name="output_consensus" from_work_dir="output/consensus.fasta" >
+            <filter>consensus['consensus_bool'] == "true_consensus"</filter>
         </data>
     </outputs>
     <tests>
Binary file test-data/quasi1.bai has changed
Binary file test-data/quasi1.bam has changed
Binary file test-data/quasi2.bai has changed
Binary file test-data/quasi2.bam has changed