Mercurial > repos > greg > plant_tribes_gene_family_aligner
comparison run_pasta.py @ 0:7ba9469800b9 draft
Uploaded
author | greg |
---|---|
date | Thu, 08 Jun 2017 12:46:20 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7ba9469800b9 |
---|---|
1 #! /usr/bin/env python | |
2 | |
3 """Main script of PASTA in command-line mode - this simply invokes the main | |
4 function found in pasta/mainpasta.py | |
5 """ | |
6 | |
7 # This file is part of PASTA which is forked from SATe | |
8 | |
9 # PASTA like SATe is free software: you can redistribute it and/or modify | |
10 # it under the terms of the GNU General Public License as published by | |
11 # the Free Software Foundation, either version 3 of the License, or | |
12 # (at your option) any later version. | |
13 # | |
14 # This program is distributed in the hope that it will be useful, | |
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 # GNU General Public License for more details. | |
18 # | |
19 # You should have received a copy of the GNU General Public License | |
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | |
22 # Jiaye Yu and Mark Holder, University of Kansas | |
23 | |
24 if __name__ == "__main__": | |
25 import os | |
26 import sys | |
27 from pasta.mainpasta import pasta_main | |
28 from pasta import MESSENGER | |
29 sys.setrecursionlimit(100000) | |
30 _PASTA_DEBUG = os.environ.get('PASTA_DEBUG') | |
31 _DEVELOPER = _PASTA_DEBUG and _PASTA_DEBUG != '0' | |
32 | |
33 if not _DEVELOPER: | |
34 _PASTA_DEVELOPER = os.environ.get('PASTA_DEVELOPER') | |
35 _DEVELOPER = _PASTA_DEVELOPER and _PASTA_DEVELOPER != '0' | |
36 try: | |
37 rc, temp_dir, temp_fs = pasta_main() | |
38 if not rc: | |
39 raise ValueError("Unknown PASTA execution error") | |
40 if (temp_dir is not None) and (os.path.exists(temp_dir)): | |
41 MESSENGER.send_info("Note that temporary files from the run have not been deleted, they can be found in:\n '%s'\n" % temp_dir) | |
42 if sys.platform.lower().startswith('darwin') and ("'" not in temp_dir): | |
43 MESSENGER.send_info(''' | |
44 If you cannot see this directory in the Finder application, you may want to use | |
45 the 'open' command executed from a Terminal. You can do this by launching the | |
46 /Applications/Utilities/Terminal program and then typing | |
47 | |
48 open '%s' | |
49 | |
50 followed by a return at the prompt. If the argument to the open command is a | |
51 directory, then it should open a Finder window in the directory (even if that | |
52 directory is hidden by default). | |
53 ''' % temp_dir) | |
54 except Exception as x: | |
55 if _DEVELOPER: | |
56 raise | |
57 message = "PASTA is exiting because of an error:\n%s " % str(x) | |
58 try: | |
59 from pasta import MESSENGER | |
60 MESSENGER.send_error(message) | |
61 except: | |
62 sys.stderr.write(message) | |
63 sys.exit(1) |