Mercurial > repos > gga > apollo_fetch_jbrowse
annotate fetch_organism_jbrowse.py @ 0:c6d7f19953a6 draft
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
| author | gga | 
|---|---|
| date | Mon, 11 Sep 2017 05:47:25 -0400 | 
| parents | |
| children | 1a2976c6b161 | 
| rev | line source | 
|---|---|
| 
0
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
1 #!/usr/bin/env python | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
2 from __future__ import print_function | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
3 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
4 import argparse | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
5 import filecmp | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
6 import logging | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
7 import os | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
8 import subprocess | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
9 import sys | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
10 import time | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
11 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
12 from webapollo import GuessOrg, OrgOrGuess, WAAuth, WebApolloInstance | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
13 logging.basicConfig(level=logging.INFO) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
14 log = logging.getLogger(__name__) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
15 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
16 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
17 def are_dir_trees_equal(dir1, dir2): | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
18 """ | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
19 Compare two directories recursively. Files in each directory are | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
20 assumed to be equal if their names and contents are equal. | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
21 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
22 @param dir1: First directory path | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
23 @param dir2: Second directory path | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
24 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
25 @return: True if the directory trees are the same and | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
26 there were no errors while accessing the directories or files, | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
27 False otherwise. | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
28 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
29 # http://stackoverflow.com/questions/4187564/recursive-dircmp-compare-two-directories-to-ensure-they-have-the-same-files-and/6681395#6681395 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
30 """ | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
31 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
32 dirs_cmp = filecmp.dircmp(dir1, dir2) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
33 if len(dirs_cmp.left_only) > 0 or len(dirs_cmp.right_only) > 0 or \ | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
34 len(dirs_cmp.funny_files) > 0: | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
35 print(('LEFT', dirs_cmp.left_only)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
36 print(('RIGHT', dirs_cmp.right_only)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
37 print(('FUNNY', dirs_cmp.funny_files)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
38 return False | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
39 (_, mismatch, errors) = filecmp.cmpfiles( | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
40 dir1, dir2, dirs_cmp.common_files, shallow=False) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
41 if len(mismatch) > 0 or len(errors) > 0: | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
42 print(mismatch) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
43 print(errors) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
44 return False | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
45 for common_dir in dirs_cmp.common_dirs: | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
46 new_dir1 = os.path.join(dir1, common_dir) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
47 new_dir2 = os.path.join(dir2, common_dir) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
48 if not are_dir_trees_equal(new_dir1, new_dir2): | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
49 return False | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
50 return True | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
51 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
52 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
53 if __name__ == '__main__': | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
54 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
55 WAAuth(parser) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
56 OrgOrGuess(parser) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
57 parser.add_argument('target_dir', help='Target directory') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
58 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
59 args = parser.parse_args() | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
60 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
61 wa = WebApolloInstance(args.apollo, args.username, args.password) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
62 # User must have an account | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
63 org_cn = GuessOrg(args, wa) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
64 if isinstance(org_cn, list): | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
65 org_cn = org_cn[0] | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
66 org = wa.organisms.findOrganismByCn(org_cn) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
67 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
68 if not os.path.exists(args.target_dir): | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
69 os.makedirs(args.target_dir) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
70 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
71 if not os.path.exists(os.path.join(org['directory'], 'seq')): | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
72 sys.stderr.write("Missing seq directory BEFORE copy") | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
73 sys.exit(1) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
74 | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
75 cmd = [ | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
76 'rsync', '-avr', | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
77 org['directory'].rstrip('/') + '/', | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
78 os.path.join(args.target_dir, 'data', '') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
79 ] | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
80 # We run this OBSESSIVELY because my org had a hiccup where the origin | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
81 # (silent) cp -R failed at one point. This caused MANY HEADACHES. | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
82 # | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
83 # Our response is to run this 3 times (in case the issue is temporary), | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
84 # with delays in between. And ensure that we have the correct number of | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
85 # files / folders before and after. | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
86 sys.stderr.write(' '.join(cmd)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
87 sys.stderr.write('\n') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
88 sys.stderr.write(subprocess.check_output(cmd)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
89 if not are_dir_trees_equal( | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
90 os.path.join(org['directory'].rstrip('/')), | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
91 os.path.join(args.target_dir, 'data') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
92 ): | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
93 # Not good | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
94 time.sleep(5) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
95 sys.stderr.write('\n') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
96 sys.stderr.write(' '.join(cmd)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
97 sys.stderr.write('\n') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
98 sys.stderr.write(subprocess.check_output(cmd)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
99 if not are_dir_trees_equal( | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
100 os.path.join(org['directory'].rstrip('/'), 'data'), | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
101 os.path.join(args.target_dir, 'data') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
102 ): | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
103 time.sleep(5) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
104 sys.stderr.write('\n') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
105 sys.stderr.write(' '.join(cmd)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
106 sys.stderr.write('\n') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
107 sys.stderr.write(subprocess.check_output(cmd)) | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
108 if not are_dir_trees_equal( | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
109 os.path.join(org['directory'].rstrip('/'), 'data'), | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
110 os.path.join(args.target_dir, 'data') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
111 ): | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
112 sys.stderr.write('FAILED THREE TIMES TO COPY. SOMETHING IS WRONG WRONG WRONG.') | 
| 
 
c6d7f19953a6
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
113 sys.exit(2) | 
