diff json2iframe.py @ 0:f889e757ca93 draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
author gga
date Mon, 11 Sep 2017 05:45:08 -0400
parents
children 0c3a940da13d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/json2iframe.py	Mon Sep 11 05:45:08 2017 -0400
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+from __future__ import print_function
+
+import argparse
+import json
+
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services')
+    parser.add_argument('apollo', help='Complete Apollo URL')
+    parser.add_argument('json', type=argparse.FileType("r"), help='JSON Data')
+    parser.add_argument('external_apollo_url')
+
+    args = parser.parse_args()
+
+    # https://fqdn/apollo/annotator/loadLink?loc=NC_005880:0..148317&organism=326&tracks=
+    data = json.load(args.json)
+
+    # This is base64 encoded to get past the toolshed's filters.
+    HTML_TPL = """
+        <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>
+    """
+
+    print(HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id']))