Search in sources :

Example 1 with BackboneNodeFilter

use of dr.evomodel.tree.BackboneNodeFilter in project beast-mcmc by beast-dev.

the class FilteredTreeTraitTest method testBackboneFilter.

public void testBackboneFilter() {
    Taxa taxonList = new Taxa();
    taxonList.addTaxon(taxa[0]);
    taxonList.addTaxon(taxa[1]);
    TreeTrait backboneFilter = new TreeTrait.FilteredD(dummyTrait, new BackboneNodeFilter("backbone", tree, taxonList, true, true));
    treeTraitProvider.addTrait(backboneFilter);
    TreeTrait sumTrait = new TreeTrait.SumOverTreeD(backboneFilter);
    treeTraitProvider.addTrait(sumTrait);
    System.out.println("BackboneFilter Test");
    StringBuffer buffer = new StringBuffer();
    TreeUtils.newick(tree, tree.getRoot(), false, TreeUtils.BranchLengthType.LENGTHS_AS_TIME, // format
    null, // branchRates,
    null, new TreeTraitProvider[] { treeTraitProvider }, //idMap,
    null, buffer);
    System.out.println("Tree: " + buffer.toString());
    double traitValue = (Double) sumTrait.getTrait(tree, null);
    System.out.println("Trait: " + traitValue);
    // TODO Get real result
    assertEquals(traitValue, 7.0);
}
Also used : Taxa(dr.evolution.util.Taxa) BackboneNodeFilter(dr.evomodel.tree.BackboneNodeFilter)

Aggregations

Taxa (dr.evolution.util.Taxa)1 BackboneNodeFilter (dr.evomodel.tree.BackboneNodeFilter)1