Mercurial > repos > ggricourt > data_manager_bigg
annotate data_manager/bigg_model_sbml_fetcher.py @ 10:a9f72fd191b5 draft
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
| author | ggricourt |
|---|---|
| date | Thu, 24 Feb 2022 12:05:43 +0000 |
| parents | e2f2977b1675 |
| children | 2bb0d8ca1710 |
| 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 |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
43 def get_model_organism(model_id): |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
44 data = url_json(MODEL_DETAIL_URL + model_id) |
|
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
45 org = data.get("organism", "") |
|
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
46 if org is None: |
|
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
47 org = "" |
|
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
48 res = "%s - %s" % (model_id, org) |
|
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
49 return res |
|
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
50 |
|
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
51 |
|
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
52 def download_entries(model_ids, workdir): |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
53 for model_id in model_ids: |
|
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
54 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
|
55 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
|
56 |
|
6
65589e7476b6
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
5
diff
changeset
|
57 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
|
58 data_manager_entry = {} |
|
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
59 data_manager_entry["value"] = model_id |
|
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
60 data_manager_entry["name"] = get_model_organism(model_id) |
|
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
61 data_manager_entry["path"] = path |
|
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
62 |
|
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
63 # Make sure that less than 10 requests per second, as required by host (http://bigg.ucsd.edu/data_access) |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
64 time.sleep(1) |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
65 yield data_manager_entry |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
66 |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
67 |
|
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
68 if __name__ == "__main__": |
|
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
69 parser = argparse.ArgumentParser() |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
70 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
|
71 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
|
72 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
|
73 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
|
74 args = parser.parse_args() |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
75 |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
76 # Init. |
|
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
77 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
|
78 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
|
79 params = json.load(fh) |
|
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
80 |
|
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
81 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
|
82 os.makedirs(workdir) |
|
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
83 |
|
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
84 model_ids = [] |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
85 if args.model_id: |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
86 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
|
87 else: |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
88 data = url_json(MODEL_DETAIL_URL) |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
89 for result in data.get("results", []): |
|
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
90 model_ids.append(result.get("bigg_id")) |
|
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
91 |
|
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
92 entries = list(download_entries(model_ids, workdir)) |
|
0
262b8d79bc08
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 19ad973add8651c1a18c1bda789e9296a57044b1"
ggricourt
parents:
diff
changeset
|
93 |
|
5
5e6f76507721
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
3
diff
changeset
|
94 # Write data. |
|
10
a9f72fd191b5
"planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 47caed1dd87e80ae226fabb584e9d63d7c86a436-dirty"
ggricourt
parents:
9
diff
changeset
|
95 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
|
96 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
|
97 json.dump(data_manager_json, fh, sort_keys=True) |
