|
9 | 9 | import org.biojava.nbio.core.sequence.template.Compound; |
10 | 10 | import org.biojava.nbio.core.sequence.template.Sequence; |
11 | 11 | import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix; |
12 | | -import org.forester.evoinference.matrix.distance.DistanceMatrix; |
13 | 12 | import org.forester.io.parsers.FastaParser; |
14 | 13 | import org.forester.io.writers.PhylogenyWriter; |
15 | 14 | import org.forester.msa.Msa; |
|
26 | 25 | public class ForesterWrapper { |
27 | 26 |
|
28 | 27 | /** Prevent instantiation */ |
29 | | - private ForesterWrapper() {} |
| 28 | + private ForesterWrapper() { |
| 29 | + } |
30 | 30 |
|
31 | 31 | /** |
32 | 32 | * Convert a BioJava {@link MultipleSequenceAlignment} to a forester |
@@ -79,21 +79,24 @@ public static String getNewickString(Phylogeny phylo, boolean simpleNewick, |
79 | 79 | writeDistances); |
80 | 80 | return newickString.toString(); |
81 | 81 | } |
82 | | - |
| 82 | + |
83 | 83 | /** |
84 | | - * Helper function to clone a forester DistanceMatrix. |
| 84 | + * Helper function to clone a forester symmetrical DistanceMatrix. |
85 | 85 | * |
86 | | - * @param distM forester DistanceMatrix |
87 | | - * @return identical copy of the forester DistanceMatrix |
| 86 | + * @param distM |
| 87 | + * forester symmetrical DistanceMatrix |
| 88 | + * @return identical copy of the forester symmetrical DistanceMatrix |
88 | 89 | */ |
89 | | - public static DistanceMatrix cloneDM(DistanceMatrix distM) { |
90 | | - |
| 90 | + public static BasicSymmetricalDistanceMatrix cloneDM( |
| 91 | + BasicSymmetricalDistanceMatrix distM) { |
| 92 | + |
91 | 93 | int n = distM.getSize(); |
92 | | - DistanceMatrix cloneDM = new BasicSymmetricalDistanceMatrix(n); |
93 | | - |
| 94 | + BasicSymmetricalDistanceMatrix cloneDM = |
| 95 | + new BasicSymmetricalDistanceMatrix(n); |
| 96 | + |
94 | 97 | for (int i = 0; i < n; i++) { |
95 | 98 | cloneDM.setIdentifier(i, distM.getIdentifier(i)); |
96 | | - for (int j = 0; j < n; j++) { |
| 99 | + for (int j = i + 1; j < n; j++) { |
97 | 100 | cloneDM.setValue(i, j, distM.getValue(i, j)); |
98 | 101 | } |
99 | 102 | } |
|
0 commit comments