Search in sources :

Example 21 with XMLParser

use of beast.util.XMLParser in project bacter by tgvaughan.

the class AddRemoveTest method test2Taxon.

@Test
public void test2Taxon() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/addRemoveTests/addRemoveTest2taxon.xml"));
    disableScreenLog(runnable);
    runnable.run();
    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 1.008, 5e-2));
    expectations.add(new Expectation("acg.CFlength", 2.015, 5e-2));
    expectations.add(new Expectation("acg.nConv", 10.104, 0.3));
    LogAnalyser logAnalyser = new LogAnalyser("addRemoveTest2taxon.stats", expectations);
    for (Expectation expectation : expectations) {
        assertTrue(expectation.isValid());
        assertTrue(expectation.isPassed());
    }
    Files.deleteIfExists(Paths.get("addRemoveTest2taxon.stats"));
    Files.deleteIfExists(Paths.get("addRemoveTest2taxon.converted"));
    Files.deleteIfExists(Paths.get("addRemoveTest2taxon.trees"));
    Files.deleteIfExists(Paths.get("addRemoveTest2taxon.cf"));
    Files.deleteIfExists(Paths.get("addRemoveTest2taxon.xml.state"));
}
Also used : LogAnalyser(test.beast.beast2vs1.trace.LogAnalyser) ArrayList(java.util.ArrayList) XMLParser(beast.util.XMLParser) Expectation(test.beast.beast2vs1.trace.Expectation) File(java.io.File) Test(org.junit.Test)

Example 22 with XMLParser

use of beast.util.XMLParser in project bacter by tgvaughan.

the class AddRemoveTest method test5Taxon.

@Test
public void test5Taxon() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/addRemoveTests/addRemoveTest5taxon.xml"));
    disableScreenLog(runnable);
    runnable.run();
    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 1.606, 0.2));
    expectations.add(new Expectation("acg.CFlength", 4.181, 0.5));
    expectations.add(new Expectation("acg.nConv", 21.0, 0.5));
    LogAnalyser logAnalyser = new LogAnalyser("addRemoveTest5taxon.stats", expectations);
    for (Expectation expectation : expectations) {
        assertTrue(expectation.isValid());
        assertTrue(expectation.isPassed());
    }
    Files.deleteIfExists(Paths.get("addRemoveTest5taxon.stats"));
    Files.deleteIfExists(Paths.get("addRemoveTest5taxon.converted"));
    Files.deleteIfExists(Paths.get("addRemoveTest5taxon.trees"));
    Files.deleteIfExists(Paths.get("addRemoveTest5taxon.cf"));
    Files.deleteIfExists(Paths.get("addRemoveTest5taxon.xml.state"));
}
Also used : LogAnalyser(test.beast.beast2vs1.trace.LogAnalyser) ArrayList(java.util.ArrayList) XMLParser(beast.util.XMLParser) Expectation(test.beast.beast2vs1.trace.Expectation) File(java.io.File) Test(org.junit.Test)

Example 23 with XMLParser

use of beast.util.XMLParser in project bacter by tgvaughan.

the class AddRemoveTest method test5TaxonDynamicPopSize.

@Test
public void test5TaxonDynamicPopSize() throws Exception {
    Randomizer.setSeed(2);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/addRemoveTests/addRemoveDynamicPopSize5taxon.xml"));
    disableScreenLog(runnable);
    runnable.run();
    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 8.840, 1e-2));
    expectations.add(new Expectation("acg.CFlength", 25.312, 0.5));
    expectations.add(new Expectation("acg.nConv", 25.464, 0.5));
    LogAnalyser logAnalyser = new LogAnalyser("addRemoveDynamicPopSize5taxon.stats", expectations);
    for (Expectation expectation : expectations) {
        assertTrue(expectation.isValid());
        assertTrue(expectation.isPassed());
    }
    Files.deleteIfExists(Paths.get("addRemoveDynamicPopSize5taxon.stats"));
    Files.deleteIfExists(Paths.get("addRemoveDynamicPopSize5taxon.converted"));
    Files.deleteIfExists(Paths.get("addRemoveDynamicPopSize5taxon.trees"));
    Files.deleteIfExists(Paths.get("addRemoveDynamicPopSize5taxon.cf"));
    Files.deleteIfExists(Paths.get("addRemoveDynamicPopSize5taxon.xml.state"));
}
Also used : LogAnalyser(test.beast.beast2vs1.trace.LogAnalyser) ArrayList(java.util.ArrayList) XMLParser(beast.util.XMLParser) Expectation(test.beast.beast2vs1.trace.Expectation) File(java.io.File) Test(org.junit.Test)

Example 24 with XMLParser

use of beast.util.XMLParser in project bacter by tgvaughan.

the class AllOperatorTest method testSerialSample.

@Test
public void testSerialSample() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/allOperatorTests/allOperatorTestSeriallySampled.xml"));
    disableScreenLog(runnable);
    runnable.run();
    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 1.909, 0.2));
    expectations.add(new Expectation("acg.CFlength", 4.655, 0.5));
    expectations.add(new Expectation("acg.nConv", 23.381, 0.5));
    LogAnalyser logAnalyser = new LogAnalyser("allOperatorTestSeriallySampled.stats", expectations);
    for (Expectation expectation : expectations) {
        assertTrue(expectation.isValid());
        assertTrue(expectation.isPassed());
    }
    Files.deleteIfExists(Paths.get("allOperatorTestSeriallySampled.stats"));
    Files.deleteIfExists(Paths.get("allOperatorTestSeriallySampled.converted"));
    Files.deleteIfExists(Paths.get("allOperatorTestSeriallySampled.trees"));
    Files.deleteIfExists(Paths.get("allOperatorTestSeriallySampled.cf"));
    Files.deleteIfExists(Paths.get("allOperatorTestSeriallySampled.xml.state"));
}
Also used : LogAnalyser(test.beast.beast2vs1.trace.LogAnalyser) ArrayList(java.util.ArrayList) XMLParser(beast.util.XMLParser) Expectation(test.beast.beast2vs1.trace.Expectation) File(java.io.File) Test(org.junit.Test)

Example 25 with XMLParser

use of beast.util.XMLParser in project bacter by tgvaughan.

the class AllOperatorTest method testShortMultiLocus.

@Test
public void testShortMultiLocus() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/allOperatorTests/allOperatorTestShortSSML.xml"));
    disableScreenLog(runnable);
    runnable.run();
    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 1.601, 0.2));
    expectations.add(new Expectation("acg.CFlength", 4.17, 0.5));
    expectations.add(new Expectation("acg.nConv", 39.61, 0.5));
    LogAnalyser logAnalyser = new LogAnalyser("allOperatorTestShortSSML.stats", expectations);
    for (Expectation expectation : expectations) {
        assertTrue(expectation.isValid());
        assertTrue(expectation.isPassed());
    }
    Files.deleteIfExists(Paths.get("allOperatorTestShortSSML.stats"));
    Files.deleteIfExists(Paths.get("allOperatorTestShortSSML.converted"));
    Files.deleteIfExists(Paths.get("allOperatorTestShortSSML.trees"));
    Files.deleteIfExists(Paths.get("allOperatorTestShortSSML.cf"));
    Files.deleteIfExists(Paths.get("allOperatorTestShortSSML.xml.state"));
}
Also used : LogAnalyser(test.beast.beast2vs1.trace.LogAnalyser) ArrayList(java.util.ArrayList) XMLParser(beast.util.XMLParser) Expectation(test.beast.beast2vs1.trace.Expectation) File(java.io.File) Test(org.junit.Test)

Aggregations

XMLParser (beast.util.XMLParser)46 File (java.io.File)36 ArrayList (java.util.ArrayList)29 Test (org.junit.Test)27 Expectation (test.beast.beast2vs1.trace.Expectation)23 LogAnalyser (test.beast.beast2vs1.trace.LogAnalyser)23 BEASTInterface (beast.core.BEASTInterface)11 XMLProducer (beast.util.XMLProducer)5 IOException (java.io.IOException)5 FilenameFilter (java.io.FilenameFilter)4 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)4 SAXException (org.xml.sax.SAXException)4 MCMC (beast.core.MCMC)3 Alignment (beast.evolution.alignment.Alignment)3 XMLParserException (beast.util.XMLParserException)3 BufferedReader (java.io.BufferedReader)3 FileReader (java.io.FileReader)3 Input (beast.core.Input)2 StateNode (beast.core.StateNode)2 CompoundDistribution (beast.core.util.CompoundDistribution)2