comparison tools/protein_analysis/wolf_psort.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 a290c6d4e658
children 99b82a2b1272
comparison
equal deleted inserted replaced
8:976a5f2833cd 9:e52220a9ddad
33 normally use Python's multiprocessing library in this situation but it requires 33 normally use Python's multiprocessing library in this situation but it requires
34 at least Python 2.6 and at the time of writing Galaxy still supports Python 2.4. 34 at least Python 2.6 and at the time of writing Galaxy still supports Python 2.4.
35 """ 35 """
36 import sys 36 import sys
37 import os 37 import os
38 from seq_analysis_utils import stop_err, split_fasta, run_jobs 38 from seq_analysis_utils import stop_err, split_fasta, run_jobs, thread_count
39 39
40 FASTA_CHUNK = 500 40 FASTA_CHUNK = 500
41 exe = "runWolfPsortSummary" 41 exe = "runWolfPsortSummary"
42 42
43 """ 43 """
44 Note: I had trouble getting runWolfPsortSummary on the path (via a link, other 44 Note: I had trouble getting runWolfPsortSummary on the path (via a link), other
45 than by including all of /opt/WoLFPSORT_package_v0.2/bin , so used a wrapper 45 than by including all of /opt/WoLFPSORT_package_v0.2/bin , so used a wrapper
46 python script called runWolfPsortSummary as follows: 46 python script called runWolfPsortSummary as follows:
47 47
48 #!/usr/bin/env python 48 #!/usr/bin/env python
49 #Wrapper script to call WoLF PSORT from its own directory. 49 #Wrapper script to call WoLF PSORT from its own directory.
63 63
64 organism = sys.argv[1] 64 organism = sys.argv[1]
65 if organism not in ["animal", "plant", "fungi"]: 65 if organism not in ["animal", "plant", "fungi"]:
66 stop_err("Organism argument %s is not one of animal, plant, fungi" % organism) 66 stop_err("Organism argument %s is not one of animal, plant, fungi" % organism)
67 67
68 try: 68 num_threads = thread_count(sys.argv[2], default=4)
69 num_threads = int(sys.argv[2])
70 except:
71 num_threads = 0
72 if num_threads < 1:
73 stop_err("Threads argument %s is not a positive integer" % sys.argv[2])
74
75 fasta_file = sys.argv[3] 69 fasta_file = sys.argv[3]
76
77 tabular_file = sys.argv[4] 70 tabular_file = sys.argv[4]
78 71
79 def clean_tabular(raw_handle, out_handle): 72 def clean_tabular(raw_handle, out_handle):
80 """Clean up WoLF PSORT output to make it tabular.""" 73 """Clean up WoLF PSORT output to make it tabular."""
81 for line in raw_handle: 74 for line in raw_handle: