comparison delete_features.py @ 5:950fb2bf116d 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:38 -0400
parents b4a85d0c85b8
children c3b5bc8b4080
comparison
equal deleted inserted replaced
4:5559e41721c3 5:950fb2bf116d
3 3
4 import argparse 4 import argparse
5 import logging 5 import logging
6 import random 6 import random
7 7
8 from webapollo import AssertUser, GuessOrg, OrgOrGuess, WAAuth, WebApolloInstance, retry 8 from webapollo import GuessOrg, OrgOrGuess, PermissionCheck, WAAuth, WebApolloInstance, retry
9 logging.basicConfig(level=logging.INFO) 9 logging.basicConfig(level=logging.INFO)
10 log = logging.getLogger(__name__) 10 log = logging.getLogger(__name__)
11 11
12 12
13 if __name__ == '__main__': 13 if __name__ == '__main__':
19 19
20 args = parser.parse_args() 20 args = parser.parse_args()
21 21
22 wa = WebApolloInstance(args.apollo, args.username, args.password) 22 wa = WebApolloInstance(args.apollo, args.username, args.password)
23 # User must have an account 23 # User must have an account
24 gx_user = AssertUser(wa.users.loadUsers(email=args.email)) 24 gx_user = wa.users.assertOrCreateUser(args.email)
25 25
26 # Get organism 26 # Get organism
27 org_cn = GuessOrg(args, wa) 27 org_cn = GuessOrg(args, wa)
28 if isinstance(org_cn, list): 28 if isinstance(org_cn, list):
29 org_cn = org_cn[0] 29 org_cn = org_cn[0]
30 30
31 # TODO: Check user perms on org. 31 if not PermissionCheck(gx_user, org_cn, "WRITE"):
32 raise Exception("Action not permitted")
32 org = wa.organisms.findOrganismByCn(org_cn) 33 org = wa.organisms.findOrganismByCn(org_cn)
33 34
34 sequences = wa.organisms.getSequencesForOrganism(org['id']) 35 sequences = wa.organisms.getSequencesForOrganism(org['id'])
35 for sequence in sequences['sequences']: 36 for sequence in sequences['sequences']:
36 log.info("Processing %s %s", org['commonName'], sequence['name']) 37 log.info("Processing %s %s", org['commonName'], sequence['name'])