1
+ package edu .ucsd .sbrg .bigg .annotation ;
2
+
3
+ import edu .ucsd .sbrg .TestUtils ;
4
+ import org .junit .jupiter .api .BeforeEach ;
5
+ import org .junit .jupiter .api .Test ;
6
+ import org .sbml .jsbml .CVTerm ;
7
+ import org .sbml .jsbml .Model ;
8
+ import org .sbml .jsbml .ext .fbc .FBCConstants ;
9
+ import org .sbml .jsbml .ext .fbc .FBCSpeciesPlugin ;
10
+
11
+ import java .util .Set ;
12
+
13
+ import static edu .ucsd .sbrg .TestUtils .assertCVTermIsPresent ;
14
+ import static edu .ucsd .sbrg .TestUtils .assertCVTermsArePresent ;
15
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
16
+
17
+ public class SpeciesAnnotationTest extends BiGGDBTest {
18
+
19
+ @ BeforeEach
20
+ public void init () {
21
+ TestUtils .initParameters ();
22
+ }
23
+
24
+ @ Test
25
+ public void basicAnnotationTest () {
26
+ var m = new Model (3 , 2 );
27
+ var s = m .createSpecies ("atp" );
28
+ var sFbcPlugin = (FBCSpeciesPlugin ) s .getPlugin (FBCConstants .shortLabel );
29
+
30
+ var annotator = new SpeciesAnnotation (s );
31
+ annotator .annotate ();
32
+
33
+ assertEquals ("atp" , s .getId ());
34
+ assertEquals ("ATP C10H12N5O13P3" , s .getName ());
35
+ assertEquals ("SBO:0000240" , s .getSBOTermID ());
36
+ assertCVTermIsPresent (s ,
37
+ CVTerm .Type .BIOLOGICAL_QUALIFIER ,
38
+ CVTerm .Qualifier .BQB_IS ,
39
+ "https://identifiers.org/bigg.metabolite/atp" );
40
+ assertEquals (null , sFbcPlugin .getChemicalFormula ());
41
+ }
42
+
43
+ @ Test
44
+ public void unknownMetaboliteCanBeInferredFromId () {
45
+ var m = new Model (3 , 2 );
46
+ var s = m .createSpecies ("atp_c" );
47
+
48
+ var annotator = new SpeciesAnnotation (s );
49
+ annotator .annotate ();
50
+
51
+ assertEquals ("atp_c" , s .getId ());
52
+ assertEquals ("ATP C10H12N5O13P3" , s .getName ());
53
+ assertEquals ("SBO:0000240" , s .getSBOTermID ());
54
+ assertCVTermsArePresent (s ,
55
+ CVTerm .Type .BIOLOGICAL_QUALIFIER ,
56
+ CVTerm .Qualifier .BQB_IS ,
57
+ expectedATPAnnotations ,
58
+ "Expected annotations are not present." );
59
+ }
60
+
61
+ @ Test
62
+ public void unknownMetaboliteCanBeInferredFromCV () {
63
+ var m = new Model (3 , 2 );
64
+ var s = m .createSpecies ("big_chungus" );
65
+
66
+ var cvTerm = new CVTerm ();
67
+ cvTerm .setQualifier (CVTerm .Qualifier .BQB_IS );
68
+ cvTerm .addResource ("http://identifiers.org/reactome.compound/113592" );
69
+ s .addCVTerm (cvTerm );
70
+
71
+ var annotator = new SpeciesAnnotation (s );
72
+ annotator .annotate ();
73
+
74
+ assertEquals ("big_chungus" , s .getId ());
75
+ assertEquals ("ATP C10H12N5O13P3" , s .getName ());
76
+ assertEquals ("SBO:0000240" , s .getSBOTermID ());
77
+ assertEquals (1 , s .getCVTermCount ());
78
+ assertEquals (30 , s .getCVTerm (0 ).getNumResources ());
79
+ assertCVTermIsPresent (s ,
80
+ CVTerm .Type .BIOLOGICAL_QUALIFIER ,
81
+ CVTerm .Qualifier .BQB_IS ,
82
+ "http://identifiers.org/reactome.compound/113592" );
83
+ assertCVTermsArePresent (s ,
84
+ CVTerm .Type .BIOLOGICAL_QUALIFIER ,
85
+ CVTerm .Qualifier .BQB_IS ,
86
+ expectedATPAnnotations ,
87
+ "Expected uris are not present." );
88
+ }
89
+
90
+ private static Set <String > expectedATPAnnotations = Set .of (
91
+ "https://identifiers.org/bigg.metabolite/atp" ,
92
+ "https://identifiers.org/biocyc/META:ATP" ,
93
+ "https://identifiers.org/chebi/CHEBI:10789" ,
94
+ "https://identifiers.org/chebi/CHEBI:10841" ,
95
+ "https://identifiers.org/chebi/CHEBI:13236" ,
96
+ "https://identifiers.org/chebi/CHEBI:15422" ,
97
+ "https://identifiers.org/chebi/CHEBI:22249" ,
98
+ "https://identifiers.org/chebi/CHEBI:2359" ,
99
+ "https://identifiers.org/chebi/CHEBI:237958" ,
100
+ "https://identifiers.org/chebi/CHEBI:30616" ,
101
+ "https://identifiers.org/chebi/CHEBI:40938" ,
102
+ "https://identifiers.org/chebi/CHEBI:57299" ,
103
+ "https://identifiers.org/hmdb/HMDB00538" ,
104
+ "https://identifiers.org/inchikey/ZKHQWZAMYRWXGA-KQYNXXCUSA-J" ,
105
+ "https://identifiers.org/kegg.compound/C00002" ,
106
+ "https://identifiers.org/kegg.drug/D08646" ,
107
+ "https://identifiers.org/metanetx.chemical/MNXM3" ,
108
+ "https://identifiers.org/reactome/R-ALL-113592" ,
109
+ "https://identifiers.org/reactome/R-ALL-113593" ,
110
+ "https://identifiers.org/reactome/R-ALL-211579" ,
111
+ "https://identifiers.org/reactome/R-ALL-29358" ,
112
+ "https://identifiers.org/reactome/R-ALL-389573" ,
113
+ "https://identifiers.org/reactome/R-ALL-5632460" ,
114
+ "https://identifiers.org/reactome/R-ALL-5696069" ,
115
+ "https://identifiers.org/reactome/R-ALL-6798184" ,
116
+ "https://identifiers.org/reactome/R-ALL-8869363" ,
117
+ "https://identifiers.org/reactome/R-ALL-8878982" ,
118
+ "https://identifiers.org/reactome/R-ALL-8938081" ,
119
+ "https://identifiers.org/seed.compound/cpd00002" );
120
+
121
+ /**
122
+ * Note this serves to document the behaviour discussed in
123
+ * https://github.com/draeger-lab/ModelPolisher/issues/89
124
+ *
125
+ * The annotations as are should likely not be considered correct.
126
+ */
127
+ @ Test
128
+ public void H2OAnnotationTest () {
129
+ var m = new Model (3 , 2 );
130
+ var s = m .createSpecies ("h2o" );
131
+ var sFbcPlugin = (FBCSpeciesPlugin ) s .getPlugin (FBCConstants .shortLabel );
132
+
133
+ var annotator = new SpeciesAnnotation (s );
134
+ annotator .annotate ();
135
+
136
+ assertEquals ("h2o" , s .getId ());
137
+ assertEquals ("H2O H2O" , s .getName ());
138
+ assertEquals ("SBO:0000240" , s .getSBOTermID ());
139
+ assertEquals (null , sFbcPlugin .getChemicalFormula ());
140
+ assertCVTermsArePresent (s ,
141
+ CVTerm .Type .BIOLOGICAL_QUALIFIER ,
142
+ CVTerm .Qualifier .BQB_IS ,
143
+ Set .of ("https://identifiers.org/bigg.metabolite/h2o" ,
144
+ "https://identifiers.org/biocyc/META:CPD-15815" ,
145
+ "https://identifiers.org/biocyc/META:HYDROXYL-GROUP" ,
146
+ "https://identifiers.org/biocyc/META:OH" ,
147
+ "https://identifiers.org/biocyc/META:OXONIUM" ,
148
+ "https://identifiers.org/biocyc/META:WATER" ,
149
+ "https://identifiers.org/chebi/CHEBI:10743" ,
150
+ "https://identifiers.org/chebi/CHEBI:13352" ,
151
+ "https://identifiers.org/chebi/CHEBI:13365" ,
152
+ "https://identifiers.org/chebi/CHEBI:13419" ,
153
+ "https://identifiers.org/chebi/CHEBI:15377" ,
154
+ "https://identifiers.org/chebi/CHEBI:16234" ,
155
+ "https://identifiers.org/chebi/CHEBI:27313" ,
156
+ "https://identifiers.org/chebi/CHEBI:29356" ,
157
+ "https://identifiers.org/chebi/CHEBI:29412" ,
158
+ "https://identifiers.org/chebi/CHEBI:30490" ,
159
+ "https://identifiers.org/chebi/CHEBI:33813" ,
160
+ "https://identifiers.org/chebi/CHEBI:42043" ,
161
+ "https://identifiers.org/chebi/CHEBI:42857" ,
162
+ "https://identifiers.org/chebi/CHEBI:43228" ,
163
+ "https://identifiers.org/chebi/CHEBI:44292" ,
164
+ "https://identifiers.org/chebi/CHEBI:44641" ,
165
+ "https://identifiers.org/chebi/CHEBI:44701" ,
166
+ "https://identifiers.org/chebi/CHEBI:44819" ,
167
+ "https://identifiers.org/chebi/CHEBI:5585" ,
168
+ "https://identifiers.org/chebi/CHEBI:5594" ,
169
+ "https://identifiers.org/hmdb/HMDB01039" ,
170
+ "https://identifiers.org/hmdb/HMDB02111" ,
171
+ "https://identifiers.org/inchikey/XLYOFNOQVPJJNP-UHFFFAOYSA-N" ,
172
+ "https://identifiers.org/kegg.compound/C00001" ,
173
+ "https://identifiers.org/kegg.compound/C01328" ,
174
+ "https://identifiers.org/kegg.drug/D00001" ,
175
+ "https://identifiers.org/kegg.drug/D06322" ,
176
+ "https://identifiers.org/metanetx.chemical/MNXM2" ,
177
+ "https://identifiers.org/reactome/R-ALL-109276" ,
178
+ "https://identifiers.org/reactome/R-ALL-113518" ,
179
+ "https://identifiers.org/reactome/R-ALL-113519" ,
180
+ "https://identifiers.org/reactome/R-ALL-113521" ,
181
+ "https://identifiers.org/reactome/R-ALL-141343" ,
182
+ "https://identifiers.org/reactome/R-ALL-1605715" ,
183
+ "https://identifiers.org/reactome/R-ALL-189422" ,
184
+ "https://identifiers.org/reactome/R-ALL-2022884" ,
185
+ "https://identifiers.org/reactome/R-ALL-29356" ,
186
+ "https://identifiers.org/reactome/R-ALL-351603" ,
187
+ "https://identifiers.org/reactome/R-ALL-5278291" ,
188
+ "https://identifiers.org/reactome/R-ALL-5668574" ,
189
+ "https://identifiers.org/reactome/R-ALL-5693747" ,
190
+ "https://identifiers.org/reactome/R-ALL-8851517" ,
191
+ "https://identifiers.org/seed.compound/cpd00001" ,
192
+ "https://identifiers.org/seed.compound/cpd15275" ,
193
+ "https://identifiers.org/seed.compound/cpd27222" ),
194
+ "Expected annotations not on H2O." );
195
+
196
+ }
197
+
198
+
199
+ }
0 commit comments