comparison tools/protein_analysis/seq_analysis_utils.py @ 18:eb6ac44d4b8e draft

Suite v0.2.8, record Promoter 2 verion + misc internal updates
author peterjc
date Tue, 01 Sep 2015 09:56:36 -0400
parents e6cc27d182a8
children f3ecd80850e2
comparison
equal deleted inserted replaced
17:e6cc27d182a8 18:eb6ac44d4b8e
12 import subprocess 12 import subprocess
13 from time import sleep 13 from time import sleep
14 14
15 __version__ = "0.0.1" 15 __version__ = "0.0.1"
16 16
17 def stop_err(msg, error_level=1): 17 def sys_exit(msg, error_level=1):
18 """Print error message to stdout and quit with given error level.""" 18 """Print error message to stdout and quit with given error level."""
19 sys.stderr.write("%s\n" % msg) 19 sys.stderr.write("%s\n" % msg)
20 sys.exit(error_level) 20 sys.exit(error_level)
21 21
22 try: 22 try:
55 try: 55 try:
56 num = int(command_line_arg) 56 num = int(command_line_arg)
57 except: 57 except:
58 num = default 58 num = default
59 if num < 1: 59 if num < 1:
60 stop_err("Threads argument %r is not a positive integer" % command_line_arg) 60 sys_exit("Threads argument %r is not a positive integer" % command_line_arg)
61 #Cap this with the pysical limit of the machine, 61 #Cap this with the pysical limit of the machine,
62 try: 62 try:
63 num = min(num, cpu_count()) 63 num = min(num, cpu_count())
64 except NotImplementedError: 64 except NotImplementedError:
65 pass 65 pass