-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
src/test/java/edu/ucsd/sbrg/bigg/annotation/ReactionAnnotationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package edu.ucsd.sbrg.bigg.annotation; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.sbml.jsbml.CVTerm; | ||
import org.sbml.jsbml.Model; | ||
import org.sbml.jsbml.ext.fbc.FBCConstants; | ||
import org.sbml.jsbml.ext.fbc.FBCReactionPlugin; | ||
import org.sbml.jsbml.ext.fbc.GeneProductRef; | ||
import org.sbml.jsbml.ext.groups.GroupsConstants; | ||
import org.sbml.jsbml.ext.groups.GroupsModelPlugin; | ||
import org.sbml.jsbml.ext.groups.Member; | ||
|
||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
import static edu.ucsd.sbrg.TestUtils.initParameters; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class ReactionAnnotationTest extends BiGGDBTest { | ||
|
||
@Test | ||
public void getBiGGIdFromResourcesTest() { | ||
initParameters(); | ||
var m = new Model("iJO1366", 3, 2); | ||
var r1 = m.createReaction("some_name"); | ||
var r2 = m.createReaction("some_other_name"); | ||
var r3 = m.createReaction("some_third_name"); | ||
|
||
r1.addCVTerm(new CVTerm( | ||
CVTerm.Type.BIOLOGICAL_QUALIFIER, | ||
CVTerm.Qualifier.BQB_IS, | ||
"http://identifiers.org/biocyc/META:ACETATEKIN-RXN")); | ||
|
||
r2.addCVTerm(new CVTerm( | ||
CVTerm.Type.BIOLOGICAL_QUALIFIER, | ||
CVTerm.Qualifier.BQB_IS, | ||
"http://identifiers.org/metanetx.reaction/MNXR103371")); | ||
|
||
r3.addCVTerm(new CVTerm( | ||
CVTerm.Type.BIOLOGICAL_QUALIFIER, | ||
CVTerm.Qualifier.BQB_IS, | ||
"http://identifiers.org/kegg.reaction/R00299")); | ||
|
||
var gPlugin = (GroupsModelPlugin) m.getPlugin(GroupsConstants.shortLabel); | ||
assertEquals(0, gPlugin.getGroupCount()); | ||
|
||
new ReactionAnnotation(r1).annotate(); | ||
new ReactionAnnotation(r2).annotate(); | ||
new ReactionAnnotation(r3).annotate(); | ||
|
||
var r1FbcPlugin = (FBCReactionPlugin) r1.getPlugin(FBCConstants.shortLabel); | ||
var gpa1 = r1FbcPlugin.getGeneProductAssociation(); | ||
assertNull(gpa1); | ||
assertEquals(false, r1.isSetCompartment()); | ||
assertEquals("", r1.getName()); | ||
assertEquals(1, r1.getCVTermCount()); | ||
assertEquals(1, r1.getCVTerm(0).getNumResources()); | ||
|
||
assertEquals(1, r2.getCVTermCount()); | ||
assertEquals(1, r2.getCVTerm(0).getNumResources()); | ||
|
||
var r3FbcPlugin = (FBCReactionPlugin) r3.getPlugin(FBCConstants.shortLabel); | ||
var gpa3 = r3FbcPlugin.getGeneProductAssociation(); | ||
assertNotNull(gpa3); | ||
assertEquals("G_b2388", ((GeneProductRef) gpa3.getAssociation()).getGeneProduct()); | ||
assertEquals(false, r1.isSetCompartment()); | ||
assertEquals("", r1.getName()); | ||
assertEquals(1, r3.getCVTermCount()); | ||
assertEquals(11, r3.getCVTerm(0).getNumResources()); | ||
|
||
assertEquals(1, gPlugin.getGroupCount()); | ||
assertEquals("glycolysis/gluconeogenesis", gPlugin.getGroup(0).getName()); | ||
assertEquals(Set.of("some_third_name"), gPlugin.getGroup(0) | ||
.getListOfMembers().stream().map(Member::getIdRef).collect(Collectors.toSet())); | ||
|
||
assertFalse(r3.isSetListOfReactants()); | ||
assertFalse(r3.isSetListOfProducts()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters