diff list_organisms.py @ 0:99b348a1d355 draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
author gga
date Mon, 11 Sep 2017 05:47:45 -0400
parents
children 207c1c281360
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/list_organisms.py	Mon Sep 11 05:47:45 2017 -0400
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+from __future__ import print_function
+
+import argparse
+import json
+
+from webapollo import AssertUser, WAAuth, WebApolloInstance, accessible_organisms
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='List all organisms available in an Apollo instance')
+    WAAuth(parser)
+    parser.add_argument('email', help='User Email')
+    args = parser.parse_args()
+
+    wa = WebApolloInstance(args.apollo, args.username, args.password)
+
+    gx_user = AssertUser(wa.users.loadUsers(email=args.email))
+    all_orgs = wa.organisms.findAllOrganisms()
+
+    orgs = accessible_organisms(gx_user, all_orgs)
+
+    print(json.dumps(orgs, indent=2))