Mercurial > repos > peterjc > tmhmm_and_signalp
comparison tools/protein_analysis/tmhmm2.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 | 9b45a8743100 |
children | 99b82a2b1272 |
comparison
equal
deleted
inserted
replaced
8:976a5f2833cd | 9:e52220a9ddad |
---|---|
41 when there is no output from tmhmm2, and raise an error. | 41 when there is no output from tmhmm2, and raise an error. |
42 """ | 42 """ |
43 import sys | 43 import sys |
44 import os | 44 import os |
45 import tempfile | 45 import tempfile |
46 from seq_analysis_utils import stop_err, split_fasta, run_jobs | 46 from seq_analysis_utils import stop_err, split_fasta, run_jobs, thread_count |
47 | 47 |
48 FASTA_CHUNK = 500 | 48 FASTA_CHUNK = 500 |
49 | 49 |
50 if len(sys.argv) != 4: | 50 if len(sys.argv) != 4: |
51 stop_err("Require three arguments, number of threads (int), input protein FASTA file & output tabular file") | 51 stop_err("Require three arguments, number of threads (int), input protein FASTA file & output tabular file") |
52 try: | 52 |
53 num_threads = int(sys.argv[1]) | 53 num_threads = thread_count(sys.argv[1], default=4) |
54 except: | |
55 num_threads = 1 #Default, e.g. used "$NSLOTS" and environment variable not defined | |
56 if num_threads < 1: | |
57 stop_err("Threads argument %s is not a positive integer" % sys.argv[1]) | |
58 fasta_file = sys.argv[2] | 54 fasta_file = sys.argv[2] |
59 tabular_file = sys.argv[3] | 55 tabular_file = sys.argv[3] |
60 | 56 |
61 tmp_dir = tempfile.mkdtemp() | 57 tmp_dir = tempfile.mkdtemp() |
62 | 58 |