Mercurial > repos > gga > apollo_fetch_jbrowse
comparison fetch_organism_jbrowse.py @ 5:1a2976c6b161 draft
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
author | gga |
---|---|
date | Fri, 31 Aug 2018 09:33:16 -0400 |
parents | c6d7f19953a6 |
children | dca2fb399ee6 |
comparison
equal
deleted
inserted
replaced
4:9968eec7430e | 5:1a2976c6b161 |
---|---|
7 import os | 7 import os |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import time | 10 import time |
11 | 11 |
12 from webapollo import GuessOrg, OrgOrGuess, WAAuth, WebApolloInstance | 12 from webapollo import GuessOrg, OrgOrGuess, PermissionCheck, WAAuth, WebApolloInstance |
13 logging.basicConfig(level=logging.INFO) | 13 logging.basicConfig(level=logging.INFO) |
14 log = logging.getLogger(__name__) | 14 log = logging.getLogger(__name__) |
15 | 15 |
16 | 16 |
17 def are_dir_trees_equal(dir1, dir2): | 17 def are_dir_trees_equal(dir1, dir2): |
53 if __name__ == '__main__': | 53 if __name__ == '__main__': |
54 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') | 54 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') |
55 WAAuth(parser) | 55 WAAuth(parser) |
56 OrgOrGuess(parser) | 56 OrgOrGuess(parser) |
57 parser.add_argument('target_dir', help='Target directory') | 57 parser.add_argument('target_dir', help='Target directory') |
58 parser.add_argument('email', help='User Email') | |
58 | 59 |
59 args = parser.parse_args() | 60 args = parser.parse_args() |
60 | 61 |
61 wa = WebApolloInstance(args.apollo, args.username, args.password) | 62 wa = WebApolloInstance(args.apollo, args.username, args.password) |
62 # User must have an account | 63 # User must have an account |
63 org_cn = GuessOrg(args, wa) | 64 org_cn = GuessOrg(args, wa) |
64 if isinstance(org_cn, list): | 65 if isinstance(org_cn, list): |
65 org_cn = org_cn[0] | 66 org_cn = org_cn[0] |
66 org = wa.organisms.findOrganismByCn(org_cn) | 67 org = wa.organisms.findOrganismByCn(org_cn) |
68 | |
69 # User must have an account, if not, create it | |
70 gx_user = wa.users.assertOrCreateUser(args.email) | |
71 | |
72 # User must have READ access | |
73 | |
74 if not PermissionCheck(gx_user, org_cn, "READ"): | |
75 raise Exception("READ permissions are required for this action") | |
67 | 76 |
68 if not os.path.exists(args.target_dir): | 77 if not os.path.exists(args.target_dir): |
69 os.makedirs(args.target_dir) | 78 os.makedirs(args.target_dir) |
70 | 79 |
71 if not os.path.exists(os.path.join(org['directory'], 'seq')): | 80 if not os.path.exists(os.path.join(org['directory'], 'seq')): |