Search in sources :

Example 26 with Taxon

use of beast.evolution.alignment.Taxon in project beast2 by CompEvol.

the class XMLTest method testAnnotatedConstructor2.

@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());
}
Also used : XMLProducer(beast.util.XMLProducer) Taxon(beast.evolution.alignment.Taxon) FileWriter(java.io.FileWriter) ArrayList(java.util.ArrayList) BEASTInterface(beast.core.BEASTInterface) XMLParser(beast.util.XMLParser) File(java.io.File) Test(org.junit.Test)

Aggregations

Taxon (beast.evolution.alignment.Taxon)26 TaxonSet (beast.evolution.alignment.TaxonSet)18 ArrayList (java.util.ArrayList)7 Alignment (beast.evolution.alignment.Alignment)6 Tree (beast.evolution.tree.Tree)5 PatternSyntaxException (java.util.regex.PatternSyntaxException)5 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 Test (org.junit.Test)4 FilteredAlignment (beast.evolution.alignment.FilteredAlignment)3 MRCAPrior (beast.math.distributions.MRCAPrior)3 Box (javax.swing.Box)3 BEASTInterface (beast.core.BEASTInterface)2 RealParameter (beast.core.parameter.RealParameter)2 TreeParser (beast.util.TreeParser)2 File (java.io.File)2 FileWriter (java.io.FileWriter)2 PrintStream (java.io.PrintStream)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 JButton (javax.swing.JButton)2