1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.io.packed; |
22 |
|
|
23 |
|
import jalview.analysis.TreeModel; |
24 |
|
import jalview.api.FeatureColourI; |
25 |
|
import jalview.datamodel.AlignmentI; |
26 |
|
import jalview.datamodel.SequenceI; |
27 |
|
import jalview.io.NewickFile; |
28 |
|
|
29 |
|
import java.util.ArrayList; |
30 |
|
import java.util.HashMap; |
31 |
|
import java.util.Hashtable; |
32 |
|
import java.util.List; |
33 |
|
import java.util.Map; |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 74 (74) |
Complexity: 29 |
Complexity Density: 0.76 |
|
35 |
|
public class JalviewDataset |
36 |
|
{ |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
AlignmentI parentDataset; |
41 |
|
|
42 |
|
|
43 |
|
@return |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
0 |
public AlignmentI getParentDataset()... |
46 |
|
{ |
47 |
0 |
return parentDataset; |
48 |
|
} |
49 |
|
|
50 |
|
|
51 |
|
@param |
52 |
|
|
53 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
0 |
public void setParentDataset(AlignmentI parentDataset)... |
55 |
|
{ |
56 |
0 |
this.parentDataset = parentDataset; |
57 |
|
} |
58 |
|
|
59 |
|
|
60 |
|
@return |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0 |
public Map<String, FeatureColourI> getFeatureColours()... |
63 |
|
{ |
64 |
0 |
return featureColours; |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
@param |
69 |
|
|
70 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
0 |
public void setFeatureColours(Map<String, FeatureColourI> featureColours)... |
72 |
|
{ |
73 |
0 |
this.featureColours = featureColours; |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
@return |
78 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
0 |
public Hashtable getSeqDetails()... |
80 |
|
{ |
81 |
0 |
return seqDetails; |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
@param |
86 |
|
|
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0 |
public void setSeqDetails(Hashtable seqDetails)... |
89 |
|
{ |
90 |
0 |
this.seqDetails = seqDetails; |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
@return |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
96 |
0 |
public List<AlignmentSet> getAl()... |
97 |
|
{ |
98 |
0 |
return (al == null) ? new ArrayList<AlignmentSet>() : al; |
99 |
|
} |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
List<AlignmentSet> al; |
105 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 6 |
Complexity Density: 0.6 |
|
106 |
|
public class AlignmentSet |
107 |
|
{ |
108 |
|
public AlignmentI al; |
109 |
|
|
110 |
|
public List<jalview.io.NewickFile> trees; |
111 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
112 |
0 |
AlignmentSet(AlignmentI a)... |
113 |
|
{ |
114 |
0 |
al = a; |
115 |
0 |
trees = new ArrayList<jalview.io.NewickFile>(); |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
@param |
123 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
124 |
0 |
void deuniquifyAlignment()... |
125 |
|
{ |
126 |
0 |
if (seqDetails == null || seqDetails.size() == 0) |
127 |
|
{ |
128 |
|
|
129 |
0 |
return; |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
0 |
jalview.analysis.SeqsetUtils.deuniquify(seqDetails, |
149 |
|
al.getSequencesArray(), true); |
150 |
|
|
151 |
0 |
for (NewickFile nf : trees) |
152 |
|
{ |
153 |
|
|
154 |
|
|
155 |
0 |
TreeModel njt = new TreeModel(al.getSequencesArray(), null, nf,null); |
156 |
|
|
157 |
|
|
158 |
0 |
njt.renameAssociatedNodes(); |
159 |
|
} |
160 |
|
|
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
private boolean modified = false; |
168 |
|
|
169 |
|
|
170 |
|
@return |
171 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
172 |
0 |
public boolean isModified()... |
173 |
|
{ |
174 |
0 |
return modified; |
175 |
|
} |
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
@param |
181 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
182 |
0 |
public void updateSetModified(boolean modifiedFromAction)... |
183 |
|
{ |
184 |
0 |
modified |= modifiedFromAction; |
185 |
|
} |
186 |
|
} |
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
Map<String, FeatureColourI> featureColours; |
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
Hashtable seqDetails; |
197 |
|
|
198 |
|
public boolean relaxedIdMatching = false; |
199 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
200 |
0 |
public JalviewDataset()... |
201 |
|
{ |
202 |
0 |
seqDetails = new Hashtable(); |
203 |
0 |
al = new ArrayList<AlignmentSet>(); |
204 |
0 |
parentDataset = null; |
205 |
0 |
featureColours = new HashMap<String, FeatureColourI>(); |
206 |
|
} |
207 |
|
|
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
@param |
212 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
213 |
0 |
public JalviewDataset(AlignmentI aldataset,... |
214 |
|
Map<String, FeatureColourI> fc, Hashtable seqDets) |
215 |
|
{ |
216 |
|
|
217 |
0 |
this(aldataset, fc, seqDets, null); |
218 |
|
} |
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
@param |
223 |
|
|
224 |
|
|
225 |
|
@param |
226 |
|
|
227 |
|
|
228 |
|
@param |
229 |
|
|
230 |
|
|
231 |
|
@param |
232 |
|
|
233 |
|
|
234 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
235 |
0 |
public JalviewDataset(AlignmentI aldataset,... |
236 |
|
Map<String, FeatureColourI> fc, Hashtable seqDets, |
237 |
|
AlignmentI parentAlignment) |
238 |
|
{ |
239 |
0 |
this(); |
240 |
0 |
parentDataset = aldataset; |
241 |
0 |
if (parentAlignment != null) |
242 |
|
{ |
243 |
0 |
parentDataset = parentAlignment.getDataset(); |
244 |
0 |
if (parentDataset == null) |
245 |
|
{ |
246 |
0 |
parentDataset = parentAlignment; |
247 |
|
} |
248 |
|
else |
249 |
|
{ |
250 |
0 |
addAlignment(parentAlignment); |
251 |
|
} |
252 |
|
} |
253 |
0 |
if (seqDets != null) |
254 |
|
{ |
255 |
0 |
seqDetails = seqDets; |
256 |
|
} |
257 |
0 |
if (fc != null) |
258 |
|
{ |
259 |
0 |
featureColours = fc; |
260 |
|
} |
261 |
|
|
262 |
|
} |
263 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
264 |
0 |
public boolean hasAlignments()... |
265 |
|
{ |
266 |
0 |
return al != null && al.size() > 0; |
267 |
|
} |
268 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 3 |
Complexity Density: 3 |
|
269 |
0 |
public AlignmentI getLastAlignment()... |
270 |
|
{ |
271 |
0 |
return (al == null || al.size() < 1) ? null : al.get(al.size() - 1).al; |
272 |
|
} |
273 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 3 |
Complexity Density: 3 |
|
274 |
0 |
public AlignmentSet getLastAlignmentSet()... |
275 |
|
{ |
276 |
0 |
return (al == null || al.size() < 1) ? null : al.get(al.size() - 1); |
277 |
|
} |
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
@param |
284 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
285 |
0 |
public void addAlignment(AlignmentI newal)... |
286 |
|
{ |
287 |
0 |
if (!hasAlignments()) |
288 |
|
{ |
289 |
0 |
al = new ArrayList<AlignmentSet>(); |
290 |
|
} |
291 |
0 |
AlignmentSet last = getLastAlignmentSet(); |
292 |
0 |
if (last != null) |
293 |
|
{ |
294 |
0 |
jalview.bin.Console.errPrintln("Deuniquifying last alignment set."); |
295 |
0 |
last.deuniquifyAlignment(); |
296 |
|
} |
297 |
0 |
al.add(new AlignmentSet(newal)); |
298 |
|
} |
299 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
300 |
0 |
public void addTreeFromFile(NewickFile nf)... |
301 |
|
{ |
302 |
0 |
AlignmentSet lal = getLastAlignmentSet(); |
303 |
0 |
lal.trees.add(nf); |
304 |
|
} |
305 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
306 |
0 |
public boolean hasSequenceAssoc()... |
307 |
|
{ |
308 |
|
|
309 |
0 |
return false; |
310 |
|
} |
311 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
312 |
0 |
public SequenceI getLastAssociatedSequence()... |
313 |
|
{ |
314 |
|
|
315 |
|
|
316 |
0 |
return null; |
317 |
|
} |
318 |
|
|
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
|
@param |
324 |
|
|
325 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
326 |
0 |
public void updateSetModified(boolean modified)... |
327 |
|
{ |
328 |
0 |
getLastAlignmentSet().updateSetModified(modified); |
329 |
|
} |
330 |
|
} |