Mercurial > repos > peterjc > mira_assembler
comparison tools/mira3/mira.py @ 28:e28d6015fc56 draft default tip
planemo upload for repository https://github.com/peterjc/galaxy_mira/tree/master/tools/mira3/ commit 89578746a1c5b29c84a173d8b2709f086f69a7b6
author | peterjc |
---|---|
date | Mon, 03 Jun 2019 13:28:13 -0400 |
parents | 85b86f31327c |
children |
comparison
equal
deleted
inserted
replaced
27:85b86f31327c | 28:e28d6015fc56 |
---|---|
16 """Run MIRA to find its version number.""" | 16 """Run MIRA to find its version number.""" |
17 # At the commend line I would use: mira -v | head -n 1 | 17 # At the commend line I would use: mira -v | head -n 1 |
18 # however there is some pipe error when doing that here. | 18 # however there is some pipe error when doing that here. |
19 cmd = ["mira", "-v"] | 19 cmd = ["mira", "-v"] |
20 try: | 20 try: |
21 child = subprocess.Popen(cmd, universal_newlines=True, | 21 child = subprocess.Popen( |
22 stdout=subprocess.PIPE, | 22 cmd, |
23 stderr=subprocess.STDOUT) | 23 universal_newlines=True, |
24 stdout=subprocess.PIPE, | |
25 stderr=subprocess.STDOUT, | |
26 ) | |
24 except Exception as err: | 27 except Exception as err: |
25 sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) | 28 sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) |
26 sys.exit(1) | 29 sys.exit(1) |
27 ver, tmp = child.communicate() | 30 ver, tmp = child.communicate() |
28 del child | 31 del child |
43 if not os.path.isdir(f): | 46 if not os.path.isdir(f): |
44 sys.exit("Missing output folder") | 47 sys.exit("Missing output folder") |
45 if not os.listdir(f): | 48 if not os.listdir(f): |
46 sys.exit("Empty output folder") | 49 sys.exit("Empty output folder") |
47 missing = [] | 50 missing = [] |
48 for old, new in [("%s/%s_out.unpadded.fasta" % (f, name), out_fasta), | 51 for old, new in [ |
49 ("%s/%s_out.unpadded.fasta.qual" % (f, name), out_qual), | 52 ("%s/%s_out.unpadded.fasta" % (f, name), out_fasta), |
50 ("%s/%s_out.wig" % (f, name), out_wig), | 53 ("%s/%s_out.unpadded.fasta.qual" % (f, name), out_qual), |
51 ("%s/%s_out.caf" % (f, name), out_caf), | 54 ("%s/%s_out.wig" % (f, name), out_wig), |
52 ("%s/%s_out.ace" % (f, name), out_ace)]: | 55 ("%s/%s_out.caf" % (f, name), out_caf), |
56 ("%s/%s_out.ace" % (f, name), out_ace), | |
57 ]: | |
53 if not os.path.isfile(old): | 58 if not os.path.isfile(old): |
54 missing.append(os.path.splitext(old)[-1]) | 59 missing.append(os.path.splitext(old)[-1]) |
55 else: | 60 else: |
56 shutil.move(old, new) | 61 shutil.move(old, new) |
57 if missing: | 62 if missing: |
88 # print(cmd) | 93 # print(cmd) |
89 | 94 |
90 handle = open(out_log, "w") | 95 handle = open(out_log, "w") |
91 try: | 96 try: |
92 # Run MIRA | 97 # Run MIRA |
93 child = subprocess.Popen(cmd_list, universal_newlines=True, | 98 child = subprocess.Popen( |
94 stdout=handle, | 99 cmd_list, universal_newlines=True, stdout=handle, stderr=subprocess.STDOUT |
95 stderr=subprocess.STDOUT) | 100 ) |
96 except Exception as err: | 101 except Exception as err: |
97 sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) | 102 sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) |
98 # TODO - call clean up? | 103 # TODO - call clean up? |
99 handle.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) | 104 handle.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) |
100 handle.close() | 105 handle.close() |