diff bamFingerprint.xml @ 1:21d563d5f2b2 draft

Uploaded
author bgruening
date Mon, 05 Aug 2013 10:09:51 -0400
parents 09b65c12a75a
children 1f312af2f8db
line wrap: on
line diff
--- a/bamFingerprint.xml	Sat Aug 03 13:42:12 2013 -0400
+++ b/bamFingerprint.xml	Mon Aug 05 10:09:51 2013 -0400
@@ -1,60 +1,74 @@
 <tool id="bamFingerprint" name="bamFingerprint" version="1.0">
   <description>plots profiles of bam files</description>
   <requirements>
-    <requirement type="package" version="1.5.1_98e5d8a61431ea8605c0643d991a1a5d8999b4dc">deepTools</requirement>
+    <requirement type="package" version="1.5.1_59e067cce039cb93add04823c9f51cab202f8c2b">deepTools</requirement>
   </requirements>
   <command>
-  #set files=[]
-  #set labels=[]
-  #for $i in $inputs
-    #set $files += [str($i.bamfile)]
-    #if str($i.label.value) != "":
-        #set $labels += ["\"%s\"" % ($i.label.value)]
-    #else
-        #set $labels += ["\"%s\"" % ($i.bamfile.name)]
-    #end if
-  #end for
+    #import tempfile
+    #set $temp_dir = os.path.abspath(tempfile.mkdtemp())
+
+    #set files=[]
+    #set labels=[]
+    #for $i in $inputs
+        #set $temp_input_handle = tempfile.NamedTemporaryFile( dir=$temp_dir )
+        #set $temp_input_path = $temp_input_handle.name
+        #silent $temp_input_handle.close()
+        #silent os.system("ln -s %s %s.bam" % (str($i.bamfile), $temp_input_path))
+        #silent os.system("ln -s %s %s.bam.bai" % (str($i.bamfile.metadata.bam_index), $temp_input_path))
+        #silent $files.append('%s.bam' % $temp_input_path)
+
+        ##set $files += [str($i.bamfile)]
+        #if str($i.label.value) != "":
+            #set $labels += ["\"%s\"" % ($i.label.value)]
+        #else
+            #set $labels += ["\"%s\"" % ($i.bamfile.name)]
+        #end if
+    #end for
+
   bamFingerprint
+
+  ##ToDo
+  --numberOfProcessors 4
+
   --bamfiles #echo " ".join($files)
   --labels #echo " ".join($labels)
-  
+
   --fragmentLength $fragmentLength
-  
+
   #set newoutFileName=str($outFileName)+".png"
   --plotFile $newoutFileName
-  
+
   #if $outputOpt.showOutputOpt == "yes"
       #if $outputOpt.saveRawCounts:
         --outRawCounts '$outFileRawCounts' 
       #end if
   #end if
-  
+
   #if $advancedOpt.showAdvancedOpt == "yes":
     #if $advancedOpt.smoothLength:
       --smoothLength '$advancedOpt.smoothLength'
     #end if
-    
+
     #if str($advancedOpt.region.value) != '':
       --region '$advancedOpt.region'
     #end if
-    
+
     --binSize '$advancedOpt.binSize'
     --numberOfSamples '$advancedOpt.numberOfSamples'
-    
+
     $advancedOpt.doNotExtendPairedEnds
     $advancedOpt.ignoreDuplicates
     $advancedOpt.skipZeros
-    
+
     #if $advancedOpt.minMappingQuality:
       --minMappingQuality '$advancedOpt.minMappingQuality'
     #end if
   #end if
-  
-  --numberOfProcessors 4; mv $newoutFileName $outFileName
+  ; mv $newoutFileName $outFileName
+  ; rm $temp_dir -rf
   </command>
 
   <inputs>
-  
   <repeat name="inputs" title="Input files" min="2">
     <param name="bamfile" type="data" format="bam" 
         label="Bam file" 
@@ -63,10 +77,8 @@
         label="Label"
         help="Label to use in the output. If not given the dataset name will be used instead."/>
   </repeat>
-  
   <param name="fragmentLength" type="integer" value="200" min="1"
        label="Length of the average fragment size"/>
-  
   <conditional name="advancedOpt">
     <param name="showAdvancedOpt" type="select" label="Show advanced options" >
       <option value="no" selected="true">no</option>