comparison create_features_from_gff3.py @ 5:f7e9c792047b 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:34:42 -0400
parents 40b26f8269a3
children df0e4eb2dfa5
comparison
equal deleted inserted replaced
4:40b26f8269a3 5:f7e9c792047b
6 6
7 from BCBio import GFF 7 from BCBio import GFF
8 8
9 from six.moves.builtins import str 9 from six.moves.builtins import str
10 10
11 from webapollo import AssertUser, GuessOrg, OrgOrGuess, WAAuth, WebApolloInstance, featuresToFeatureSchema, retry 11 from webapollo import GuessOrg, OrgOrGuess, PermissionCheck, WAAuth, WebApolloInstance, featuresToFeatureSchema, retry
12 logging.basicConfig(level=logging.INFO) 12 logging.basicConfig(level=logging.INFO)
13 log = logging.getLogger(__name__) 13 log = logging.getLogger(__name__)
14 14
15 15
16 if __name__ == '__main__': 16 if __name__ == '__main__':
23 parser.add_argument('gff3', type=argparse.FileType('r'), help='GFF3 file') 23 parser.add_argument('gff3', type=argparse.FileType('r'), help='GFF3 file')
24 args = parser.parse_args() 24 args = parser.parse_args()
25 25
26 wa = WebApolloInstance(args.apollo, args.username, args.password) 26 wa = WebApolloInstance(args.apollo, args.username, args.password)
27 # User must have an account 27 # User must have an account
28 gx_user = AssertUser(wa.users.loadUsers(email=args.email)) 28 gx_user = wa.users.assertOrCreateUser(args.email)
29 29
30 # Get organism 30 # Get organism
31 org_cn = GuessOrg(args, wa) 31 org_cn = GuessOrg(args, wa)
32 if isinstance(org_cn, list): 32 if isinstance(org_cn, list):
33 org_cn = org_cn[0] 33 org_cn = org_cn[0]
34 34
35 # TODO: Check user perms on org. 35 if not PermissionCheck(gx_user, org_cn, "WRITE"):
36 raise Exception("Action not permitted")
36 org = wa.organisms.findOrganismByCn(org_cn) 37 org = wa.organisms.findOrganismByCn(org_cn)
37 38
38 bad_quals = ['date_creation', 'source', 'owner', 'date_last_modified', 'Name', 'ID'] 39 bad_quals = ['date_creation', 'source', 'owner', 'date_last_modified', 'Name', 'ID']
39 40
40 sys.stdout.write('# ') 41 sys.stdout.write('# ')