|
31 | 31 | import org.biojava.nbio.core.sequence.AccessionID; |
32 | 32 | import org.biojava.nbio.core.sequence.template.Compound; |
33 | 33 | import org.biojava.nbio.core.sequence.template.Sequence; |
34 | | -import org.forester.evoinference.distance.NeighborJoining; |
| 34 | +import org.biojava.nbio.phylo.ForesterWrapper; |
| 35 | +import org.biojava.nbio.phylo.TreeConstructor; |
| 36 | +import org.biojava.nbio.phylo.TreeConstructorType; |
35 | 37 | import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix; |
36 | 38 | import org.forester.phylogeny.Phylogeny; |
37 | 39 | import org.forester.phylogeny.PhylogenyNode; |
38 | 40 |
|
39 | 41 | import javax.swing.tree.TreeNode; |
| 42 | + |
40 | 43 | import java.util.*; |
41 | 44 | import java.util.concurrent.Future; |
42 | 45 |
|
@@ -67,20 +70,17 @@ public GuideTree(List<S> sequences, List<PairwiseSequenceScorer<S, C>> scorers) |
67 | 70 | this.sequences = Collections.unmodifiableList(sequences); |
68 | 71 | this.scorers = Collections.unmodifiableList(scorers); |
69 | 72 | distances = new BasicSymmetricalDistanceMatrix(sequences.size()); |
70 | | - BasicSymmetricalDistanceMatrix distclone = new BasicSymmetricalDistanceMatrix(sequences.size()); |
71 | 73 | for (int i = 0, n = 0; i < sequences.size(); i++) { |
72 | 74 | AccessionID id = sequences.get(i).getAccession(); |
73 | 75 | String str = (id == null) ? Integer.toString(i + 1) : id.getID(); |
74 | 76 | distances.setIdentifier(i, str); |
75 | | - distclone.setIdentifier(i, str); |
76 | 77 | for (int j = i+1; j < sequences.size(); j++) { |
77 | 78 | double dist = scorers.get(n++).getDistance(); |
78 | 79 | distances.setValue(i, j, dist); |
79 | | - distclone.setValue(i, j, dist); |
80 | 80 | } |
81 | 81 | } |
82 | | - // TODO UPGMA and other hierarchical clustering routines |
83 | | - Phylogeny phylogeny = NeighborJoining.createInstance().execute(distclone); |
| 82 | + BasicSymmetricalDistanceMatrix distclone = ForesterWrapper.cloneDM(distances); |
| 83 | + Phylogeny phylogeny = TreeConstructor.distanceTree(distclone, TreeConstructorType.NJ); |
84 | 84 | newick = phylogeny.toString(); |
85 | 85 | root = new Node(phylogeny.getRoot(), null); |
86 | 86 | } |
|
0 commit comments