Mercurial > repos > peterjc > blast2go
annotate tools/ncbi_blast_plus/blast2go.py @ 1:0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
author | peterjc |
---|---|
date | Tue, 07 Jun 2011 16:29:28 -0400 |
parents | cd52c931b325 |
children | a5594772282c |
rev | line source |
---|---|
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
2 """Galaxy wrapper for Blast2GO for pipelines, b2g4pipe v2.3.5. |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
3 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
4 This script takes exactly three command line arguments: |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
5 * Input BLAST XML filename |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
6 * Blast2GO properties filename (settings file) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
7 * Output tabular filename |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
8 |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
9 Sadly b2g4pipe v2.3.5 cannot cope with current style large BLAST XML |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
10 files (e.g. from BLAST 2.2.25+), so we have to reformat these to |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
11 avoid it crashing with a Java heap space OutOfMemoryError. |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
12 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
13 As part of this reformatting, we check for BLASTP or BLASTX output |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
14 (otherwise raise an error), and print the query count. |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
15 |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
16 It then calls the Java command line tool, and moves the output file to |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
17 the location Galaxy is expecting, and removes the tempory XML file. |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
18 """ |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
19 import sys |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
20 import os |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
21 import subprocess |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
22 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
23 #You may need to edit this to match your local setup, |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
24 blast2go_jar = "/opt/b2g4pipe/blast2go.jar" |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
25 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
26 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
27 def stop_err(msg, error_level=1): |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
28 """Print error message to stdout and quit with given error level.""" |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
29 sys.stderr.write("%s\n" % msg) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
30 sys.exit(error_level) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
31 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
32 if len(sys.argv) != 4: |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
33 stop_err("Require three arguments: XML filename, properties filename, output tabular filename") |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
34 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
35 xml_file, prop_file, tabular_file = sys.argv[1:] |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
36 |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
37 #We should have write access here: |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
38 tmp_xml_file = tabular_file + ".tmp.xml" |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
39 |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
40 if not os.path.isfile(xml_file): |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
41 stop_err("Input BLAST XML file not found: %s" % xml_file) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
42 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
43 if not os.path.isfile(prop_file): |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
44 stop_err("Blast2GO configuration file not found: %s" % prop_file) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
45 |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
46 def prepare_xml(original_xml, mangled_xml): |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
47 """Reformat BLAST XML to suit Blast2GO. |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
48 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
49 Blast2GO can't cope with 1000s of <Iteration> tags within a |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
50 single <BlastResult> tag, so instead split this into one |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
51 full XML record per interation (i.e. per query). This gives |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
52 a concatenated XML file mimicing old versions of BLAST. |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
53 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
54 This also checks for BLASTP or BLASTX output, and outputs |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
55 the number of queries. Galaxy will show this as "info". |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
56 """ |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
57 in_handle = open(original_xml) |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
58 footer = " </BlastOutput_iterations>\n</BlastOutput>\n" |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
59 header = "" |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
60 while True: |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
61 line = in_handle.readline() |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
62 if not line: |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
63 #No hits? |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
64 stop_err("Problem with XML file?") |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
65 if line.strip() == "<Iteration>": |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
66 break |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
67 header += line |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
68 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
69 if "<BlastOutput_program>blastx</BlastOutput_program>" in header: |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
70 print "BLASTX output identified" |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
71 elif "<BlastOutput_program>blastp</BlastOutput_program>" in header: |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
72 print "BLASTP output identified" |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
73 else: |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
74 in_handle.close() |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
75 stop_err("Expect BLASTP or BLASTX output") |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
76 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
77 out_handle = open(mangled_xml, "w") |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
78 out_handle.write(header) |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
79 out_handle.write(line) |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
80 count = 1 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
81 while True: |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
82 line = in_handle.readline() |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
83 if not line: |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
84 break |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
85 elif line.strip() == "<Iteration>": |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
86 #Insert footer/header |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
87 out_handle.write(footer) |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
88 out_handle.write(header) |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
89 count += 1 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
90 out_handle.write(line) |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
91 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
92 out_handle.close() |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
93 in_handle.close() |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
94 print "Input has %i queries" % count |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
95 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
96 |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
97 def run(cmd): |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
98 #Avoid using shell=True when we call subprocess to ensure if the Python |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
99 #script is killed, so too is the child process. |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
100 try: |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
101 child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
102 except Exception, err: |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
103 stop_err("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
104 #Use .communicate as can get deadlocks with .wait(), |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
105 stdout, stderr = child.communicate() |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
106 return_code = child.returncode |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
107 if return_code: |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
108 cmd_str = " ".join(cmd) |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
109 if stderr and stdout: |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
110 stop_err("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, cmd_str, stdout, stderr)) |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
111 else: |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
112 stop_err("Return code %i from command:\n%s\n%s" % (return_code, cmd_str, stderr)) |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
113 #For early diagnostics, |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
114 else: |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
115 print stdout |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
116 print stderr |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
117 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
118 if not os.path.isfile(blast2go_jar): |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
119 stop_err("Blast2GO JAR file not found: %s" % blast2go_jar) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
120 |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
121 prepare_xml(xml_file, tmp_xml_file) |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
122 #print "XML file prepared for Blast2GO" |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
123 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
124 #We will have write access wherever the output should be, |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
125 #so we'll ask Blast2GO to use that as the stem for its output |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
126 #(it will append .annot to the filename) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
127 cmd = ["java", "-jar", blast2go_jar, |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
128 "-in", tmp_xml_file, |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
129 "-prop", prop_file, |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
130 "-out", tabular_file, #Used as base name for output files |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
131 "-a", # Generate *.annot tabular file |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
132 #"-img", # Generate images, feature not in v2.3.5 |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
133 ] |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
134 #print " ".join(cmd) |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
135 run(cmd) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
136 |
1
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
137 #Remove the temp XML file |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
138 os.remove(tmp_xml_file) |
0f159cf346c8
Migrated tool version 0.0.2 from old tool shed archive to new tool shed repository
peterjc
parents:
0
diff
changeset
|
139 |
0
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
140 out_file = tabular_file + ".annot" |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
141 if not os.path.isfile(out_file): |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
142 stop_err("ERROR - No output annotation file from Blast2GO") |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
143 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
144 #Move the output file where Galaxy expects it to be: |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
145 os.rename(out_file, tabular_file) |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
146 |
cd52c931b325
Migrated tool version 0.0.1 from old tool shed archive to new tool shed repository
peterjc
parents:
diff
changeset
|
147 print "Done" |