diff bam2wig.xml @ 32:580ee0c4bc4e

Fixes from Bjorn Gruning: create symlinks under $TMP and clean them up afterwards, replace R dependency with the Tool Shed R3 package, add --install-scripts, prepend tool-ids with rseqc
author lparsons
date Mon, 07 Oct 2013 15:01:13 -0400
parents cc5eaa9376d8
children 8fbd165f8835
line wrap: on
line diff
--- a/bam2wig.xml	Wed Oct 02 02:20:04 2013 -0400
+++ b/bam2wig.xml	Mon Oct 07 15:01:13 2013 -0400
@@ -1,92 +1,101 @@
-<tool id="bam2wig" name="BAM to Wiggle" version="1.1">
-	<description> 
-		converts all types of RNA-seq data from .bam to .wig 
-	</description>
-	<requirements>
-		<requirement type="package" version="2.11.0">R</requirement>
-		<requirement type="package" version="1.7.1">numpy</requirement>
-		<requirement type="package" version="2.3.7">rseqc</requirement>
-	</requirements>
-	<command> 
-        ln -s "${input}" "local_input.bam" &amp;&amp;
-        ln -s "${input.metadata.bam_index}" "local_input.bam.bai" &amp;&amp;
-		bam2wig.py -i "local_input.bam" -s $chromsize -o outfile
+<tool id="rseqc_bam2wig" name="BAM to Wiggle" version="1.1">
+    <description> 
+        converts all types of RNA-seq data from .bam to .wig 
+    </description>
+    <requirements>
+        <requirement type="package" version="3.0.1">R</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+        <requirement type="package" version="2.3.7">rseqc</requirement>
+    </requirements>
+    <command>
+
+        #import tempfile, os
+        #set $tmp_input = tempfile.NamedTemporaryFile()
+        #set $tmp_input_name = $input_singles_tmp_handle.name
+        #silent $tmp_input.close()
+
+        ln -s "${input}" $tmp_input_name &amp;&amp;
+        ln -s "${input.metadata.bam_index}" $tmp_input_name + ".bai" &amp;&amp;
+        bam2wig.py -i "local_input.bam" -s $chromsize -o outfile
 
-		#if str($strand_type.strand_specific) == "pair"
-			-d
-			#if str($strand_type.pair_type) == "sd"
-				'1++,1--,2+-,2-+'
-			#else
-				'1+-,1-+,2++,2--'
-			#end if
-		#end if
+        #if str($strand_type.strand_specific) == "pair"
+            -d
+            #if str($strand_type.pair_type) == "sd"
+                '1++,1--,2+-,2-+'
+            #else
+                '1+-,1-+,2++,2--'
+            #end if
+        #end if
 
-		#if str($strand_type.strand_specific) == "single"
-			-d
-			#if str($strand_type.single_type) == "s"
-				'++,--'
-			#else
-				'+-,-+'
-			#end if
-		#end if
+        #if str($strand_type.strand_specific) == "single"
+            -d
+            #if str($strand_type.single_type) == "s"
+                '++,--'
+            #else
+                '+-,-+'
+            #end if
+        #end if
 
-		#if $wigsum.wigsum_type
-			-t $wigsum.totalwig
-		#end if
+        #if $wigsum.wigsum_type
+            -t $wigsum.totalwig
+        #end if
 
-		#if $skipmultihits
-			-u
-		#end if
-	</command>
-	<inputs>
-		<param name="input" type="data" label="Input .bam File" format="bam" />
-		<param name="chromsize" type="data" label="Chromosome size file (tab or space separated)" format="txt,tabular" />
-		<param name="skipmultihits" type="boolean" label="Skip Multiple Hit Reads/Only Use Uniquely Mapped Reads" value="false" />
-		<conditional name="wigsum">
-			<param name="wigsum_type" type="boolean" label="Specify wigsum?" value="false">
-			</param>
-			<when value="true">
-				<param name="totalwig" value="0" type="integer" label="specified wigsum" />
-			</when>
-			<when value="false"></when>
-		</conditional>
-		<conditional name="strand_type">
-			<param name="strand_specific" type="select" label="Strand-specific?" value="none">
-				<option value="none">none</option>
-				<option value="pair">Pair-End RNA-seq</option>
-				<option value="single">Single-End RNA-seq</option>
-			</param>
-			<when value="pair">
-				<param name="pair_type" type="select" display="radio" label="Pair-End Read Type (format: mapped --> parent)" value="sd">
-					<option value="sd"> read1 (positive --> positive; negative --> negative), read2 (positive --> negative; negative --> positive)</option>
-					<option value="ds">read1 (positive --> negative; negative --> positive), read2 (positive --> positive; negative --> negative)</option>
-				</param>
-			</when>
-			<when value="single">
-				<param name="single_type" type="select" display="radio" label="Single-End Read Type (format: mapped --> parent)" value="s">
-					<option value="s">positive --> positive; negative --> negative</option>
-					<option value="d">positive --> negative; negative --> positive</option>
-				</param>
-			</when>
-			<when value="none"></when>
-		</conditional>
-	</inputs>
-	<outputs> 
-		<data format="wig" name="output" from_work_dir="outfile.wig">
-			<filter>strand_type['strand_specific'] == 'none'</filter>
-		</data>
-		<data format="wig" name="outputfwd" from_work_dir="outfile_Forward.wig" label="${tool.name} on ${on_string} (Forward Reads)">
-			<filter>strand_type['strand_specific'] != 'none'</filter>
-		</data>
-		<data format="wig" name="outputrv" from_work_dir="outfile_Reverse.wig" label="${tool.name} on ${on_string} (Reverse Reads)">
-			<filter>strand_type['strand_specific'] != 'none'</filter>
-		</data>
-	</outputs>
+        #if $skipmultihits
+            -u
+        #end if
+        ;
+        rm $tmp_input_name + ".bai" ;
+        rm $tmp_input_name
+    </command>
+    <inputs>
+        <param name="input" type="data" label="Input .bam File" format="bam" />
+        <param name="chromsize" type="data" label="Chromosome size file (tab or space separated)" format="txt,tabular" />
+        <param name="skipmultihits" type="boolean" label="Skip Multiple Hit Reads/Only Use Uniquely Mapped Reads" value="false" />
+        <conditional name="wigsum">
+            <param name="wigsum_type" type="boolean" label="Specify wigsum?" value="false">
+            </param>
+            <when value="true">
+                <param name="totalwig" value="0" type="integer" label="specified wigsum" />
+            </when>
+            <when value="false"/>
+        </conditional>
+        <conditional name="strand_type">
+            <param name="strand_specific" type="select" label="Strand-specific?" value="none">
+                <option value="none">none</option>
+                <option value="pair">Pair-End RNA-seq</option>
+                <option value="single">Single-End RNA-seq</option>
+            </param>
+            <when value="pair">
+                <param name="pair_type" type="select" display="radio" label="Pair-End Read Type (format: mapped --> parent)" value="sd">
+                    <option value="sd"> read1 (positive --> positive; negative --> negative), read2 (positive --> negative; negative --> positive)</option>
+                    <option value="ds">read1 (positive --> negative; negative --> positive), read2 (positive --> positive; negative --> negative)</option>
+                </param>
+            </when>
+            <when value="single">
+                <param name="single_type" type="select" display="radio" label="Single-End Read Type (format: mapped --> parent)" value="s">
+                    <option value="s">positive --> positive; negative --> negative</option>
+                    <option value="d">positive --> negative; negative --> positive</option>
+                </param>
+            </when>
+            <when value="none"></when>
+        </conditional>
+    </inputs>
+    <outputs> 
+        <data format="wig" name="output" from_work_dir="outfile.wig">
+            <filter>strand_type['strand_specific'] == 'none'</filter>
+        </data>
+        <data format="wig" name="outputfwd" from_work_dir="outfile_Forward.wig" label="${tool.name} on ${on_string} (Forward Reads)">
+            <filter>strand_type['strand_specific'] != 'none'</filter>
+        </data>
+        <data format="wig" name="outputrv" from_work_dir="outfile_Reverse.wig" label="${tool.name} on ${on_string} (Reverse Reads)">
+            <filter>strand_type['strand_specific'] != 'none'</filter>
+        </data>
+    </outputs>
     <stdio>
         <exit_code range="1:" level="fatal" description="An error occured during execution, see stderr and stdout for more information" />
         <regex match="[Ee]rror" source="both" description="An error occured during execution, see stderr and stdout for more information" />
     </stdio>
-	<help>
+    <help>
 bam2wig.py
 ++++++++++
 
@@ -103,19 +112,19 @@
 ++++++++++++++
 
 Input BAM file
-	Alignment file in BAM format (SAM is not supported). BAM file will be sorted and indexed using samTools.
+    Alignment file in BAM format (SAM is not supported). BAM file will be sorted and indexed using samTools.
 
 Chromosome size file
-	Tab or space separated text file with 2 columns: first column is chromosome name, second column is size of the chromosome. Chromosome names (such as "chr1") should be consistent between this file and BAM file.
+    Tab or space separated text file with 2 columns: first column is chromosome name, second column is size of the chromosome. Chromosome names (such as "chr1") should be consistent between this file and BAM file.
 
 Specified wigsum (default=none)
-	Specified wigsum. Wigsum of 100000000 equals to coverage achieved by 1 million 100nt reads. Ignore this option to disable normalization.
+    Specified wigsum. Wigsum of 100000000 equals to coverage achieved by 1 million 100nt reads. Ignore this option to disable normalization.
 
 Skip multiple Hit reads
-	skips multiple hit reads or only use uniquely mapped reads
+    skips multiple hit reads or only use uniquely mapped reads
 
 Strand-specific (default=none)
-	How read(s) were stranded during sequencing. If you are not sure about the strand rule, run infer_experiment.py
+    How read(s) were stranded during sequencing. If you are not sure about the strand rule, run infer_experiment.py
 
 Outputs
 ++++++++++++++
@@ -143,5 +152,5 @@
 .. _wiggle: http://genome.ucsc.edu/goldenPath/help/wiggle.html
 .. _bigwig: http://genome.ucsc.edu/FAQ/FAQformat.html#format6.1
 
-	</help>
+    </help>
 </tool>