diff edge_pro.py @ 1:f77ce4f92b46 draft

Use $GALAXY_SLOTS instead of $EDGE_PRO_SITE_OPTIONS. Add dependency on bowtie2. Add readme.rst .
author crs4
date Fri, 31 Jan 2014 05:44:03 -0500
parents 7af33315bc5e
children bad8a51514dd
line wrap: on
line diff
--- a/edge_pro.py	Mon Sep 09 06:11:47 2013 -0400
+++ b/edge_pro.py	Fri Jan 31 05:44:03 2014 -0500
@@ -37,55 +37,25 @@
     (options, args) = parser.parse_args()
     if len(args) > 0:
         parser.error('Wrong number of arguments')
-    
+
     # Build command
-    if options.input2:
-        input2_flag = '-v %s' % (options.input2)
-    else:
-        input2_flag = ''
-    if options.num_threads is not None:
-        num_threads_flag = '-t %d' % options.num_threads
-    else:
-        num_threads_flag = ''
-    if options.minInsertSize is not None:
-        minInsertSize_flag = '-m %d' % options.minInsertSize
-    else:
-        minInsertSize_flag = ''
-    if options.maxInsertSize is not None:
-        maxInsertSize_flag = '-M %d' % options.maxInsertSize
-    else:
-        maxInsertSize_flag = ''
-    if options.window is not None:
-        window_flag = '-w %d' % options.window
-    else:
-        window_flag = ''
-    if options.utrSize is not None:
-        utrSize_flag = '-i %d' % options.utrSize
-    else:
-        utrSize_flag = ''
-    if options.similarity is not None:
-        similarity_flag = '-x %s' % options.similarity
-    else:
-        similarity_flag = ''
-    if options.readLength is not None:
-        readLength_flag = '-l %d' % (options.readLength)
-    else:
-        readLength_flag = ''
-    if options.minCoverage is not None:
-        minCoverage_flag = '-c %d' % options.minCoverage
-    else:
-        minCoverage_flag = ''
-    
+    input2_flag = '-v %s' % (options.input2) if options.input2 else ''
+    num_threads_flag = '-t %d' % options.num_threads if options.num_threads is not None else ''
+    minInsertSize_flag = '-m %d' % options.minInsertSize if options.minInsertSize is not None else ''
+    maxInsertSize_flag = '-M %d' % options.maxInsertSize if options.maxInsertSize is not None else ''
+    window_flag = '-w %d' % options.window if options.window is not None else ''
+    utrSize_flag = '-i %d' % options.utrSize if options.utrSize is not None else ''
+    similarity_flag = '-x %s' % options.similarity if options.similarity is not None else ''
+    readLength_flag = '-l %d' % (options.readLength) if options.readLength is not None else ''
+    minCoverage_flag = '-c %d' % options.minCoverage if options.minCoverage is not None else ''
+
     wd = tempfile.mkdtemp()
     try:
         prefix = os.path.join(wd, 'out')
         cl = 'edge.pl -g %s -p %s -r %s -u %s -o %s %s %s %s %s %s %s %s %s %s' % (options.genome, options.ptt, options.rnt, options.input1, prefix, input2_flag, num_threads_flag, minInsertSize_flag, maxInsertSize_flag, window_flag, utrSize_flag, similarity_flag, readLength_flag, minCoverage_flag)
-        print cl
-        
-        if options.out_log:
-            sout = open(options.out_log, 'w')
-        else:
-            sout = sys.stdout
+        print "EDGE-pro command to be executed:\n %s" % (cl)
+
+        sout = open(options.out_log, 'w') if options.out_log else sys.stdout
         try:
             subprocess.check_call(cl, stdout=sout, stderr=subprocess.STDOUT, shell=True) # need to redirect stderr because edge.pl calls bowtie2 and count which write some logging info there
         finally: