Mercurial > repos > fubar > toolfactory_gtn
comparison toolfactory/install_tf_demos.py @ 4:2a46da701dde draft
Uploaded
| author | fubar |
|---|---|
| date | Mon, 26 Apr 2021 05:25:26 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 3:c4f192ec521c | 4:2a46da701dde |
|---|---|
| 1 import argparse | |
| 2 import urllib.request | |
| 3 | |
| 4 from bioblend import galaxy | |
| 5 | |
| 6 WF = "https://drive.google.com/uc?export=download&id=13xE8o7tucHGNA0qYkEP98FfUGl2wdOU5" | |
| 7 HIST = ( | |
| 8 "https://drive.google.com/uc?export=download&id=1V0ZN9ZBuqcGJvt2AP7s3g0q11uYEhdDB" | |
| 9 ) | |
| 10 WF_FILE = "tf_workflow.ga" | |
| 11 HIST_FILE = "tf_history.tgz" | |
| 12 | |
| 13 | |
| 14 def _parser(): | |
| 15 parser = argparse.ArgumentParser() | |
| 16 parser.add_argument( | |
| 17 "-g", "--galaxy", help="URL of target galaxy", default="http://localhost:9090" | |
| 18 ) | |
| 19 parser.add_argument("-a", "--key", help="Galaxy admin key", default=None) | |
| 20 return parser | |
| 21 | |
| 22 | |
| 23 def main(): | |
| 24 """ | |
| 25 load the planemo tool_factory demonstration history and tool generating workflow | |
| 26 fails in planemo served galaxies because there seems to be no user in trans? | |
| 27 """ | |
| 28 args = _parser().parse_args() | |
| 29 urllib.request.urlretrieve(WF, WF_FILE) | |
| 30 urllib.request.urlretrieve(HIST, HIST_FILE) | |
| 31 assert args.key, "Need an administrative key for the target Galaxy supplied please" | |
| 32 gi = galaxy.GalaxyInstance( | |
| 33 url=args.galaxy, key=args.key, email="planemo@galaxyproject.org" | |
| 34 ) | |
| 35 x = gi.workflows.import_workflow_from_local_path(WF_FILE, publish=True) | |
| 36 print(f"installed {WF_FILE} Returned = {x}\n") | |
| 37 x = gi.histories.import_history(file_path=HIST_FILE) | |
| 38 print(f"installed {HIST_FILE} Returned = {x}\n") | |
| 39 | |
| 40 | |
| 41 if __name__ == "__main__": | |
| 42 main() |
