当前位置: 首页>>代码示例>>Java>>正文


Java XMLParser.parseFile方法代码示例

本文整理汇总了Java中beast.util.XMLParser.parseFile方法的典型用法代码示例。如果您正苦于以下问题:Java XMLParser.parseFile方法的具体用法?Java XMLParser.parseFile怎么用?Java XMLParser.parseFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在beast.util.XMLParser的用法示例。


在下文中一共展示了XMLParser.parseFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testScaleWithInt

import beast.util.XMLParser; //导入方法依赖的package包/类
@Test
public void testScaleWithInt() throws Exception {
    Randomizer.setSeed(1);

    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(
            new File("test/epiinf/xmltests/ScaleWithIntTest.xml"));
    Logger.FILE_MODE = Logger.LogFileMode.overwrite;
    runnable.run();


    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("x1", 0.5, 0.01));
    expectations.add(new Expectation("y1", 0.5, 0.01));
    expectations.add(new Expectation("y2", 0.5, 0.01));
    expectations.add(new Expectation("y3", 0.5, 0.01));
    expectations.add(new Expectation("n", 50.0, 1.0));
    LogAnalyser logAnalyser = new LogAnalyser("ScaleWithIntTest.log", expectations);

    try {
        for (Expectation expectation : expectations) {
            assertTrue(expectation.isValid());
            assertTrue(expectation.isPassed());
        }
    } catch (Exception e) {
        throw e;

    } finally {
        Files.deleteIfExists(Paths.get("ScaleWithIntTest.xml.state"));
        Files.deleteIfExists(Paths.get("ScaleWithIntTest.log"));
    }
}
 
开发者ID:tgvaughan,项目名称:EpiInf,代码行数:33,代码来源:OperatorTests.java

示例2: testShortMultiLocus

import beast.util.XMLParser; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:30,代码来源:AllOperatorTest.java

示例3: test2Taxon

import beast.util.XMLParser; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:27,代码来源:SimulatedACGTest.java

示例4: makeSureXMLParses

import beast.util.XMLParser; //导入方法依赖的package包/类
void makeSureXMLParses() {
		warning("Make sure that XML that BEAUti produces parses");
		File XMLFile = new File(org.fest.util.Files.temporaryFolder() + "/x.xml");
		if (XMLFile.exists()) {
			XMLFile.delete();
		}
		
		saveFile(""+org.fest.util.Files.temporaryFolder(), "x.xml");

//		JFileChooserFixture fileChooser = findFileChooser().using(robot());
//		fileChooser.setCurrentDirectory(org.fest.util.Files.temporaryFolder());
//		fileChooser.selectFile(new File("x.xml")).approve();
		
		XMLParser parser = new XMLParser();
		XMLFile = new File(org.fest.util.Files.temporaryFolder() + "/x.xml");
		try {
			parser.parseFile(XMLFile);
		} catch (Exception e) {
			e.printStackTrace();
			assertThat(0).as("Parser exception: " + e.getMessage()).isEqualTo(1);
		}
	}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:23,代码来源:BeautiBase.java

示例5: testAnnotatedConstructor2

import beast.util.XMLParser; //导入方法依赖的package包/类
@Test
public void testAnnotatedConstructor2() throws Exception {
	List<Taxon> taxa = new ArrayList<>();
	taxa.add(new Taxon("first one"));
	taxa.add(new Taxon("second one"));

	AnnotatedRunnableTestClass t = new AnnotatedRunnableTestClass(3, taxa);
	
	XMLProducer producer = new XMLProducer();
	String xml = producer.toXML(t);

	assertEquals(3, (int) t.getParam1());

	
    FileWriter outfile = new FileWriter(new File("/tmp/XMLTest.xml"));
    outfile.write(xml);
    outfile.close();

	
	XMLParser parser = new XMLParser();
	BEASTInterface b = parser.parseFile(new File("/tmp/XMLTest.xml"));
	assertEquals(3, (int) ((AnnotatedRunnableTestClass) b).getParam1());
	assertEquals(2, ((AnnotatedRunnableTestClass) b).getTaxon().size());
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:25,代码来源:XMLTest.java

示例6: testCFSTS

import beast.util.XMLParser; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:27,代码来源:CFOperatorTest.java

示例7: testCFSTX

import beast.util.XMLParser; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:27,代码来源:CFOperatorTest.java

示例8: test5Taxon

import beast.util.XMLParser; //导入方法依赖的package包/类
@Test
public void test5Taxon() throws Exception {
    Randomizer.setSeed(1);

    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(
            new File("examples/ACGsimulations/simulateACGs5taxon.xml"));
    runnable.run();

    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("acg.CFheight", 1.606, 1e-2));
    expectations.add(new Expectation("acg.CFlength", 4.181, 1e-2));
    expectations.add(new Expectation("acg.nConv", 21.0, 5e-2));

    LogAnalyser logAnalyser = new LogAnalyser("simulateACGs5taxon.stats",
            expectations);

    for (int i=0; i<expectations.size(); i++) {
        assertTrue(expectations.get(i).isValid());
        assertTrue(expectations.get(i).isPassed());
    }

    Files.deleteIfExists(Paths.get("simulateACGs5taxon.stats"));
    Files.deleteIfExists(Paths.get("simulateACGs5taxon.converted"));
    Files.deleteIfExists(Paths.get("simulateACGs5taxon.trees"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:27,代码来源:SimulatedACGTest.java

示例9: test5TaxonMultiLocus

import beast.util.XMLParser; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:27,代码来源:SimulatedACGTest.java

示例10: test5TaxonSerialSampling

import beast.util.XMLParser; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:27,代码来源:SimulatedACGTest.java

示例11: main

import beast.util.XMLParser; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	XMLParser parser = new XMLParser();
	BEASTObject o = parser.parseFile(new File(args[0]));
	if (!(o instanceof TreeDrawingGrid)) {
		throw new RuntimeException("Expected top level element of type TreeDrawingGrid");
	}
	TreeDrawingGrid grid = (TreeDrawingGrid) o;
	JFrame frame = new JFrame();
	TreeDrawPanel panel = new TreeDrawPanel(grid);
	frame.add(panel);
	frame.setSize(1024, 768);
	frame.setVisible(true);
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 
开发者ID:CompEvol,项目名称:beastshell,代码行数:15,代码来源:TreeDrawPanel.java

示例12: analyse

import beast.util.XMLParser; //导入方法依赖的package包/类
public void analyse(int index_XML) throws Exception {
//        for (int i = 0; i < xmls.length; i++) {
//            if (giveExpectations(i).size() > 0) {
        Randomizer.setSeed(SEED);
        Logger.FILE_MODE = Logger.LogFileMode.overwrite;
        
        long beagleFlags = BeagleFlag.PROCESSOR_CPU.getMask() | BeagleFlag.VECTOR_SSE.getMask();
        System.setProperty("beagle.preferred.flags", Long.toString(beagleFlags));


        String fileName = dirName + xmls[index_XML];

        System.out.println("Processing " + fileName);
        XMLParser parser = new XMLParser();
        beast.core.Runnable runable = parser.parseFile(new File(fileName));
        runable.setStateFile("tmp.state", false);
//		   runable.setInputValue("preBurnin", 0);
//		   runable.setInputValue("chainLength", 1000);
        runable.run();

        String logFile = logDir + testFile + (useSeed ? SEED : "") + ".log";
        System.out.println("\nAnalysing log " + logFile);
        LogAnalyser logAnalyser = new LogAnalyser(logFile, giveExpectations(index_XML)); // burnIn = 0.1 * maxState

        for (Expectation expectation : logAnalyser.m_pExpectations.get()) {
            Assert.assertTrue(xmls[index_XML] + ": Expected " + expectation.traceName.get() + " delta mean: "
                    + expectation.expValue.get() + " - " + expectation.getTraceStatistics().getMean()
                    + " <= delta stdErr: 2*(" + expectation.getStdError() + " + "
                    + expectation.getTraceStatistics().getStdErrorOfMean() + ")", expectation.isPassed());

            if (checkESS)
            	Assert.assertTrue(xmls[index_XML] + ":  has very low effective sample sizes (ESS) "
                    + expectation.getTraceStatistics().getESS(), expectation.isValid());
        }

        System.out.println("\nSucceed " + fileName);
        System.out.println("\n***************************************\n");
//            }
//        }
    }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:41,代码来源:TestFramework.java

示例13: test5Taxon

import beast.util.XMLParser; //导入方法依赖的package包/类
@Test
public void test5Taxon() throws Exception {
    Randomizer.setSeed(1);

    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(
            new File("examples/addRemoveDetourTests/addRemoveDetourTest5taxon.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("addRemoveDetourTest5taxon.stats",
            expectations);

    for (int i=0; i<expectations.size(); i++) {
        assertTrue(expectations.get(i).isValid());
        assertTrue(expectations.get(i).isPassed());
    }

    Files.deleteIfExists(Paths.get("addRemoveDetourTest5taxon.stats"));
    Files.deleteIfExists(Paths.get("addRemoveDetourTest5taxon.converted"));
    Files.deleteIfExists(Paths.get("addRemoveDetourTest5taxon.trees"));
    Files.deleteIfExists(Paths.get("addRemoveDetourTest5taxon_trimmed.trees"));
    Files.deleteIfExists(Paths.get("addRemoveDetourTest5taxon.cf"));
    Files.deleteIfExists(Paths.get("addRemoveDetourTest5taxon.xml.state"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:31,代码来源:AddRemoveDetourTest.java

示例14: testRegionShift

import beast.util.XMLParser; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:30,代码来源:RegionShiftTest.java

示例15: testBoundaryShift

import beast.util.XMLParser; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:30,代码来源:RegionShiftTest.java


注:本文中的beast.util.XMLParser.parseFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。