diff --git a/src/test/java/edu/ucsd/sbrg/bigg/annotation/BiGGAnnotationTest.java b/src/test/java/edu/ucsd/sbrg/bigg/annotation/BiGGAnnotationTest.java index 30737400..89c3b834 100644 --- a/src/test/java/edu/ucsd/sbrg/bigg/annotation/BiGGAnnotationTest.java +++ b/src/test/java/edu/ucsd/sbrg/bigg/annotation/BiGGAnnotationTest.java @@ -10,48 +10,78 @@ import static edu.ucsd.sbrg.TestUtils.assertCVTermIsPresent; import static edu.ucsd.sbrg.TestUtils.initParameters; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; public class BiGGAnnotationTest extends BiGGDBTest { - @Test - public void annotatePublication() { - initParameters(Map.of( - ModelPolisherOptions.ANNOTATE_WITH_BIGG.getOptionName(), - "true", - ModelPolisherOptions.INCLUDE_ANY_URI.getOptionName(), - "true")); - var sbml = new SBMLDocument(3, 2); - var m = new Model("iJO1366", 3,2); - sbml.setModel(m); - var annotater = new BiGGAnnotation(); - - assertFalse(m.isSetMetaId()); - assertTrue(m.getCVTerms().isEmpty()); - - annotater.annotate(sbml); - - assertTrue(m.isSetMetaId()); - assertCVTermIsPresent(m, - CVTerm.Type.MODEL_QUALIFIER, - CVTerm.Qualifier.BQM_IS_DESCRIBED_BY, - "https://identifiers.org/pubmed/21988831", - "Expected pubmed publication reference 21988831 not present on the model."); + @Test + public void annotatePublication() { + initParameters(Map.of( + ModelPolisherOptions.ANNOTATE_WITH_BIGG.getOptionName(), + "true", + ModelPolisherOptions.INCLUDE_ANY_URI.getOptionName(), + "true")); + var sbml = new SBMLDocument(3, 2); + var m = new Model("iJO1366", 3, 2); + sbml.setModel(m); + var annotater = new BiGGAnnotation(); + + assertFalse(m.isSetMetaId()); + assertTrue(m.getCVTerms().isEmpty()); + + annotater.annotate(sbml); + + assertTrue(m.isSetMetaId()); + assertCVTermIsPresent(m, + CVTerm.Type.MODEL_QUALIFIER, + CVTerm.Qualifier.BQM_IS_DESCRIBED_BY, + "https://identifiers.org/pubmed/21988831", + "Expected pubmed publication reference 21988831 not present on the model."); + } + + @Test + public void getBiGGIdFromResourcesTest() { + initParameters(Map.of( + ModelPolisherOptions.ANNOTATE_WITH_BIGG.getOptionName(), + "true", + ModelPolisherOptions.INCLUDE_ANY_URI.getOptionName(), + "true")); + var sbml = new SBMLDocument(3, 2); + var m = new Model("iJO1366", 3, 2); + sbml.setModel(m); + var s1 = m.createSpecies("some_name"); + var s2 = m.createSpecies("some_other_name"); + + // this is kegg.compound for H20 + s1.addCVTerm(new CVTerm( + CVTerm.Type.BIOLOGICAL_QUALIFIER, + CVTerm.Qualifier.BQB_IS, + "https://identifiers.org/kegg.compound/C00001")); + + // this is biocyc for ATP + s2.addCVTerm(new CVTerm( + CVTerm.Type.BIOLOGICAL_QUALIFIER, + CVTerm.Qualifier.BQB_IS, + "https://identifiers.org/biocyc/META:ATP")); + + var annotater = new BiGGAnnotation(); + annotater.annotate(sbml); + + assertEquals("some_name", s1.getId()); + assertEquals("", s1.getName()); + assertEquals(1, s1.getCVTermCount()); + assertCVTermIsPresent(s1, + CVTerm.Type.BIOLOGICAL_QUALIFIER, + CVTerm.Qualifier.BQB_IS, + "https://identifiers.org/kegg.compound/C00001"); + assertEquals("some_other_name", s2.getId()); + assertEquals("ATP C10H12N5O13P3", s2.getName()); + assertEquals(1, s2.getCVTermCount()); + assertCVTermIsPresent(s2, + CVTerm.Type.BIOLOGICAL_QUALIFIER, + CVTerm.Qualifier.BQB_IS, + "https://identifiers.org/biocyc/META:ATP"); } -// @Test -// public void getBiGGIdFromResourcesTest() { -// for (Species species : doc.getModel().getListOfSpecies()) { -// Species obfuscated = species.clone(); -// obfuscated.setId("random"); -// BiGGAnnotation biGGAnnotation = new BiGGAnnotation(); -// String originalId = biGGAnnotation.checkId(species).map(BiGGId::toBiGGId).get(); -// String obfuscatedId = biGGAnnotation.checkId(species).map(BiGGId::toBiGGId).get(); -// assertEquals(originalId, obfuscatedId); -// } -// } -// -// }