Search in sources :

Example 26 with XMLParser

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

the class CFOperatorTest method testCFSTX.

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

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

the class CFOperatorTest method testCFWB.

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

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

the class CFOperatorTest method testCFSTS.

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

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

the class MergeSplitTest method test.

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

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

the class RegionShiftTest method testRegionShift.

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