Mercurial > repos > gga > apollo_list_organism
annotate json2iframe.py @ 17:8dc690130172 draft default tip
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 12282c16658b37858f49944796fd95515ef0fc0b
author | gga |
---|---|
date | Wed, 11 Jan 2023 11:48:41 +0000 |
parents | 1cab73e6bf13 |
children |
rev | line source |
---|---|
0
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
1 #!/usr/bin/env python |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
2 from __future__ import print_function |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
3 |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
4 import argparse |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
5 import json |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
6 |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
7 |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
8 if __name__ == '__main__': |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
9 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
10 parser.add_argument('apollo', help='Complete Apollo URL') |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
11 parser.add_argument('json', type=argparse.FileType("r"), help='JSON Data') |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
12 parser.add_argument('external_apollo_url') |
9
f26ac3b582e1
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 49fe23e3fb330234900946352fbc3a86deeeb639
gga
parents:
0
diff
changeset
|
13 parser.add_argument('--tracklist', action='store_true') |
0
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
14 |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
15 args = parser.parse_args() |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
16 |
9
f26ac3b582e1
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 49fe23e3fb330234900946352fbc3a86deeeb639
gga
parents:
0
diff
changeset
|
17 # https://fqdn/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326 |
0
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
18 data = json.load(args.json) |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
19 |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
20 # This is base64 encoded to get past the toolshed's filters. |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
21 HTML_TPL = """ |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
22 <html> |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
23 <head> |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
24 <title>Embedded Apollo Access</title> |
15
1cab73e6bf13
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 7f742b16e6e4c33b9abdb633405298e05760c84b"
gga
parents:
9
diff
changeset
|
25 <style type="text/css">body {{margin: 0;}} iframe {{border: 0;width: 100%;height: 100vh}}</style> |
0
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
26 </head> |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
27 <body> |
9
f26ac3b582e1
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 49fe23e3fb330234900946352fbc3a86deeeb639
gga
parents:
0
diff
changeset
|
28 <iframe src="{base_url}/annotator/loadLink?loc={chrom}&organism={orgId}{tracklist}"></iframe> |
0
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
29 </body> |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
30 </html> |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
31 """ |
1f2e360f7554
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
32 |
15
1cab73e6bf13
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 7f742b16e6e4c33b9abdb633405298e05760c84b"
gga
parents:
9
diff
changeset
|
33 if isinstance(data, list): |
1cab73e6bf13
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 7f742b16e6e4c33b9abdb633405298e05760c84b"
gga
parents:
9
diff
changeset
|
34 print(HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id'], tracklist='&tracklist=1' if args.tracklist else '')) |
1cab73e6bf13
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 7f742b16e6e4c33b9abdb633405298e05760c84b"
gga
parents:
9
diff
changeset
|
35 else: |
1cab73e6bf13
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 7f742b16e6e4c33b9abdb633405298e05760c84b"
gga
parents:
9
diff
changeset
|
36 print(HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data['id'], tracklist='&tracklist=1' if args.tracklist else '')) |