Mercurial > repos > peterjc > tmhmm_and_signalp
diff tools/protein_analysis/wolf_psort.py @ 20:a19b3ded8f33 draft
v0.2.11 Job splitting fast-fail; RXLR tools supports HMMER2 from BioConda; Capture more version information; misc internal changes
author | peterjc |
---|---|
date | Thu, 21 Sep 2017 11:35:20 -0400 |
parents | f3ecd80850e2 |
children | 238eae32483c |
line wrap: on
line diff
--- a/tools/protein_analysis/wolf_psort.py Wed Feb 01 09:46:42 2017 -0500 +++ b/tools/protein_analysis/wolf_psort.py Thu Sep 21 11:35:20 2017 -0400 @@ -33,9 +33,13 @@ normally use Python's multiprocessing library in this situation but it requires at least Python 2.6 and at the time of writing Galaxy still supports Python 2.4. """ -import sys + +from __future__ import print_function + import os -from seq_analysis_utils import split_fasta, run_jobs, thread_count +import sys + +from seq_analysis_utils import run_jobs, split_fasta, thread_count FASTA_CHUNK = 500 exe = "runWolfPsortSummary" @@ -61,6 +65,9 @@ https://lists.galaxyproject.org/pipermail/galaxy-dev/2015-December/023386.html """ +if "-v" in sys.argv or "--version" in sys.argv: + sys.exit("WoLF-PSORT wrapper version 0.0.11") + if len(sys.argv) != 5: sys.exit("Require four arguments, organism, threads, input protein FASTA file & output tabular file") @@ -84,6 +91,7 @@ out_handle.write("%s\t%s\t%s\t%i\n" % (name, comp, score, rank + 1)) + fasta_files = split_fasta(fasta_file, tabular_file, n=FASTA_CHUNK) temp_files = [f + ".out" for f in fasta_files] assert len(fasta_files) == len(temp_files) @@ -97,9 +105,10 @@ if os.path.isfile(f): os.remove(f) + if len(jobs) > 1 and num_threads > 1: # A small "info" message for Galaxy to show the user. - print "Using %i threads for %i tasks" % (min(num_threads, len(jobs)), len(jobs)) + print("Using %i threads for %i tasks" % (min(num_threads, len(jobs)), len(jobs))) results = run_jobs(jobs, num_threads) assert len(fasta_files) == len(temp_files) == len(jobs) for fasta, temp, cmd in zip(fasta_files, temp_files, jobs):