119
|
1 import argparse
|
|
2 import os
|
|
3 import subprocess
|
|
4 import sys
|
|
5 import urllib.request
|
|
6
|
|
7 from bioblend import galaxy
|
|
8
|
|
9 WF = "https://drive.google.com/uc?export=download&id=13xE8o7tucHGNA0qYkEP98FfUGl2wdOU5"
|
|
10 HIST = (
|
|
11 "https://drive.google.com/uc?export=download&id=1V0ZN9ZBuqcGJvt2AP7s3g0q11uYEhdDB"
|
|
12 )
|
|
13 WF_FILE = "tf_workflow.ga"
|
|
14 HIST_FILE = "tf_history.tgz"
|
|
15
|
|
16
|
|
17 def _parser():
|
|
18 parser = argparse.ArgumentParser()
|
|
19 parser.add_argument(
|
|
20 "-g", "--galaxy", help="URL of target galaxy", default="http://localhost:9090"
|
|
21 )
|
|
22 parser.add_argument("-a", "--key", help="Galaxy admin key", default=None)
|
|
23 return parser
|
|
24
|
|
25
|
|
26 def main():
|
|
27 """
|
|
28 load the planemo tool_factory demonstration history and tool generating workflow
|
|
29 fails in planemo served galaxies because there seems to be no user in trans?
|
|
30 """
|
|
31 args = _parser().parse_args()
|
|
32 urllib.request.urlretrieve(WF, WF_FILE)
|
|
33 urllib.request.urlretrieve(HIST, HIST_FILE)
|
|
34 assert args.key, "Need an administrative key for the target Galaxy supplied please"
|
|
35 wfp = os.path.abspath(WF_FILE)
|
|
36 hp = os.path.abspath(HIST_FILE)
|
|
37 gi = galaxy.GalaxyInstance(
|
|
38 url=args.galaxy, key=args.key, email="planemo@galaxyproject.org"
|
|
39 )
|
|
40 x = gi.workflows.import_workflow_from_local_path(WF_FILE, publish=True)
|
|
41 print(f"installed {WF_FILE} Returned = {x}\n")
|
|
42 x = gi.histories.import_history(file_path=HIST_FILE)
|
|
43 print(f"installed {HIST_FILE} Returned = {x}\n")
|
|
44
|
|
45
|
|
46 if __name__ == "__main__":
|
|
47 main()
|