Mercurial > repos > eric-rasche > apollo
comparison json2iframe.py @ 3:d4ae83dedb14 draft
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
author | eric-rasche |
---|---|
date | Thu, 12 Jan 2017 11:52:28 -0500 |
parents | f7d57e56f322 |
children | 23ead6905145 |
comparison
equal
deleted
inserted
replaced
2:c8e16c8eff98 | 3:d4ae83dedb14 |
---|---|
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=file, help='JSON Data') |
10 parser.add_argument('external_apollo_url') | |
10 | 11 |
11 args = parser.parse_args() | 12 args = parser.parse_args() |
12 | 13 |
13 | 14 # https://fqdn/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326&tracks= |
14 # https://cpt.tamu.edu/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326&tracks= | |
15 data = json.load(args.json) | 15 data = json.load(args.json) |
16 print data | |
17 if len(data) > 1: | |
18 raise Exception("More than one organism listed. Contact your local admin for help.") | |
19 | 16 |
20 # This is base64 encoded to get past the toolshed's filters. | 17 # This is base64 encoded to get past the toolshed's filters. |
21 HTML_TPL = """ | 18 HTML_TPL = """ |
22 PGh0bWw+PGhlYWQ+PHRpdGxlPkVtYmVkZGVkIEFwb2xsbyBBY2Nlc3M8L3RpdGxlPjxzdHlsZSB0 | 19 PGh0bWw+PGhlYWQ+PHRpdGxlPkVtYmVkZGVkIEFwb2xsbyBBY2Nlc3M8L3RpdGxlPjxzdHlsZSB0 |
23 eXBlPSJ0ZXh0L2NzcyI+Ym9keSB7e21hcmdpbjogMDt9fSBpZnJhbWUge3tib3JkZXI6IDA7d2lk | 20 eXBlPSJ0ZXh0L2NzcyI+Ym9keSB7e21hcmdpbjogMDt9fSBpZnJhbWUge3tib3JkZXI6IDA7d2lk |
25 e2Jhc2VfdXJsfS9hbm5vdGF0b3IvbG9hZExpbms/bG9jPXtjaHJvbX0mb3JnYW5pc209e29yZ0lk | 22 e2Jhc2VfdXJsfS9hbm5vdGF0b3IvbG9hZExpbms/bG9jPXtjaHJvbX0mb3JnYW5pc209e29yZ0lk |
26 fSZ0cmFja2xpc3Q9MSI+PC9pZnJhbWU+PC9ib2R5PjwvaHRtbD4K | 23 fSZ0cmFja2xpc3Q9MSI+PC9pZnJhbWU+PC9ib2R5PjwvaHRtbD4K |
27 """ | 24 """ |
28 HTML_TPL = base64.b64decode(HTML_TPL.replace('\n', '')) | 25 HTML_TPL = base64.b64decode(HTML_TPL.replace('\n', '')) |
29 | 26 |
30 print HTML_TPL.format(base_url=args.apollo, chrom="", orgId=data[0]['id']) | 27 print HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id']) |