diff tools/protein_analysis/promoter2.py @ 26:20139cb4c844 draft

planemo upload for repository https://github.com/peterjc/pico_galaxy/tools/protein_analysis commit 221d4187992cbb993e02dc3ea0ef0150c7916a4a-dirty
author peterjc
date Wed, 13 May 2015 06:14:42 -0400
parents 5e62aefb2918
children 22e71e53f534
line wrap: on
line diff
--- a/tools/protein_analysis/promoter2.py	Fri Nov 21 08:17:36 2014 -0500
+++ b/tools/protein_analysis/promoter2.py	Wed May 13 06:14:42 2015 -0400
@@ -30,12 +30,12 @@
 import os
 import commands
 import tempfile
-from seq_analysis_utils import stop_err, split_fasta, run_jobs, thread_count
+from seq_analysis_utils import sys_exit, split_fasta, run_jobs, thread_count
 
 FASTA_CHUNK = 500
 
 if len(sys.argv) != 4:
-    stop_err("Require three arguments, number of threads (int), input DNA FASTA file & output tabular file. "
+    sys_exit("Require three arguments, number of threads (int), input DNA FASTA file & output tabular file. "
              "Got %i arguments." % (len(sys.argv)-1))
 
 num_threads = thread_count(sys.argv[3],default=4)
@@ -48,7 +48,7 @@
     platform = commands.getoutput("uname") #e.g. Linux
     shell_script = commands.getoutput("which promoter")
     if not os.path.isfile(shell_script):
-        stop_err("ERROR: Missing promoter executable shell script")
+        sys_exit("ERROR: Missing promoter executable shell script")
     path = None
     for line in open(shell_script):
         if line.startswith("setenv"): #could then be tab or space!
@@ -56,12 +56,12 @@
             if parts[0] == "setenv" and parts[1] == "PROM":
                 path = parts[2]
     if not path:
-        stop_err("ERROR: Could not find promoter path (PROM) in %r" % shell_script)
+        sys_exit("ERROR: Could not find promoter path (PROM) in %r" % shell_script)
     if not os.path.isdir(path):
-        stop_error("ERROR: %r is not a directory" % path)
+        sys_exit("ERROR: %r is not a directory" % path)
     bin = "%s/bin/promoter_%s" % (path, platform)
     if not os.path.isfile(bin):
-        stop_err("ERROR: Missing promoter binary %r" % bin)
+        sys_exit("ERROR: Missing promoter binary %r" % bin)
     return path, bin
 
 def make_tabular(raw_handle, out_handle):
@@ -86,19 +86,19 @@
             except ValueError:
                 print "WARNING: Problem with line: %r" % line
                 continue
-                #stop_err("ERROR: Problem with line: %r" % line)
+                #sys_exit("ERROR: Problem with line: %r" % line)
             if likelihood not in ["ignored",
                                   "Marginal prediction",
                                   "Medium likely prediction",
                                   "Highly likely prediction"]:
-                stop_err("ERROR: Problem with line: %r" % line)
+                sys_exit("ERROR: Problem with line: %r" % line)
             out_handle.write("%s\t%s\t%s\t%s\n" % (identifier, position, score, likelihood))
     return queries
     
 working_dir, bin = get_path_and_binary()
 
 if not os.path.isfile(fasta_file):
-   stop_err("ERROR: Missing input FASTA file %r" % fasta_file)
+   sys_exit("ERROR: Missing input FASTA file %r" % fasta_file)
 
 #Note that if the input FASTA file contains no sequences,
 #split_fasta returns an empty list (i.e. zero temp files).
@@ -133,7 +133,7 @@
         except IOError:
             output = ""
         clean_up(fasta_files + temp_files)
-        stop_err("One or more tasks failed, e.g. %i from %r gave:\n%s" % (error_level, cmd, output),
+        sys_exit("One or more tasks failed, e.g. %i from %r gave:\n%s" % (error_level, cmd, output),
                  error_level)
 
 del results
@@ -148,7 +148,7 @@
     data_handle.close()
     if not count:
         clean_up(fasta_files + temp_files)
-        stop_err("No output from promoter2")
+        sys_exit("No output from promoter2")
     queries += count
 out_handle.close()