Skip to content

Commit

Permalink
response to review
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlandry committed Jun 8, 2023
1 parent 771cc7a commit 004c199
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 5 additions & 2 deletions tests/readwrite/test_bigg_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def test_load_bigg_data(capfd):
assert H1.num_nodes == 1668
assert H1.num_edges == 2382
assert H1["name"] == "iAF1260"
assert H1.nodes["2agpg161_c"] == {'name': '2-Acyl-sn-glycero-3-phosphoglycerol (n-C16:1)'}
assert H1["organism"] == "Escherichia coli str. K-12 substr. MG1655"
assert H1.nodes["2agpg161_c"] == {
"name": "2-Acyl-sn-glycero-3-phosphoglycerol (n-C16:1)"
}

H2 = load_bigg_data("iAF1260", cache=True)
assert H1.nodes == H2.nodes
Expand All @@ -24,4 +27,4 @@ def test_load_bigg_data(capfd):
assert "iAF1260" in out

with pytest.raises(XGIError):
load_bigg_data("test")
load_bigg_data("test")
8 changes: 2 additions & 6 deletions xgi/readwrite/bigg_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,8 @@ def _bigg_to_dihypergraph(d_index, d_model):
id = d_model["id"]

DH["name"] = id

for d in d_index["results"]:
if d["bigg_id"] == id:
DH["organism"] = d["organism"]
break

info = next((item for item in d_index["results"] if item["bigg_id"] == id), None)
DH["organism"] = info["organism"]
for m in d_model["metabolites"]:
DH.add_node(m["id"], name=m["name"])

Expand Down

0 comments on commit 004c199

Please sign in to comment.