Search in sources :

Example 1 with TaxaParser

use of dr.evoxml.TaxaParser in project beast-mcmc by beast-dev.

the class GreatCircleDistances method main.

public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException, XMLParseException {
    XMLParser parser = new XMLParser(true, true);
    parser.addXMLObjectParser(new TaxonParser());
    parser.addXMLObjectParser(new TaxaParser());
    parser.addXMLObjectParser(new AttributeParser());
    parser.addXMLObjectParser(new DateParser());
    parser.parse(new FileReader(new File(args[0])), true);
    Taxa taxa = (Taxa) parser.getRoot().getChild(0);
    System.out.println("Found " + taxa.getTaxonCount() + " taxa");
    GreatCircleDistances distances = new GreatCircleDistances(taxa, "location");
    Statistic statistic = distances.getDistanceStatistic(true);
    for (int i = 0; i < statistic.getDimension(); i++) {
        System.out.println(statistic.getStatisticValue(i));
    }
}
Also used : DateParser(dr.evoxml.DateParser) Taxa(dr.evolution.util.Taxa) AttributeParser(dr.xml.AttributeParser) Statistic(dr.inference.model.Statistic) TaxaParser(dr.evoxml.TaxaParser) FileReader(java.io.FileReader) TaxonParser(dr.evoxml.TaxonParser) XMLParser(dr.xml.XMLParser) File(java.io.File)

Aggregations

Taxa (dr.evolution.util.Taxa)1 DateParser (dr.evoxml.DateParser)1 TaxaParser (dr.evoxml.TaxaParser)1 TaxonParser (dr.evoxml.TaxonParser)1 Statistic (dr.inference.model.Statistic)1 AttributeParser (dr.xml.AttributeParser)1 XMLParser (dr.xml.XMLParser)1 File (java.io.File)1 FileReader (java.io.FileReader)1