Commits

jianma committed 0df0b76

add a tool to convert cel version

Comments (0)

Files changed (3)

tool_conf.xml.cistrome

     <tool file="filters/gtf2bedgraph.xml" />
     <tool file="filters/wig_to_bigwig.xml" />
     <tool file="filters/bed_to_bigbed.xml" />
-    <tool file="filters/cel_conversion.xml" />
+    <tool file="filters/cel_conversions.xml" />
   </section>
   <section name="Extract Features" id="features">
     <tool file="filters/ucsc_gene_bed_to_exon_bed.xml" />

tools/filters/cel_conversions.py

+#!/usr/bin/env python
+
+import optparse
+import os, sys
+
+def __main__():
+    #Parse Command Line
+    parser = optparse.OptionParser()
+    parser.add_option( '-i', '--input', dest='input', action='store', type="string", help='Input filename' )
+    parser.add_option( '-o', '--output', dest='output', action='store', type="string", help='Output filename' )
+    #parser.add_option( '-h', '--help')
+    (options, args) = parser.parse_args()
+    
+    if not os.path.isfile(options.input):
+        print "No input."
+        sys.exit()
+    os.system('apt-cel-convert -f xda -o output "%s"' %options.input)
+    apt_output = os.path.join("output", os.path.basename(options.input))
+    if not os.path.isfile(apt_output):
+        print "No output."
+        sys.exit()
+    cmd = 'mv "%s" "%s"'%(apt_output, options.output)
+    #print cmd
+    os.system(cmd)
+
+if __name__=="__main__": 
+    __main__()

tools/filters/cel_conversions.xml

       <param format="cel" name="celfile" type="data" label="Input cel file to be converted" />
     </inputs>
     <outputs>
-      <data format="cel" name="outcelfile" label="Output CEL file in xda format" />
       <data format="txt" name="log" label="CEL file convert log." />
+      <data format="cel" name="celoutput" label="output CEL xda format" />
     </outputs>
     <configfiles>
       <configfile name="shscript">
+#!/bin/bash
 #import os
-#set filename = os.path.join("output", os.path.split($celfile)[-1])
-apt-cel-convert  -f xda -o ./output $celfile
-cp output/apt-cel-convert.log $log
-cp $filename $outcelfile
+
+#set $dollar = chr(36)
+#set $gt = chr(62)
+#set $lt = chr(60)
+#set $ad = chr(38)
+
+#set $path = $os.path.abspath($__app__.config.tool_path)
+#set $prog = os.path.join($path, "filters", "cel_conversions.py")
+#echo $prog
+#echo $celfile
+python $prog -i $celfile -o $celoutput ${ad}${gt} $log
+###import os
+###set $filename = os.path.join("output", os.path.basename(str($celfile)))
+##echo $filename
+##mkdir output
+##apt-cel-convert  -f xda -o output "$celfile"
+###cp output/apt-cel-convert.log $log
+###cp $filename $outcelfile
 
       </configfile>
     </configfiles>