Mercurial > repos > trinity_ctat > trinity
annotate trinity_wrapper.py @ 1:88ada07f855c draft
Adding align_and_estimate_abundance tool.
author | trinity_ctat |
---|---|
date | Thu, 21 Sep 2017 14:31:42 -0400 |
parents | f571ca145e9d |
children |
rev | line source |
---|---|
0
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
1 #!/usr/bin/env python |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
2 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
3 ''' |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
4 trinity_runner.py |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
5 This program is used as a wrapper for Trinity to allow an automatic rerun of failed jobs. It takes arguments for a typical Trinity run: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
6 ~ Required args ~ |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
7 Input files - single or paired (left and right) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
8 File type (fasta, fastq) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
9 Max memory - this I need to derive somehow from the dynamic runner using Galaxy slots |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
10 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
11 ~ Optional args ~ |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
12 Output directory - this allows users to run the same job over in case it walltime'd out or failed for recoverable reasons. |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
13 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
14 -- |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
15 Created Tuesday, 7 March 2017. |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
16 Carrie Ganote |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
17 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
18 Licensed to Indiana University under Creative Commons 3.0 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
19 ''' |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
20 import subprocess32 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
21 import argparse |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
22 import logging as log |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
23 import sys |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
24 import os |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
25 import errno |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
26 from datetime import datetime |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
27 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
28 TRINITY_OUT_DIR = "trinity_out_dir" |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
29 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
30 def main(*args): |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
31 parser = argparse.ArgumentParser(description="") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
32 parser.add_argument("-o","--output", help="Name of output directory") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
33 parser.add_argument("-q","--seqType", help="Type of reads; fa or fq") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
34 parser.add_argument("-m","--max_memory", help="How much memory to allocate? Or maybe how many cpus?") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
35 parser.add_argument("-p","--mem_per_cpu", help="Memory PER CPU, in GB, in case we want to multiply mem x cpu at runtime") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
36 parser.add_argument("-s","--single", help="Single read file input") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
37 parser.add_argument("-l","--left", help="Left read file from paired inputs") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
38 parser.add_argument("-r","--right", help="Right read file from paired inputs") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
39 parser.add_argument("-v","--verbose", help="Enable debugging messages to be displayed", action='store_true') |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
40 parser.add_argument("-g","--log", help="Log file") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
41 parser.add_argument("-t","--timing", help="Timing file, if it exists", default=None) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
42 parser.add_argument("-d","--dir", help="if supplying a rerunnable job, this is the (hopefully unique) name of the directory to run it in.") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
43 parser.add_argument("-u","--user", help="Username to run job under") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
44 parser.add_argument("-f","--fullpath", help="if supplying a rerunnable job, this is the full path (except the user and dir names) to run the job in.") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
45 parser.add_argument("-c","--CPU", help="CPUs, either a hard coded numer or from Galaxy slots") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
46 # parser.add_argument("-","--", help="") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
47 args = parser.parse_args() |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
48 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
49 if args.verbose: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
50 log.basicConfig(format='%(message)s',level=log.DEBUG) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
51 cmd = ["Trinity"] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
52 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
53 ### Add rerun ability ########################################### |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
54 # This variable tells us later whether to copy the files back to the job working directory |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
55 copyback = False |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
56 if args.dir and args.user and args.fullpath: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
57 cleandir = args.dir |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
58 chars = "\\`*_{}[]()>#+-.!$&;| " |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
59 for c in chars: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
60 if c in cleandir: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
61 cleandir = cleandir.replace(c, "_") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
62 rerunPath = "%s/%s/%s" % (args.fullpath, args.user, cleandir) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
63 print "Rerunpath is ",rerunPath |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
64 try: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
65 os.makedirs(rerunPath) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
66 print "Created dir ",rerunPath |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
67 except OSError as exc: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
68 if exc.errno == errno.EEXIST and os.path.isdir(rerunPath): |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
69 pass |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
70 else: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
71 raise |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
72 copyback = os.getcwd() |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
73 outdir = copyback + "/" + TRINITY_OUT_DIR |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
74 try: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
75 os.makedirs(outdir) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
76 print "Created dir ",outdir |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
77 except OSError as exc: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
78 if exc.errno == errno.EEXIST and os.path.isdir(outdir): |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
79 pass |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
80 else: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
81 raise |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
82 os.chdir(rerunPath) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
83 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
84 ### Add information for reads ################################### |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
85 if args.left and args.right: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
86 cmd += ["--left",args.left,"--right", args.right] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
87 elif args.single: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
88 cmd += ["--single",args.single] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
89 else: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
90 raise Exception ("Need input files in order to run Trinity!") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
91 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
92 ### Add seqtype ################################################## |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
93 if args.seqType: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
94 cmd += ["--seqType",args.seqType] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
95 else: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
96 raise Exception ("Please specify a file type for your reads!") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
97 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
98 ### Memory and CPU management #################################### |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
99 if args.mem_per_cpu and not args.max_memory: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
100 if args.CPU: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
101 memry = int(args.CPU) * int(args.mem_per_cpu) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
102 memstr = "%dG" % (memry) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
103 cmd += ["--max_memory",memstr] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
104 else: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
105 memry = 2 * int(args.mem_per_cpu) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
106 memstr = "%dG" % (memry) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
107 cmd += ["--max_memory",memstr] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
108 elif args.max_memory and not args.mem_per_cpu: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
109 cmd += ["--max_memory",args.max_memory] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
110 else: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
111 raise Exception ("Please pick Memory per cpu, or max mem, but not both.") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
112 if args.CPU: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
113 cmd += ["--CPU", args.CPU] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
114 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
115 ### Enough args, let's run it #################################### |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
116 print "About to write to %s" % args.log |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
117 out = open(args.log, 'w') |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
118 totalattempts = attempts = 2 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
119 ec = 1 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
120 finish = 1 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
121 out.write("Command is:\n%s\n" % (" ".join(cmd))) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
122 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
123 ### There is definitely some value in running the job more than once, especially if it dies for stupid reasons.. ### |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
124 while ec != 0 and attempts > 0 and finish != 0: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
125 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
126 dt = datetime.now() |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
127 dtstr = dt.strftime("%d/%m/%y %H:%M") |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
128 out.write("Beginning attempt %d of Trinity job at %s\n" % (totalattempts - attempts +1, dtstr) ) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
129 attempts -= 1 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
130 ec = subprocess32.call(cmd, shell=False, stdin=None, stdout=out, stderr=out, timeout=None) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
131 out.write("Trinity exited with status %d\n" % ec) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
132 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
133 greplog = open("greplog", 'w') |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
134 cmds = ["grep", 'All commands completed successfully', args.log] |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
135 finish = subprocess32.call(cmds,shell=False, stdin=None, stdout=greplog, stderr=greplog, timeout=None) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
136 greplog.close() |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
137 out.write("Finished and found the success command with grep code %d\n" % finish) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
138 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
139 if ec == 0 and args.timing is not None: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
140 if copyback is not False: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
141 cwd = os.getcwd() |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
142 dest = copyback + "/" + TRINITY_OUT_DIR + "/Trinity.fasta" |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
143 src = cwd + "/" + TRINITY_OUT_DIR + "/Trinity.fasta" |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
144 print "copying trinity outputs from %s to %s" % (src, dest) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
145 os.symlink(src, dest) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
146 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
147 #copy the timing file into the log |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
148 try: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
149 handle = open (args.timing, 'r') |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
150 for line in handle: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
151 out.write(line) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
152 handle.close() |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
153 except (OSError, IOError) as e: |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
154 print "Oops, no timing file found? ",e |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
155 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
156 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
157 out.close() |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
158 exit (ec) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
159 |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
160 if __name__ == "__main__": |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
161 main(*sys.argv) |
f571ca145e9d
Initial commit with concatenate and trinity tools. Still testing.
trinity_ctat
parents:
diff
changeset
|
162 |