diff tools/protein_analysis/promoter2.py @ 9:e52220a9ddad draft

Uploaded v0.1.2 Use the new <stdio> settings in the XML wrappers to catch errors. Obeys SGE style XNSLOTS environment variable for thread count (otherwise default to 4).
author peterjc
date Fri, 25 Jan 2013 06:08:31 -0500
parents 976a5f2833cd
children eb6ac44d4b8e
line wrap: on
line diff
--- a/tools/protein_analysis/promoter2.py	Mon Jul 30 12:56:54 2012 -0400
+++ b/tools/protein_analysis/promoter2.py	Fri Jan 25 06:08:31 2013 -0500
@@ -30,20 +30,15 @@
 import os
 import commands
 import tempfile
-from seq_analysis_utils import stop_err, split_fasta, run_jobs
+from seq_analysis_utils import stop_err, 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. "
              "Got %i arguments." % (len(sys.argv)-1))
-try:
-    num_threads = int(sys.argv[1])
-except:
-    num_threads = 1 #Default, e.g. used "$NSLOTS" and environment variable not defined
-if num_threads < 1:
-    stop_err("Threads argument %s is not a positive integer" % sys.argv[1])
 
+num_threads = thread_count(sys.argv[3],default=4)
 fasta_file = os.path.abspath(sys.argv[2])
 tabular_file = os.path.abspath(sys.argv[3])