view list_organisms.py @ 4:5559e41721c3 draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 70fbb41d4c6b0a08a7bed4849a5ae7c865e1ab1e
author gga
date Mon, 12 Mar 2018 06:31:27 -0400
parents b4a85d0c85b8
children 950fb2bf116d
line wrap: on
line source

#!/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))