view list_organisms.py @ 2:9779fb963d69 draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 33ce5bd0cce35a12725b9ef9aed0683f3c41fbf9
author gga
date Wed, 20 Sep 2017 09:08:28 -0400
parents 5aa3bc8d0253
children cc098732daf6
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))