Mercurial > repos > pjbriggs > amplicon_analysis_pipeline
annotate amplicon_analysis_pipeline.py @ 17:e1ba19551395 draft
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
author | pjbriggs |
---|---|
date | Tue, 03 Jul 2018 07:20:12 -0400 |
parents | 4bd582d23d4e |
children | 877d53e2d963 |
rev | line source |
---|---|
0
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
1 #!/usr/bin/env python |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
2 # |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
3 # Wrapper script to run Amplicon_analysis_pipeline.sh |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
4 # from Galaxy tool |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
5 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
6 import sys |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
7 import os |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
8 import argparse |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
9 import subprocess |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
10 import glob |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
11 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
12 class PipelineCmd(object): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
13 def __init__(self,cmd): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
14 self.cmd = [str(cmd)] |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
15 def add_args(self,*args): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
16 for arg in args: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
17 self.cmd.append(str(arg)) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
18 def __repr__(self): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
19 return ' '.join([str(arg) for arg in self.cmd]) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
20 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
21 def ahref(target,name=None,type=None): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
22 if name is None: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
23 name = os.path.basename(target) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
24 ahref = "<a href='%s'" % target |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
25 if type is not None: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
26 ahref += " type='%s'" % type |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
27 ahref += ">%s</a>" % name |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
28 return ahref |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
29 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
30 def check_errors(): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
31 # Errors in Amplicon_analysis_pipeline.log |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
32 with open('Amplicon_analysis_pipeline.log','r') as pipeline_log: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
33 log = pipeline_log.read() |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
34 if "Names in the first column of Metatable.txt and in the second column of Final_name.txt do not match" in log: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
35 print_error("""*** Sample IDs don't match dataset names *** |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
36 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
37 The sample IDs (first column of the Metatable file) don't match the |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
38 supplied sample names for the input Fastq pairs. |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
39 """) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
40 # Errors in pipeline output |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
41 with open('pipeline.log','r') as pipeline_log: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
42 log = pipeline_log.read() |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
43 if "Errors and/or warnings detected in mapping file" in log: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
44 with open("Metatable_log/Metatable.log","r") as metatable_log: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
45 # Echo the Metatable log file to the tool log |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
46 print_error("""*** Error in Metatable mapping file *** |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
47 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
48 %s""" % metatable_log.read()) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
49 elif "No header line was found in mapping file" in log: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
50 # Report error to the tool log |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
51 print_error("""*** No header in Metatable mapping file *** |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
52 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
53 Check you've specified the correct file as the input Metatable""") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
54 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
55 def print_error(message): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
56 width = max([len(line) for line in message.split('\n')]) + 4 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
57 sys.stderr.write("\n%s\n" % ('*'*width)) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
58 for line in message.split('\n'): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
59 sys.stderr.write("* %s%s *\n" % (line,' '*(width-len(line)-4))) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
60 sys.stderr.write("%s\n\n" % ('*'*width)) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
61 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
62 def clean_up_name(sample): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
63 # Remove trailing "_L[0-9]+_001" from Fastq |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
64 # pair names |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
65 split_name = sample.split('_') |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
66 if split_name[-1] == "001": |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
67 split_name = split_name[:-1] |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
68 if split_name[-1].startswith('L'): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
69 try: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
70 int(split_name[-1][1:]) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
71 split_name = split_name[:-1] |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
72 except ValueError: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
73 pass |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
74 return '_'.join(split_name) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
75 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
76 def list_outputs(filen=None): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
77 # List the output directory contents |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
78 # If filen is specified then will be the filename to |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
79 # write to, otherwise write to stdout |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
80 if filen is not None: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
81 fp = open(filen,'w') |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
82 else: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
83 fp = sys.stdout |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
84 results_dir = os.path.abspath("RESULTS") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
85 fp.write("Listing contents of output dir %s:\n" % results_dir) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
86 ix = 0 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
87 for d,dirs,files in os.walk(results_dir): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
88 ix += 1 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
89 fp.write("-- %d: %s\n" % (ix, |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
90 os.path.relpath(d,results_dir))) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
91 for f in files: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
92 ix += 1 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
93 fp.write("---- %d: %s\n" % (ix, |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
94 os.path.relpath(f,results_dir))) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
95 # Close output file |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
96 if filen is not None: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
97 fp.close() |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
98 |
8
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
99 def find_executable(name): |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
100 # Locate executable on PATH |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
101 for p in os.environ['PATH'].split(os.pathsep): |
12
fb2af52d67d1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit 53544cd620f81c5cfbdcb277e835f1c6da8588b0-dirty
pjbriggs
parents:
11
diff
changeset
|
102 exe = os.path.join(p,name) |
9
32a43bc3dd58
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
8
diff
changeset
|
103 if os.path.isfile(exe) and os.access(exe,os.X_OK): |
8
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
104 return exe |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
105 return None |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
106 |
0
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
107 if __name__ == "__main__": |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
108 # Command line |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
109 print "Amplicon analysis: starting" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
110 p = argparse.ArgumentParser() |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
111 p.add_argument("metatable", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
112 metavar="METATABLE_FILE", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
113 help="Metatable.txt file") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
114 p.add_argument("fastq_pairs", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
115 metavar="SAMPLE_NAME FQ_R1 FQ_R2", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
116 nargs="+", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
117 default=list(), |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
118 help="Triplets of SAMPLE_NAME followed by " |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
119 "a R1/R2 FASTQ file pair") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
120 p.add_argument("-g",dest="forward_pcr_primer") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
121 p.add_argument("-G",dest="reverse_pcr_primer") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
122 p.add_argument("-q",dest="trimming_threshold") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
123 p.add_argument("-O",dest="minimum_overlap") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
124 p.add_argument("-L",dest="minimum_length") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
125 p.add_argument("-l",dest="sliding_window_length") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
126 p.add_argument("-P",dest="pipeline", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
127 choices=["vsearch","uparse","qiime"], |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
128 type=str.lower, |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
129 default="vsearch") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
130 p.add_argument("-S",dest="use_silva",action="store_true") |
2 | 131 p.add_argument("-H",dest="use_homd",action="store_true") |
0
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
132 p.add_argument("-r",dest="reference_data_path") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
133 p.add_argument("-c",dest="categories_file") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
134 args = p.parse_args() |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
135 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
136 # Build the environment for running the pipeline |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
137 print "Amplicon analysis: building the environment" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
138 metatable_file = os.path.abspath(args.metatable) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
139 os.symlink(metatable_file,"Metatable.txt") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
140 print "-- made symlink to Metatable.txt" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
141 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
142 # Link to Categories.txt file (if provided) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
143 if args.categories_file is not None: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
144 categories_file = os.path.abspath(args.categories_file) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
145 os.symlink(categories_file,"Categories.txt") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
146 print "-- made symlink to Categories.txt" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
147 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
148 # Link to FASTQs and construct Final_name.txt file |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
149 sample_names = [] |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
150 with open("Final_name.txt",'w') as final_name: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
151 fastqs = iter(args.fastq_pairs) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
152 for sample_name,fqr1,fqr2 in zip(fastqs,fastqs,fastqs): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
153 sample_name = clean_up_name(sample_name) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
154 r1 = "%s_R1_.fastq" % sample_name |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
155 r2 = "%s_R2_.fastq" % sample_name |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
156 os.symlink(fqr1,r1) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
157 os.symlink(fqr2,r2) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
158 final_name.write("%s\n" % '\t'.join((r1,sample_name))) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
159 final_name.write("%s\n" % '\t'.join((r2,sample_name))) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
160 sample_names.append(sample_name) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
161 |
2 | 162 # Reference database |
163 if args.use_silva: | |
164 ref_database = "silva" | |
165 elif args.use_homd: | |
166 ref_database = "homd" | |
167 else: | |
168 ref_database = "gg" | |
169 | |
8
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
170 # Executables |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
171 os.mkdir("bin") |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
172 os.environ["PATH"] = os.path.abspath("bin") + \ |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
173 os.pathsep + \ |
10
b47cf1d6fb47
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
9
diff
changeset
|
174 os.environ["PATH"] |
8
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
175 print "-- updated PATH: %s" % os.environ["PATH"] |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
176 # Pipeline wants 'vsearch113' but bioconda version is just |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
177 # 'vsearch' |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
178 vsearch = find_executable("vsearch113") |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
179 if vsearch is None: |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
180 vsearch = find_executable("vsearch") |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
181 if vsearch: |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
182 os.symlink(vsearch,os.path.join("bin","vsearch113")) |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
183 print "-- made symlink to %s" % vsearch |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
184 else: |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
185 sys.stderr.write("Missing 'vsearch[113]'\n") |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
186 # Pipeline wants 'fasta-splitter.pl' but bioconda provides |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
187 # 'fasta-splitter' |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
188 fasta_splitter = find_executable("fasta-splitter.pl") |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
189 if fasta_splitter is None: |
11
570228bb2fb7
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit 53544cd620f81c5cfbdcb277e835f1c6da8588b0
pjbriggs
parents:
10
diff
changeset
|
190 fasta_splitter = os.readlink( |
8
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
191 find_executable("fasta-splitter")) |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
192 if fasta_splitter: |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
193 os.symlink(vsearch,os.path.join("bin","fasta-splitter.pl")) |
13
c87b166cbfe1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit 777167fc30406b792d0cf924753069526f8b3e5e-dirty
pjbriggs
parents:
12
diff
changeset
|
194 print "-- made symlink to %s" % fasta_splitter |
8
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
195 else: |
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
196 sys.stderr.write("Missing 'fasta-splitter[.pl]'\n") |
15
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
197 # Qiime 1.8.0 wants 'RDP_JAR_PATH' env var to point to |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
198 # the rdp_classifier.jar file |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
199 # biconda provides this in the 'share/rdp_classifier/' dir |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
200 rdp_classifier = find_executable("rdp_classifier") |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
201 if rdp_classifier: |
16
4bd582d23d4e
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
15
diff
changeset
|
202 rdp_classifier = os.path.normpath( |
4bd582d23d4e
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
15
diff
changeset
|
203 os.path.join(os.path.dirname(rdp_classifier), |
15
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
204 "..", |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
205 "share", |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
206 "rdp_classifier", |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
207 "rdp_classifier.jar")) |
17
e1ba19551395
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
16
diff
changeset
|
208 if rdp_classifier and os.path.exists(rdp_classifier): |
16
4bd582d23d4e
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
15
diff
changeset
|
209 os.environ["RDP_JAR_PATH"] = rdp_classifier |
15
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
210 print "-- set RDP_JAR_PATH: %s" % os.environ["RDP_JAR_PATH"] |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
211 else: |
07b04a63abf1
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit af3afa7bd2c2441074879938cd93d9965908bbc7-dirty
pjbriggs
parents:
13
diff
changeset
|
212 sys.stderr.write("Missing 'rdp_classifier.jar'\n") |
8
8292f8262a9d
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
pjbriggs
parents:
2
diff
changeset
|
213 |
0
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
214 # Construct the pipeline command |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
215 print "Amplicon analysis: constructing pipeline command" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
216 pipeline = PipelineCmd("Amplicon_analysis_pipeline.sh") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
217 if args.forward_pcr_primer: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
218 pipeline.add_args("-g",args.forward_pcr_primer) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
219 if args.reverse_pcr_primer: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
220 pipeline.add_args("-G",args.reverse_pcr_primer) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
221 if args.trimming_threshold: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
222 pipeline.add_args("-q",args.trimming_threshold) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
223 if args.minimum_overlap: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
224 pipeline.add_args("-O",args.minimum_overlap) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
225 if args.minimum_length: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
226 pipeline.add_args("-L",args.minimum_length) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
227 if args.sliding_window_length: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
228 pipeline.add_args("-l",args.sliding_window_length) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
229 if args.reference_data_path: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
230 pipeline.add_args("-r",args.reference_data_path) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
231 pipeline.add_args("-P",args.pipeline) |
2 | 232 if ref_database == "silva": |
0
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
233 pipeline.add_args("-S") |
2 | 234 elif ref_database == "homd": |
235 pipeline.add_args("-H") | |
0
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
236 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
237 # Echo the pipeline command to stdout |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
238 print "Running %s" % pipeline |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
239 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
240 # Run the pipeline |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
241 with open("pipeline.log","w") as pipeline_out: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
242 try: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
243 subprocess.check_call(pipeline.cmd, |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
244 stdout=pipeline_out, |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
245 stderr=subprocess.STDOUT) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
246 exit_code = 0 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
247 print "Pipeline completed ok" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
248 except subprocess.CalledProcessError as ex: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
249 # Non-zero exit status |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
250 sys.stderr.write("Pipeline failed: exit code %s\n" % |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
251 ex.returncode) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
252 exit_code = ex.returncode |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
253 except Exception as ex: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
254 # Some other problem |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
255 sys.stderr.write("Unexpected error: %s\n" % str(ex)) |
2 | 256 exit_code = 1 |
0
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
257 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
258 # Write out the list of outputs |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
259 outputs_file = "Pipeline_outputs.txt" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
260 list_outputs(outputs_file) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
261 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
262 # Check for log file |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
263 log_file = "Amplicon_analysis_pipeline.log" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
264 if os.path.exists(log_file): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
265 print "Found log file: %s" % log_file |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
266 if exit_code == 0: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
267 # Create an HTML file to link to log files etc |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
268 # NB the paths to the files should be correct once |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
269 # copied by Galaxy on job completion |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
270 with open("pipeline_outputs.html","w") as html_out: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
271 html_out.write("""<html> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
272 <head> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
273 <title>Amplicon analysis pipeline: log files</title> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
274 <head> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
275 <body> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
276 <h1>Amplicon analysis pipeline: log files</h1> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
277 <ul> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
278 """) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
279 html_out.write( |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
280 "<li>%s</li>\n" % |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
281 ahref("Amplicon_analysis_pipeline.log", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
282 type="text/plain")) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
283 html_out.write( |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
284 "<li>%s</li>\n" % |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
285 ahref("pipeline.log",type="text/plain")) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
286 html_out.write( |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
287 "<li>%s</li>\n" % |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
288 ahref("Pipeline_outputs.txt", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
289 type="text/plain")) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
290 html_out.write( |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
291 "<li>%s</li>\n" % |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
292 ahref("Metatable.html")) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
293 html_out.write("""<ul> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
294 </body> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
295 </html> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
296 """) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
297 else: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
298 # Check for known error messages |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
299 check_errors() |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
300 # Write pipeline stdout to tool stderr |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
301 sys.stderr.write("\nOutput from pipeline:\n") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
302 with open("pipeline.log",'r') as log: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
303 sys.stderr.write("%s" % log.read()) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
304 # Write log file contents to tool log |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
305 print "\nAmplicon_analysis_pipeline.log:" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
306 with open(log_file,'r') as log: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
307 print "%s" % log.read() |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
308 else: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
309 sys.stderr.write("ERROR missing log file \"%s\"\n" % |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
310 log_file) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
311 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
312 # Handle FastQC boxplots |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
313 print "Amplicon analysis: collating per base quality boxplots" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
314 with open("fastqc_quality_boxplots.html","w") as quality_boxplots: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
315 # PHRED value for trimming |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
316 phred_score = 20 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
317 if args.trimming_threshold is not None: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
318 phred_score = args.trimming_threshold |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
319 # Write header for HTML output file |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
320 quality_boxplots.write("""<html> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
321 <head> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
322 <title>Amplicon analysis pipeline: Per-base Quality Boxplots (FastQC)</title> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
323 <head> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
324 <body> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
325 <h1>Amplicon analysis pipeline: Per-base Quality Boxplots (FastQC)</h1> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
326 """) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
327 # Look for raw and trimmed FastQC output for each sample |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
328 for sample_name in sample_names: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
329 fastqc_dir = os.path.join(sample_name,"FastQC") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
330 quality_boxplots.write("<h2>%s</h2>" % sample_name) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
331 for d in ("Raw","cutdapt_sickle/Q%s" % phred_score): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
332 quality_boxplots.write("<h3>%s</h3>" % d) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
333 fastqc_html_files = glob.glob( |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
334 os.path.join(fastqc_dir,d,"*_fastqc.html")) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
335 if not fastqc_html_files: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
336 quality_boxplots.write("<p>No FastQC outputs found</p>") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
337 continue |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
338 # Pull out the per-base quality boxplots |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
339 for f in fastqc_html_files: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
340 boxplot = None |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
341 with open(f) as fp: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
342 for line in fp.read().split(">"): |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
343 try: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
344 line.index("alt=\"Per base quality graph\"") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
345 boxplot = line + ">" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
346 break |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
347 except ValueError: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
348 pass |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
349 if boxplot is None: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
350 boxplot = "Missing plot" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
351 quality_boxplots.write("<h4>%s</h4><p>%s</p>" % |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
352 (os.path.basename(f), |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
353 boxplot)) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
354 quality_boxplots.write("""</body> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
355 </html> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
356 """) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
357 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
358 # Handle additional output when categories file was supplied |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
359 if args.categories_file is not None: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
360 # Alpha diversity boxplots |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
361 print "Amplicon analysis: indexing alpha diversity boxplots" |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
362 boxplots_dir = os.path.abspath( |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
363 os.path.join("RESULTS", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
364 "%s_%s" % (args.pipeline.title(), |
2 | 365 ref_database), |
0
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
366 "Alpha_diversity", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
367 "Alpha_diversity_boxplot", |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
368 "Categories_shannon")) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
369 print "Amplicon analysis: gathering PDFs from %s" % boxplots_dir |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
370 boxplot_pdfs = [os.path.basename(pdf) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
371 for pdf in |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
372 sorted(glob.glob( |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
373 os.path.join(boxplots_dir,"*.pdf")))] |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
374 with open("alpha_diversity_boxplots.html","w") as boxplots_out: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
375 boxplots_out.write("""<html> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
376 <head> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
377 <title>Amplicon analysis pipeline: Alpha Diversity Boxplots (Shannon)</title> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
378 <head> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
379 <body> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
380 <h1>Amplicon analysis pipeline: Alpha Diversity Boxplots (Shannon)</h1> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
381 """) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
382 boxplots_out.write("<ul>\n") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
383 for pdf in boxplot_pdfs: |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
384 boxplots_out.write("<li>%s</li>\n" % ahref(pdf)) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
385 boxplots_out.write("<ul>\n") |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
386 boxplots_out.write("""</body> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
387 </html> |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
388 """) |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
389 |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
390 # Finish |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
391 print "Amplicon analysis: finishing, exit code: %s" % exit_code |
b433086738d6
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit ba3e5b591407db52a586361efb21927c8171ec0e
pjbriggs
parents:
diff
changeset
|
392 sys.exit(exit_code) |