Mercurial > repos > eric-rasche > apollo
view json2iframe.py @ 4:23ead6905145 draft
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5-dirty
author | eric-rasche |
---|---|
date | Thu, 12 Jan 2017 11:53:44 -0500 |
parents | d4ae83dedb14 |
children | 7610987e0c48 |
line wrap: on
line source
#!/usr/bin/env python import json import base64 import argparse if __name__ == '__main__': parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') parser.add_argument('apollo', help='Complete Apollo URL') parser.add_argument('json', type=file, help='JSON Data') parser.add_argument('external_apollo_url') args = parser.parse_args() # https://fqdn/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326&tracks= data = json.load(args.json) # This is base64 encoded to get past the toolshed's filters. HTML_TPL = """ <html><head><title>Embedded Apollo Access</title><style type="text/css">body {{margin: 0;}} iframe {{border: 0;width: 100%;height: 100%}}</style></head><body><iframe src="{base_url}/annotator/loadLink?loc={chrom}&organism={orgId}&tracklist=1"></iframe></body></html> """ # HTML_TPL = base64.b64decode(HTML_TPL.replace('\n', '')) print HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id'])