Mercurial > repos > gga > apollo_feat_from_gff3
view json2iframe.py @ 15:18217f8862ef draft
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 7f742b16e6e4c33b9abdb633405298e05760c84b"
author | gga |
---|---|
date | Tue, 08 Jun 2021 09:14:38 +0000 |
parents | 09dacc7c6a21 |
children |
line wrap: on
line source
#!/usr/bin/env python from __future__ import print_function import argparse import json 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=argparse.FileType("r"), help='JSON Data') parser.add_argument('external_apollo_url') parser.add_argument('--tracklist', action='store_true') args = parser.parse_args() # https://fqdn/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326 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: 100vh}}</style> </head> <body> <iframe src="{base_url}/annotator/loadLink?loc={chrom}&organism={orgId}{tracklist}"></iframe> </body> </html> """ if isinstance(data, list): print(HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id'], tracklist='&tracklist=1' if args.tracklist else '')) else: print(HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data['id'], tracklist='&tracklist=1' if args.tracklist else ''))