Mercurial > repos > eric-rasche > apollo
annotate json2iframe.py @ 4:23ead6905145 draft
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5-dirty
author | eric-rasche |
---|---|
date | Thu, 12 Jan 2017 11:53:44 -0500 |
parents | d4ae83dedb14 |
children | 7610987e0c48 |
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') |
6002cc0df04e
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff
changeset
|
9 parser.add_argument('json', type=file, 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 = """ |
4
23ead6905145
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5-dirty
eric-rasche
parents:
3
diff
changeset
|
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> |
0
6002cc0df04e
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4e5a5af7689f1713c34a6ad9a9594c205e762fdd
eric-rasche
parents:
diff
changeset
|
20 """ |
4
23ead6905145
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5-dirty
eric-rasche
parents:
3
diff
changeset
|
21 # 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
|
22 |
3
d4ae83dedb14
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 4ac38d0b6dba1183f3e78eb5c224c7051064b4a5
eric-rasche
parents:
1
diff
changeset
|
23 print HTML_TPL.format(base_url=args.external_apollo_url, chrom="", orgId=data[0]['id']) |