annotate list_organisms.py @ 3:d4ae83dedb14 draft

planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
author eric-rasche
date Thu, 12 Jan 2017 11:52:28 -0500
parents 6002cc0df04e
children 7610987e0c48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
1 #!/usr/bin/env python
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
2 import json
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
3 import argparse
3
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
4 from webapollo import WAAuth, WebApolloInstance, AssertUser, accessible_organisms
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
5
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
6 if __name__ == '__main__':
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
7 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services')
3
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
8 WAAuth(parser)
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
9 parser.add_argument('email', help='User Email')
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
10 args = parser.parse_args()
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
11
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
12 wa = WebApolloInstance(args.apollo, args.username, args.password)
3
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
13
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
14 gx_user = AssertUser(wa.users.loadUsers(email=args.email))
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
15 all_orgs = wa.organisms.findAllOrganisms()
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
16
3
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
17 orgs = accessible_organisms(gx_user, all_orgs)
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
18
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 0
diff changeset
19 print json.dumps(orgs, indent=2)