Skip to content

Commit

Permalink
issue #121 test #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmoho committed Aug 2, 2022
1 parent ebb4f05 commit 876bec7
Showing 1 changed file with 68 additions and 38 deletions.
106 changes: 68 additions & 38 deletions src/test/java/edu/ucsd/sbrg/bigg/annotation/BiGGAnnotationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
// }
//
//

}

0 comments on commit 876bec7

Please sign in to comment.