annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
1 #!/usr/bin/env python
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
2 import json
1
f7d57e56f322 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 0f3c6e906c4d32843f451990b55bfa2954235a42
eric-rasche
parents: 0
diff changeset
3 import base64
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
4 import argparse
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
5
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
6 if __name__ == '__main__':
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
7 parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services')
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
8 parser.add_argument('apollo', help='Complete Apollo URL')
5
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
9 parser.add_argument('json', type=argparse.FileType("r"), help='JSON Data')
3
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 1
diff changeset
10 parser.add_argument('external_apollo_url')
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
11
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
12 args = parser.parse_args()
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
13
3
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 1
diff changeset
14 # https://fqdn/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326&tracks=
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
15 data = json.load(args.json)
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
16
1
f7d57e56f322 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 0f3c6e906c4d32843f451990b55bfa2954235a42
eric-rasche
parents: 0
diff changeset
17 # This is base64 encoded to get past the toolshed's filters.
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
18 HTML_TPL = """
5
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
19 <html>
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
20 <head>
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
21 <title>Embedded Apollo Access</title>
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
22 <style type="text/css">body {{margin: 0;}} iframe {{border: 0;width: 100%;height: 100%}}</style>
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
23 </head>
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
24 <body>
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
25 <iframe src="{base_url}/annotator/loadLink?loc={chrom}&organism={orgId}&tracklist=1"></iframe>
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
26 </body>
7610987e0c48 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
eric-rasche
parents: 4
diff changeset
27 </html>
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
28 """
4
23ead6905145 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5-dirty
eric-rasche
parents: 3
diff changeset
29 # HTML_TPL = base64.b64decode(HTML_TPL.replace('\n', ''))
0
6002cc0df04e planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff changeset
30
3
d4ae83dedb14 planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents: 1
diff changeset
31 print HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id'])