Search in sources :

Example 11 with XMLParser

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

the class CFOperatorTest method testCFCS.

@Test
public void testCFCS() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/CFOperatorTests/CFConversionSwapTest5taxon.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));
    new LogAnalyser("CFConversionSwapTest5taxon.stats", expectations);
    for (Expectation expectation : expectations) {
        assertTrue(expectation.isValid());
        assertTrue(expectation.isPassed());
    }
    Files.deleteIfExists(Paths.get("CFConversionSwapTest5taxon.stats"));
    Files.deleteIfExists(Paths.get("CFConversionSwapTest5taxon.converted"));
    Files.deleteIfExists(Paths.get("CFConversionSwapTest5taxon.trees"));
    Files.deleteIfExists(Paths.get("CFConversionSwapTest5taxon.cf"));
    Files.deleteIfExists(Paths.get("CFConversionSwapTest5taxon.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 12 with XMLParser

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

the class RegionShiftTest method testBoundaryShift.

@Test
public void testBoundaryShift() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/regionShiftTests/boundaryShiftTest5taxon.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("boundaryShiftTest5taxon.stats", expectations);
    for (int i = 0; i < expectations.size(); i++) {
        assertTrue(expectations.get(i).isValid());
        assertTrue(expectations.get(i).isPassed());
    }
    Files.deleteIfExists(Paths.get("boundaryShiftTest5taxon.stats"));
    Files.deleteIfExists(Paths.get("boundaryShiftTest5taxon.converted"));
    Files.deleteIfExists(Paths.get("boundaryShiftTest5taxon.trees"));
    Files.deleteIfExists(Paths.get("boundaryShiftTest5taxon.cf"));
    Files.deleteIfExists(Paths.get("boundaryShiftTest5taxon.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 13 with XMLParser

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

the class SimulatedACGTest method test5TaxonSerialSampling.

@Test
public void test5TaxonSerialSampling() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/ACGsimulations/simulateACGs5taxonSerialSampling.xml"));
    runnable.run();
    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 1.909, 1e-2));
    expectations.add(new Expectation("acg.CFlength", 4.655, 1e-2));
    expectations.add(new Expectation("acg.nConv", 23.381, 5e-2));
    LogAnalyser logAnalyser = new LogAnalyser("simulateACGs5taxonSerialSampling.stats", expectations);
    for (int i = 0; i < expectations.size(); i++) {
        assertTrue(expectations.get(i).isValid());
        assertTrue(expectations.get(i).isPassed());
    }
    Files.deleteIfExists(Paths.get("simulateACGs5taxonSerialSampling.stats"));
    Files.deleteIfExists(Paths.get("simulateACGs5taxonSerialSampling.converted"));
    Files.deleteIfExists(Paths.get("simulateACGs5taxonSerialSampling.trees"));
}
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 14 with XMLParser

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

the class SimulatedACGTest method test5TaxonMultiLocus.

@Test
public void test5TaxonMultiLocus() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/ACGsimulations/simulateACGs5taxonMultiLocus.xml"));
    runnable.run();
    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 1.917, 1e-2));
    expectations.add(new Expectation("acg.CFlength", 4.672, 1e-2));
    expectations.add(new Expectation("acg.nConv", 23.614, 5e-2));
    LogAnalyser logAnalyser = new LogAnalyser("simulateACGs5taxonMultiLocus.stats", expectations);
    for (int i = 0; i < expectations.size(); i++) {
        assertTrue(expectations.get(i).isValid());
        assertTrue(expectations.get(i).isPassed());
    }
    Files.deleteIfExists(Paths.get("simulateACGs5taxonMultiLocus.stats"));
    Files.deleteIfExists(Paths.get("simulateACGs5taxonMultiLocus.converted"));
    Files.deleteIfExists(Paths.get("simulateACGs5taxonMultiLocus.trees"));
}
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 15 with XMLParser

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

the class SimulatedACGTest method test2Taxon.

@Test
public void test2Taxon() throws Exception {
    Randomizer.setSeed(1);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(new File("examples/ACGsimulations/simulateACGs2taxon.xml"));
    runnable.run();
    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 1.0, 1e-2));
    expectations.add(new Expectation("acg.CFlength", 2.0, 1e-2));
    expectations.add(new Expectation("acg.nConv", 10.0, 5e-2));
    LogAnalyser logAnalyser = new LogAnalyser("simulateACGs2taxon.stats", expectations);
    for (int i = 0; i < expectations.size(); i++) {
        assertTrue(expectations.get(i).isValid());
        assertTrue(expectations.get(i).isPassed());
    }
    Files.deleteIfExists(Paths.get("simulateACGs2taxon.stats"));
    Files.deleteIfExists(Paths.get("simulateACGs2taxon.converted"));
    Files.deleteIfExists(Paths.get("simulateACGs2taxon.trees"));
}
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