Mercurial > repos > ggricourt > data_manager_bigg
annotate data_manager/bigg_model_sbml_fetcher.py @ 15:44119168868c draft default tip
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 7db54c0555a12ecb8b3f756032228c54fe028e0a-dirty"
author | ggricourt |
---|---|
date | Wed, 09 Mar 2022 15:44:01 +0000 |
parents | e339b8d84de0 |
children |
rev | line source |
---|---|
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
1 import argparse |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
2 import json |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
3 import os |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
4 import sys |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
5 import time |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
6 try: |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
7 # For Python 3.0 and later |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
8 from urllib.request import Request, urlopen |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
9 except ImportError: |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
10 # Fall back to Python 2 imports |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
11 from urllib2 import Request, urlopen |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
12 |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
13 |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
14 MODEL_URL = "http://bigg.ucsd.edu/static/models/" |
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
15 MODEL_DETAIL_URL = "http://bigg.ucsd.edu/api/v2/models/" |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
16 |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
17 |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
18 def url_download(url, path): |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
19 try: |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
20 with urlopen(Request(url)) as fod: |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
21 with open(path, "wb") as dst: |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
22 while True: |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
23 chunk = fod.read(2**10) |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
24 if chunk: |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
25 dst.write(chunk) |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
26 else: |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
27 break |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
28 except Exception as e: |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
29 sys.exit(str(e)) |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
30 |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
31 |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
32 def url_json(url): |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
33 data = {} |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
34 try: |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
35 with urlopen(Request(url)) as fod: |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
36 data = fod.read().decode("utf-8") |
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
37 data = json.loads(data) |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
38 except Exception as e: |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
39 sys.exit(str(e)) |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
40 return data |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
41 |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
42 |
11
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
43 def download_entries(model_ids, id2org, workdir): |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
44 for ix, model_id in enumerate(model_ids): |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
45 model_filename = model_id + ".xml" |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
46 path = os.path.abspath(os.path.join(workdir, model_filename)) |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
47 |
6
65589e7476b6
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
5
diff
changeset
|
48 url_download(MODEL_URL + model_filename, path) |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
49 data_manager_entry = {} |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
50 data_manager_entry["value"] = model_id |
12
e339b8d84de0
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
11
diff
changeset
|
51 data_manager_entry["name"] = model_id + " - " + id2org[model_id] |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
52 data_manager_entry["path"] = path |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
53 |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
54 # Make sure that less than 10 requests per second, as required by host (http://bigg.ucsd.edu/data_access) |
11
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
55 if ix % 5 == 0: |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
56 time.sleep(1) |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
57 yield data_manager_entry |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
58 |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
59 |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
60 if __name__ == "__main__": |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
61 parser = argparse.ArgumentParser() |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
62 pinput = parser.add_mutually_exclusive_group(required=True) |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
63 pinput.add_argument("--model-id", help="Model BIGG id") |
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
64 pinput.add_argument("--model-all", action="store_true", help="Download all models") |
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
65 parser.add_argument("--out-file", help="JSON output file") |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
66 args = parser.parse_args() |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
67 |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
68 # Init. |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
69 data_manager_json = {"data_tables": {}} |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
70 with open(args.out_file) as fh: |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
71 params = json.load(fh) |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
72 |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
73 workdir = params["output_data"][0]["extra_files_path"] |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
74 os.makedirs(workdir) |
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
75 |
11
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
76 # Load models and models metadata. |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
77 models = url_json(MODEL_DETAIL_URL) |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
78 id2org = {} |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
79 for result in models.get("results", []): |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
80 ident = result["bigg_id"] |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
81 ident = ident.replace(" ", "") |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
82 id2org[ident] = result["organism"] |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
83 |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
84 # Select model_ids. |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
85 model_ids = [] |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
86 if args.model_id: |
11
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
87 if args.model_id not in id2org.keys(): |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
88 sys.exit("Model id: %s is not available" % (args.model_id,)) |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
89 model_ids.append(args.model_id) |
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
90 else: |
11
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
91 model_ids.extend(list(id2org.keys())) |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
92 |
11
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
93 # Download. |
2bb0d8ca1710
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
10
diff
changeset
|
94 entries = list(download_entries(model_ids, id2org, workdir)) |
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
95 |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
96 # Write data. |
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
97 data_manager_json["data_tables"]["bigg_model_sbml"] = entries |
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
98 with open(args.out_file, "w") as fh: |
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
99 json.dump(data_manager_json, fh, sort_keys=True) |