| 1 |
package dr.evolution.tree.treemetrics; |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
import dr.evolution.io.Importer; |
| 8 |
import dr.evolution.io.NewickImporter; |
| 9 |
import dr.evolution.tree.Tree; |
| 10 |
|
| 11 |
import java.io.IOException; |
| 12 |
|
| 13 |
public class TestTreeMetrics { |
| 14 |
|
| 15 |
public static void main(String[] args) { |
| 16 |
|
| 17 |
try { |
| 18 |
|
| 19 |
|
| 20 |
NewickImporter importer = new NewickImporter("(('A':1.2,'B':0.8):0.5,('C':0.8,'D':1.0):1.1)"); |
| 21 |
Tree treeOne = importer.importNextTree(); |
| 22 |
System.out.println("4-taxa tree 1: " + treeOne); |
| 23 |
|
| 24 |
importer = new NewickImporter("((('A':0.8,'B':1.4):0.3,'C':0.7):0.9,'D':1.0)"); |
| 25 |
Tree treeTwo = importer.importNextTree(); |
| 26 |
System.out.println("4-taxa tree 2: " + treeTwo); |
| 27 |
System.out.println(); |
| 28 |
|
| 29 |
System.out.println("Paired trees:"); |
| 30 |
System.out.println("BranchScore = " + new BranchScoreMetric().getMetric(treeOne, treeTwo)); |
| 31 |
System.out.println("CladeHeight = " + new CladeHeightMetric().getMetric(treeOne, treeTwo)); |
| 32 |
System.out.println("Kendall-Colijn lambda (0.0) = " + new KendallColijnPathDifferenceMetric(0.0).getMetric(treeOne, treeTwo)); |
| 33 |
System.out.println("Kendall-Colijn lambda (0.5) = " + new KendallColijnPathDifferenceMetric(0.5).getMetric(treeOne, treeTwo)); |
| 34 |
System.out.println("Kendall-Colijn lambda (1.0) = " + new KendallColijnPathDifferenceMetric(1.0).getMetric(treeOne, treeTwo)); |
| 35 |
System.out.println("RobinsonFoulds = " + new RobinsonFouldsMetric().getMetric(treeOne, treeTwo)); |
| 36 |
System.out.println("RootedBranchScore = " + new RootedBranchScoreMetric().getMetric(treeOne, treeTwo)); |
| 37 |
System.out.println("Steel-Penny = " + new SteelPennyPathDifferenceMetric().getMetric(treeOne, treeTwo)); |
| 38 |
System.out.println(); |
| 39 |
|
| 40 |
|
| 41 |
importer = new NewickImporter("(((('A':0.6,'B':0.6):0.1,'C':0.5):0.4,'D':0.7):0.1,'E':1.3)"); |
| 42 |
treeOne = importer.importNextTree(); |
| 43 |
System.out.println("5-taxa tree 1: " + treeOne); |
| 44 |
|
| 45 |
importer = new NewickImporter("((('A':0.8,'B':1.4):0.1,'C':0.7):0.2,('D':1.0,'E':0.9):1.3)"); |
| 46 |
treeTwo = importer.importNextTree(); |
| 47 |
System.out.println("5-taxa tree 2: " + treeTwo); |
| 48 |
System.out.println(); |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
System.out.println("Paired trees:"); |
| 54 |
System.out.println("BranchScore = " + new BranchScoreMetric().getMetric(treeOne, treeTwo)); |
| 55 |
System.out.println("CladeHeight = " + new CladeHeightMetric().getMetric(treeOne, treeTwo)); |
| 56 |
System.out.println("Kendall-Colijn lambda (0.0) = " + new KendallColijnPathDifferenceMetric(0.0).getMetric(treeOne, treeTwo)); |
| 57 |
System.out.println("Kendall-Colijn lambda (0.5) = " + new KendallColijnPathDifferenceMetric(0.5).getMetric(treeOne, treeTwo)); |
| 58 |
System.out.println("Kendall-Colijn lambda (1.0) = " + new KendallColijnPathDifferenceMetric(1.0).getMetric(treeOne, treeTwo)); |
| 59 |
System.out.println("RobinsonFoulds = " + new RobinsonFouldsMetric().getMetric(treeOne, treeTwo)); |
| 60 |
System.out.println("RootedBranchScore = " + new RootedBranchScoreMetric().getMetric(treeOne, treeTwo)); |
| 61 |
System.out.println("Steel-Penny = " + new SteelPennyPathDifferenceMetric().getMetric(treeOne, treeTwo)); |
| 62 |
System.out.println(); |
| 63 |
|
| 64 |
|
| 65 |
} catch (Importer.ImportException ie) { |
| 66 |
System.err.println(ie); |
| 67 |
} catch (IOException ioe) { |
| 68 |
System.err.println(ioe); |
| 69 |
} |
| 70 |
|
| 71 |
} |
| 72 |
|
| 73 |
} |