Skip to content

Commit 42af7e9

Browse files
akaviaLaburi.akavia
andauthored
refactoring and fixes for MAT model parsing (#1220)
* changes in mat.py to read with the right terms changes to sbml.py to read annotations as list improved validate.py so it won't fail with new files modified annotation.xml, e_coli_core.xml to have more correct XML files and less errors compared to mat file modified true values in test_annotation.py and test_sbml.py * updated pickles got sbml to add the SBO term for subsystem updated wrong_key_caps.mat file and the associated test * tidying of mat.py mostly from_mat_struct() minor tidying of sbml.py, test_mat.py some tidying and flake8 correction of test_sbml.py * modified example_notes.xml to have no difference when saving/reading to MATLAB Fixed some issues in mat.py Made SBML read groups into subsystem. Made SBML have group annotations as list * subsystems should have group name if availabe SBML will set undefined formula and model name as None * black and updated pickles * forgot black on one file * fix gitignore * reverted list changes as discussed * changes in annotation of files * corrected according to comments * fixed typo Co-authored-by: uri.akavia <[email protected]>
1 parent 7c82aeb commit 42af7e9

28 files changed

+398
-482
lines changed

release-notes/next-release.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
## Fixes
66

7+
* Reformatted example files (e_coli_core.xml, mini_cobra.xml, mini.json, mini.yml, textbook.xml.gz) to be more compliant with identifiers.org. ncbigi is not a valid identifiers.org, so it was replaced with ncbiprotein.
8+
* make sbml.py subsystem reading add partonomy, which matches the definition
9+
of SBO:0000633 (see https://sourceforge.net/p/sbo/term-request/113/)
10+
* Correct reading and writing of subsystem in mat.
11+
* General cleanup of code in mat.py
12+
713
## Other
814

915
* Resolve `flake8` issues and add missing type annotations and docstrings in `src/cobra/io` and `tests/test_io` (#1212).

src/cobra/data/mini.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
},
2727
{
2828
"annotation": {
29-
"ncbigi": [
30-
"GI:1208453",
31-
"GI:1652654"
29+
"ncbiprotein": [
30+
"1208453",
31+
"1652654"
3232
]
3333
},
3434
"id": "b1676",
@@ -84,7 +84,7 @@
8484
},
8585
{
8686
"annotation": {
87-
"ncbigi": "GI:1653839"
87+
"ncbiprotein": "1653839"
8888
},
8989
"id": "b2779",
9090
"name": "eno"
@@ -95,7 +95,7 @@
9595
},
9696
{
9797
"annotation": {
98-
"ncbigi": "GI:1653609"
98+
"ncbiprotein": "1653609"
9999
},
100100
"id": "b2926",
101101
"name": "pgk"
@@ -114,9 +114,9 @@
114114
},
115115
{
116116
"annotation": {
117-
"ncbigi": [
118-
"GI:1006614",
119-
"GI:1651919"
117+
"ncbiprotein": [
118+
"1006614",
119+
"1651919"
120120
]
121121
},
122122
"id": "b3916",
@@ -128,7 +128,7 @@
128128
},
129129
{
130130
"annotation": {
131-
"ncbigi": "GI:1653253"
131+
"ncbiprotein": "1653253"
132132
},
133133
"id": "b4025",
134134
"name": "pgi"
@@ -1278,6 +1278,7 @@
12781278
"pyr_c": 1.0
12791279
},
12801280
"name": "D-lactate dehydrogenase",
1281+
"subsystem": "Pyruvate Metabolism",
12811282
"upper_bound": 1000.0
12821283
},
12831284
{

src/cobra/data/mini.mat

36.7 KB
Binary file not shown.

src/cobra/data/mini.pickle

-814 Bytes
Binary file not shown.

src/cobra/data/mini.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@
960960
- lower_bound: -1000.0
961961
- upper_bound: 1000.0
962962
- gene_reaction_rule: b2133 or b1380
963+
- subsystem: Pyruvate Metabolism
963964
- annotation: !!omap
964965
- bigg.reaction: LDH_D
965966
- biocyc: META:DLACTDEHYDROGNAD-RXN
@@ -1080,9 +1081,9 @@
10801081
- id: b1676
10811082
- name: pykF
10821083
- annotation: !!omap
1083-
- ncbigi:
1084-
- GI:1208453
1085-
- GI:1652654
1084+
- ncbiprotein:
1085+
- '1208453'
1086+
- '1652654'
10861087
- !!omap
10871088
- id: b1723
10881089
- name: pfkB
@@ -1123,15 +1124,15 @@
11231124
- id: b2779
11241125
- name: eno
11251126
- annotation: !!omap
1126-
- ncbigi: GI:1653839
1127+
- ncbiprotein: '1653839'
11271128
- !!omap
11281129
- id: b2925
11291130
- name: fbaA
11301131
- !!omap
11311132
- id: b2926
11321133
- name: pgk
11331134
- annotation: !!omap
1134-
- ncbigi: GI:1653609
1135+
- ncbiprotein: '1653609'
11351136
- !!omap
11361137
- id: b2987
11371138
- name: pitB
@@ -1145,17 +1146,17 @@
11451146
- id: b3916
11461147
- name: pfkA
11471148
- annotation: !!omap
1148-
- ncbigi:
1149-
- GI:1006614
1150-
- GI:1651919
1149+
- ncbiprotein:
1150+
- '1006614'
1151+
- '1651919'
11511152
- !!omap
11521153
- id: b3919
11531154
- name: tpiA
11541155
- !!omap
11551156
- id: b4025
11561157
- name: pgi
11571158
- annotation: !!omap
1158-
- ncbigi: GI:1653253
1159+
- ncbiprotein: '1653253'
11591160
- !!omap
11601161
- id: b4395
11611162
- name: ytjC

src/cobra/data/mini_cobra.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<sbml xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns="http://www.sbml.org/sbml/level3/version1/core" sboTerm="SBO:0000624" level="3" version="1" fbc:required="false">
2+
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" sboTerm="SBO:0000624" level="3" version="1" fbc:required="false">
33
<model metaid="meta_mini_textbook" id="mini_textbook" fbc:strict="true">
44
<listOfUnitDefinitions>
55
<unitDefinition id="mmol_per_gDW_per_hr">
@@ -1333,8 +1333,8 @@
13331333
<rdf:Description rdf:about="#meta_G_b1676">
13341334
<bqbiol:is>
13351335
<rdf:Bag>
1336-
<rdf:li rdf:resource="https://identifiers.org/ncbigi/GI:1208453"/>
1337-
<rdf:li rdf:resource="https://identifiers.org/ncbigi/GI:1652654"/>
1336+
<rdf:li rdf:resource="https://identifiers.org/ncbiprotein/1208453"/>
1337+
<rdf:li rdf:resource="https://identifiers.org/ncbiprotein/1652654"/>
13381338
</rdf:Bag>
13391339
</bqbiol:is>
13401340
</rdf:Description>
@@ -1359,7 +1359,7 @@
13591359
<rdf:Description rdf:about="#meta_G_b2779">
13601360
<bqbiol:is>
13611361
<rdf:Bag>
1362-
<rdf:li rdf:resource="https://identifiers.org/ncbigi/GI:1653839"/>
1362+
<rdf:li rdf:resource="https://identifiers.org/ncbiprotein/1653839"/>
13631363
</rdf:Bag>
13641364
</bqbiol:is>
13651365
</rdf:Description>
@@ -1373,7 +1373,7 @@
13731373
<rdf:Description rdf:about="#meta_G_b2926">
13741374
<bqbiol:is>
13751375
<rdf:Bag>
1376-
<rdf:li rdf:resource="https://identifiers.org/ncbigi/GI:1653609"/>
1376+
<rdf:li rdf:resource="https://identifiers.org/ncbiprotein/1653609"/>
13771377
</rdf:Bag>
13781378
</bqbiol:is>
13791379
</rdf:Description>
@@ -1389,8 +1389,8 @@
13891389
<rdf:Description rdf:about="#meta_G_b3916">
13901390
<bqbiol:is>
13911391
<rdf:Bag>
1392-
<rdf:li rdf:resource="https://identifiers.org/ncbigi/GI:1006614"/>
1393-
<rdf:li rdf:resource="https://identifiers.org/ncbigi/GI:1651919"/>
1392+
<rdf:li rdf:resource="https://identifiers.org/ncbiprotein/1006614"/>
1393+
<rdf:li rdf:resource="https://identifiers.org/ncbiprotein/1651919"/>
13941394
</rdf:Bag>
13951395
</bqbiol:is>
13961396
</rdf:Description>
@@ -1404,7 +1404,7 @@
14041404
<rdf:Description rdf:about="#meta_G_b4025">
14051405
<bqbiol:is>
14061406
<rdf:Bag>
1407-
<rdf:li rdf:resource="https://identifiers.org/ncbigi/GI:1653253"/>
1407+
<rdf:li rdf:resource="https://identifiers.org/ncbiprotein/1653253"/>
14081408
</rdf:Bag>
14091409
</bqbiol:is>
14101410
</rdf:Description>

src/cobra/data/textbook.xml.gz

1.32 KB
Binary file not shown.

0 commit comments

Comments
 (0)