Mercurial > repos > eric-rasche > apollo
comparison json2iframe.py @ 5:7610987e0c48 draft
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
author | eric-rasche |
---|---|
date | Wed, 01 Mar 2017 22:39:58 -0500 |
parents | 23ead6905145 |
children | f9a6e151b3b4 |
comparison
equal
deleted
inserted
replaced
4:23ead6905145 | 5:7610987e0c48 |
---|---|
4 import argparse | 4 import argparse |
5 | 5 |
6 if __name__ == '__main__': | 6 if __name__ == '__main__': |
7 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') | 7 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') |
8 parser.add_argument('apollo', help='Complete Apollo URL') | 8 parser.add_argument('apollo', help='Complete Apollo URL') |
9 parser.add_argument('json', type=file, help='JSON Data') | 9 parser.add_argument('json', type=argparse.FileType("r"), help='JSON Data') |
10 parser.add_argument('external_apollo_url') | 10 parser.add_argument('external_apollo_url') |
11 | 11 |
12 args = parser.parse_args() | 12 args = parser.parse_args() |
13 | 13 |
14 # https://fqdn/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326&tracks= | 14 # https://fqdn/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326&tracks= |
15 data = json.load(args.json) | 15 data = json.load(args.json) |
16 | 16 |
17 # This is base64 encoded to get past the toolshed's filters. | 17 # This is base64 encoded to get past the toolshed's filters. |
18 HTML_TPL = """ | 18 HTML_TPL = """ |
19 <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> | 19 <html> |
20 <head> | |
21 <title>Embedded Apollo Access</title> | |
22 <style type="text/css">body {{margin: 0;}} iframe {{border: 0;width: 100%;height: 100%}}</style> | |
23 </head> | |
24 <body> | |
25 <iframe src="{base_url}/annotator/loadLink?loc={chrom}&organism={orgId}&tracklist=1"></iframe> | |
26 </body> | |
27 </html> | |
20 """ | 28 """ |
21 # HTML_TPL = base64.b64decode(HTML_TPL.replace('\n', '')) | 29 # HTML_TPL = base64.b64decode(HTML_TPL.replace('\n', '')) |
22 | 30 |
23 print HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id']) | 31 print HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id']) |