1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.analysis; |
22 |
|
|
23 |
|
import jalview.api.analysis.ScoreModelI; |
24 |
|
import jalview.api.analysis.SimilarityParamsI; |
25 |
|
import jalview.datamodel.BinaryNode; |
26 |
|
import jalview.viewmodel.AlignmentViewport; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 15 |
Complexity Density: 0.58 |
|
32 |
|
public class NJTree extends TreeBuilder |
33 |
|
{ |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@param |
38 |
|
|
39 |
|
@param |
40 |
|
|
41 |
|
@param |
42 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
0 |
public NJTree(AlignmentViewport av, ScoreModelI sm,... |
44 |
|
SimilarityParamsI scoreParameters) |
45 |
|
{ |
46 |
0 |
super(av, sm, scoreParameters); |
47 |
|
} |
48 |
|
|
49 |
|
|
50 |
|
@inheritDoc |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 6 |
Complexity Density: 0.6 |
|
52 |
0 |
@Override... |
53 |
|
protected double findMinDistance() |
54 |
|
{ |
55 |
0 |
double min = Double.MAX_VALUE; |
56 |
|
|
57 |
0 |
for (int i = 0; i < (noseqs - 1); i++) |
58 |
|
{ |
59 |
0 |
for (int j = i + 1; j < noseqs; j++) |
60 |
|
{ |
61 |
0 |
if (!done.get(i) && !done.get(j)) |
62 |
|
{ |
63 |
0 |
double tmp = distances.getValue(i, j) |
64 |
|
- (findr(i, j) + findr(j, i)); |
65 |
|
|
66 |
0 |
if (tmp < min) |
67 |
|
{ |
68 |
0 |
mini = i; |
69 |
0 |
minj = j; |
70 |
|
|
71 |
0 |
min = tmp; |
72 |
|
} |
73 |
|
} |
74 |
|
} |
75 |
|
} |
76 |
|
|
77 |
0 |
return min; |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
|
@inheritDoc |
82 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
83 |
0 |
@Override... |
84 |
|
protected void findNewDistances(BinaryNode nodei, BinaryNode nodej, |
85 |
|
double dist) |
86 |
|
{ |
87 |
0 |
nodei.dist = ((dist + ri) - rj) / 2; |
88 |
0 |
nodej.dist = (dist - nodei.dist); |
89 |
|
|
90 |
0 |
if (nodei.dist < 0) |
91 |
|
{ |
92 |
0 |
nodei.dist = 0; |
93 |
|
} |
94 |
|
|
95 |
0 |
if (nodej.dist < 0) |
96 |
|
{ |
97 |
0 |
nodej.dist = 0; |
98 |
|
} |
99 |
|
} |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
@param |
108 |
|
@param |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.56 |
|
110 |
0 |
@Override... |
111 |
|
protected void findClusterDistance(int i, int j) |
112 |
|
{ |
113 |
|
|
114 |
0 |
double[] newdist = new double[noseqs]; |
115 |
|
|
116 |
0 |
double ijDistance = distances.getValue(i, j); |
117 |
0 |
for (int l = 0; l < noseqs; l++) |
118 |
|
{ |
119 |
0 |
if ((l != i) && (l != j)) |
120 |
|
{ |
121 |
0 |
newdist[l] = (distances.getValue(i, l) + distances.getValue(j, l) |
122 |
|
- ijDistance) / 2; |
123 |
|
} |
124 |
|
else |
125 |
|
{ |
126 |
0 |
newdist[l] = 0; |
127 |
|
} |
128 |
|
} |
129 |
|
|
130 |
0 |
for (int ii = 0; ii < noseqs; ii++) |
131 |
|
{ |
132 |
0 |
distances.setValue(i, ii, newdist[ii]); |
133 |
0 |
distances.setValue(ii, i, newdist[ii]); |
134 |
|
} |
135 |
|
} |
136 |
|
} |