Mercurial > repos > eric-rasche > apollo
comparison json2iframe.py @ 0:6002cc0df04e draft
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
author | eric-rasche |
---|---|
date | Tue, 03 May 2016 13:38:55 -0400 |
parents | |
children | f7d57e56f322 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:6002cc0df04e |
---|---|
1 #!/usr/bin/env python | |
2 import json | |
3 import argparse | |
4 | |
5 if __name__ == '__main__': | |
6 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') | |
7 parser.add_argument('apollo', help='Complete Apollo URL') | |
8 parser.add_argument('json', type=file, help='JSON Data') | |
9 | |
10 args = parser.parse_args() | |
11 | |
12 | |
13 # https://cpt.tamu.edu/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326&tracks= | |
14 data = json.load(args.json) | |
15 if len(data) > 1: | |
16 raise Exception("More than one organism listed. TODO. Contact esr@tamu.edu") | |
17 | |
18 HTML_TPL = """ | |
19 <html> | |
20 <head> | |
21 <title>Embedded Apollo Access</title> | |
22 <style type="text/css"> | |
23 body {{ | |
24 margin: 0; | |
25 }} | |
26 iframe {{ | |
27 border: 0; | |
28 width: 100%; | |
29 height: 100% | |
30 }} | |
31 </style> | |
32 </head> | |
33 <body> | |
34 <iframe src="{base_url}/annotator/loadLink?loc={chrom}&organism={orgId}&tracklist=1"></iframe> | |
35 </body> | |
36 </html> | |
37 """ | |
38 | |
39 print HTML_TPL.format(base_url=args.apollo, chrom="", orgId=data[0]['id']) |