Mercurial > repos > eric-rasche > apollo
comparison delete_features.py @ 5:7610987e0c48 draft
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
author | eric-rasche |
---|---|
date | Wed, 01 Mar 2017 22:39:58 -0500 |
parents | |
children | f9a6e151b3b4 |
comparison
equal
deleted
inserted
replaced
4:23ead6905145 | 5:7610987e0c48 |
---|---|
1 #!/usr/bin/env python | |
2 import argparse | |
3 from webapollo import WebApolloInstance | |
4 from webapollo import WAAuth, OrgOrGuess, GuessOrg, AssertUser | |
5 import logging | |
6 logging.basicConfig(level=logging.INFO) | |
7 log = logging.getLogger(__name__) | |
8 | |
9 | |
10 if __name__ == '__main__': | |
11 parser = argparse.ArgumentParser(description='Sample script to delete all features from an organism') | |
12 WAAuth(parser) | |
13 parser.add_argument('email', help='User Email') | |
14 OrgOrGuess(parser) | |
15 | |
16 args = parser.parse_args() | |
17 | |
18 wa = WebApolloInstance(args.apollo, args.username, args.password) | |
19 # User must have an account | |
20 gx_user = AssertUser(wa.users.loadUsers(email=args.email)) | |
21 | |
22 # Get organism | |
23 org_cn = GuessOrg(args, wa) | |
24 if isinstance(org_cn, list): | |
25 org_cn = org_cn[0] | |
26 | |
27 # TODO: Check user perms on org. | |
28 org = wa.organisms.findOrganismByCn(org_cn) | |
29 | |
30 # Call setSequence to tell apollo which organism we're working with | |
31 wa.annotations.setSequence(org['commonName'], org['id']) | |
32 # Then get a list of features. | |
33 features = wa.annotations.getFeatures() | |
34 # For each feature in the features | |
35 for feature in features['features']: | |
36 # We see that deleteFeatures wants a uniqueName, and so we pass | |
37 # is the uniquename field in the feature. | |
38 print(wa.annotations.deleteFeatures([feature['uniquename']])) | |
39 |