1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws.jws1; |
22 |
|
|
23 |
|
import jalview.analysis.AlignSeq; |
24 |
|
import jalview.bin.Console; |
25 |
|
import jalview.datamodel.Alignment; |
26 |
|
import jalview.datamodel.AlignmentI; |
27 |
|
import jalview.datamodel.AlignmentOrder; |
28 |
|
import jalview.datamodel.AlignmentView; |
29 |
|
import jalview.datamodel.HiddenColumns; |
30 |
|
import jalview.datamodel.SequenceI; |
31 |
|
import jalview.gui.AlignFrame; |
32 |
|
import jalview.gui.Desktop; |
33 |
|
import jalview.gui.WebserviceInfo; |
34 |
|
import jalview.util.MessageManager; |
35 |
|
import jalview.ws.AWsJob; |
36 |
|
import jalview.ws.JobStateSummary; |
37 |
|
import jalview.ws.WSClientI; |
38 |
|
|
39 |
|
import java.util.Hashtable; |
40 |
|
import java.util.Vector; |
41 |
|
|
42 |
|
import vamsas.objects.simple.MsaResult; |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 229 (229) |
Complexity: 57 |
Complexity Density: 0.39 |
|
44 |
|
class MsaWSThread extends JWS1Thread implements WSClientI |
45 |
|
{ |
46 |
|
boolean submitGaps = false; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
boolean preserveOrder = true; |
51 |
|
|
52 |
|
|
53 |
|
|
|
|
| 0% |
Uncovered Elements: 145 (145) |
Complexity: 41 |
Complexity Density: 0.49 |
|
54 |
|
class MsaWSJob extends WSJob |
55 |
|
{ |
56 |
|
|
57 |
|
vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.SequenceSet(); |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
@param |
63 |
|
|
64 |
|
@param |
65 |
|
|
66 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
67 |
0 |
public MsaWSJob(int jobNum, SequenceI[] inSeqs)... |
68 |
|
{ |
69 |
0 |
this.jobnum = jobNum; |
70 |
0 |
if (!prepareInput(inSeqs, 2)) |
71 |
|
{ |
72 |
0 |
submitted = true; |
73 |
0 |
subjobComplete = true; |
74 |
0 |
result = new MsaResult(); |
75 |
0 |
result.setFinished(true); |
76 |
0 |
result.setStatus(MessageManager.getString("label.job_never_ran")); |
77 |
|
} |
78 |
|
|
79 |
|
} |
80 |
|
|
81 |
|
Hashtable SeqNames = new Hashtable(); |
82 |
|
|
83 |
|
Vector emptySeqs = new Vector(); |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
@param |
89 |
|
|
90 |
|
@param |
91 |
|
|
92 |
|
@return |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 11 |
Complexity Density: 0.5 |
|
94 |
0 |
private boolean prepareInput(SequenceI[] seqs, int minlen)... |
95 |
|
{ |
96 |
0 |
int nseqs = 0; |
97 |
0 |
if (minlen < 0) |
98 |
|
{ |
99 |
0 |
throw new Error(MessageManager.getString( |
100 |
|
"error.implementation_error_minlen_must_be_greater_zero")); |
101 |
|
} |
102 |
0 |
for (int i = 0; i < seqs.length; i++) |
103 |
|
{ |
104 |
0 |
if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) |
105 |
|
{ |
106 |
0 |
nseqs++; |
107 |
|
} |
108 |
|
} |
109 |
0 |
boolean valid = nseqs > 1; |
110 |
0 |
vamsas.objects.simple.Sequence[] seqarray = (valid) |
111 |
|
? new vamsas.objects.simple.Sequence[nseqs] |
112 |
|
: null; |
113 |
0 |
for (int i = 0, n = 0; i < seqs.length; i++) |
114 |
|
{ |
115 |
|
|
116 |
0 |
String newname = jalview.analysis.SeqsetUtils.unique_name(i); |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
0 |
SeqNames.put(newname, |
121 |
|
jalview.analysis.SeqsetUtils.SeqCharacterHash(seqs[i])); |
122 |
0 |
if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) |
123 |
|
{ |
124 |
0 |
seqarray[n] = new vamsas.objects.simple.Sequence(); |
125 |
0 |
seqarray[n].setId(newname); |
126 |
0 |
seqarray[n++].setSeq((submitGaps) ? seqs[i].getSequenceAsString() |
127 |
|
: AlignSeq.extractGaps(jalview.util.Comparison.GapChars, |
128 |
|
seqs[i].getSequenceAsString())); |
129 |
|
} |
130 |
|
else |
131 |
|
{ |
132 |
0 |
String empty = null; |
133 |
0 |
if (seqs[i].getEnd() >= seqs[i].getStart()) |
134 |
|
{ |
135 |
0 |
empty = (submitGaps) ? seqs[i].getSequenceAsString() |
136 |
|
: AlignSeq.extractGaps(jalview.util.Comparison.GapChars, |
137 |
|
seqs[i].getSequenceAsString()); |
138 |
|
} |
139 |
0 |
emptySeqs.add(new String[] { newname, empty }); |
140 |
|
} |
141 |
|
} |
142 |
0 |
this.seqs = new vamsas.objects.simple.SequenceSet(); |
143 |
0 |
this.seqs.setSeqs(seqarray); |
144 |
0 |
return valid; |
145 |
|
} |
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
@return |
150 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 6 |
Complexity Density: 2 |
|
151 |
0 |
@Override... |
152 |
|
public boolean hasResults() |
153 |
|
{ |
154 |
0 |
if (subjobComplete && result != null && result.isFinished() |
155 |
|
&& ((MsaResult) result).getMsa() != null |
156 |
|
&& ((MsaResult) result).getMsa().getSeqs() != null) |
157 |
|
{ |
158 |
0 |
return true; |
159 |
|
} |
160 |
0 |
return false; |
161 |
|
} |
162 |
|
|
|
|
| 0% |
Uncovered Elements: 77 (77) |
Complexity: 19 |
Complexity Density: 0.42 |
|
163 |
0 |
public Object[] getAlignment()... |
164 |
|
{ |
165 |
|
|
166 |
0 |
if (result != null && result.isFinished()) |
167 |
|
{ |
168 |
0 |
SequenceI[] alseqs = null; |
169 |
0 |
char alseq_gapchar = '-'; |
170 |
0 |
int alseq_l = 0; |
171 |
0 |
if (((MsaResult) result).getMsa() != null) |
172 |
|
{ |
173 |
0 |
alseqs = getVamsasAlignment(((MsaResult) result).getMsa()); |
174 |
0 |
alseq_gapchar = ((MsaResult) result).getMsa().getGapchar() |
175 |
|
.charAt(0); |
176 |
0 |
alseq_l = alseqs.length; |
177 |
|
} |
178 |
0 |
if (emptySeqs.size() > 0) |
179 |
|
{ |
180 |
0 |
SequenceI[] t_alseqs = new SequenceI[alseq_l + emptySeqs.size()]; |
181 |
|
|
182 |
0 |
int i, w = 0; |
183 |
0 |
if (alseq_l > 0) |
184 |
|
{ |
185 |
0 |
for (i = 0, w = alseqs[0].getLength(); i < alseq_l; i++) |
186 |
|
{ |
187 |
0 |
if (w < alseqs[i].getLength()) |
188 |
|
{ |
189 |
0 |
w = alseqs[i].getLength(); |
190 |
|
} |
191 |
0 |
t_alseqs[i] = alseqs[i]; |
192 |
0 |
alseqs[i] = null; |
193 |
|
} |
194 |
|
} |
195 |
|
|
196 |
0 |
int ow = w, nw = w; |
197 |
0 |
for (i = 0, w = emptySeqs.size(); i < w; i++) |
198 |
|
{ |
199 |
0 |
String[] es = (String[]) emptySeqs.get(i); |
200 |
0 |
if (es != null && es[1] != null) |
201 |
|
{ |
202 |
0 |
int sw = es[1].length(); |
203 |
0 |
if (nw < sw) |
204 |
|
{ |
205 |
0 |
nw = sw; |
206 |
|
} |
207 |
|
} |
208 |
|
} |
209 |
|
|
210 |
0 |
StringBuffer insbuff = new StringBuffer(w); |
211 |
0 |
for (i = 0; i < nw; i++) |
212 |
|
{ |
213 |
0 |
insbuff.append(alseq_gapchar); |
214 |
|
} |
215 |
0 |
if (ow < nw) |
216 |
|
{ |
217 |
0 |
for (i = 0; i < alseq_l; i++) |
218 |
|
{ |
219 |
0 |
int sw = t_alseqs[i].getLength(); |
220 |
0 |
if (nw > sw) |
221 |
|
{ |
222 |
|
|
223 |
0 |
alseqs[i].setSequence(t_alseqs[i].getSequenceAsString() |
224 |
|
+ insbuff.substring(0, sw - nw)); |
225 |
|
} |
226 |
|
} |
227 |
|
} |
228 |
0 |
for (i = 0, w = emptySeqs.size(); i < w; i++) |
229 |
|
{ |
230 |
0 |
String[] es = (String[]) emptySeqs.get(i); |
231 |
0 |
if (es[1] == null) |
232 |
|
{ |
233 |
0 |
t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence(es[0], |
234 |
|
insbuff.toString(), 1, 0); |
235 |
|
} |
236 |
|
else |
237 |
|
{ |
238 |
0 |
if (es[1].length() < nw) |
239 |
|
{ |
240 |
0 |
t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence( |
241 |
|
es[0], |
242 |
|
es[1] + insbuff.substring(0, nw - es[1].length()), |
243 |
|
1, 1 + es[1].length()); |
244 |
|
} |
245 |
|
else |
246 |
|
{ |
247 |
0 |
t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence( |
248 |
|
es[0], es[1]); |
249 |
|
} |
250 |
|
} |
251 |
|
} |
252 |
0 |
alseqs = t_alseqs; |
253 |
|
} |
254 |
0 |
AlignmentOrder msaorder = new AlignmentOrder(alseqs); |
255 |
|
|
256 |
0 |
jalview.analysis.AlignmentSorter.recoverOrder(alseqs); |
257 |
|
|
258 |
0 |
jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs); |
259 |
0 |
return new Object[] { alseqs, msaorder }; |
260 |
|
} |
261 |
0 |
return null; |
262 |
|
} |
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
267 |
0 |
void cancel()... |
268 |
|
{ |
269 |
0 |
cancelled = true; |
270 |
0 |
subjobComplete = true; |
271 |
0 |
result = null; |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
@return |
277 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
278 |
0 |
@Override... |
279 |
|
public boolean hasValidInput() |
280 |
|
{ |
281 |
0 |
if (seqs.getSeqs() != null) |
282 |
|
{ |
283 |
0 |
return true; |
284 |
|
} |
285 |
0 |
return false; |
286 |
|
} |
287 |
|
} |
288 |
|
|
289 |
|
String alTitle; |
290 |
|
|
291 |
|
AlignmentI dataset; |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
ext.vamsas.MuscleWS server = null; |
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
@param |
301 |
|
|
302 |
|
@param |
303 |
|
|
304 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
305 |
0 |
MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,... |
306 |
|
WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, |
307 |
|
AlignmentView alview, String wsname, boolean subgaps, |
308 |
|
boolean presorder) |
309 |
|
{ |
310 |
0 |
super(alFrame, wsinfo, alview, wsname, wsUrl); |
311 |
0 |
this.server = server; |
312 |
0 |
this.submitGaps = subgaps; |
313 |
0 |
this.preserveOrder = presorder; |
314 |
|
} |
315 |
|
|
316 |
|
|
317 |
|
|
318 |
|
|
319 |
|
@param |
320 |
|
|
321 |
|
@param |
322 |
|
|
323 |
|
@param |
324 |
|
|
325 |
|
@param |
326 |
|
|
327 |
|
@param |
328 |
|
|
329 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 5 |
Complexity Density: 0.33 |
|
330 |
0 |
MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,... |
331 |
|
WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, |
332 |
|
String wsname, String title, AlignmentView _msa, boolean subgaps, |
333 |
|
boolean presorder, AlignmentI seqset) |
334 |
|
{ |
335 |
0 |
this(server, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder); |
336 |
0 |
OutputHeader = wsInfo.getProgressText(); |
337 |
0 |
alTitle = title; |
338 |
0 |
dataset = seqset; |
339 |
|
|
340 |
0 |
SequenceI[][] conmsa = _msa.getVisibleContigs('-'); |
341 |
0 |
if (conmsa != null) |
342 |
|
{ |
343 |
0 |
int njobs = conmsa.length; |
344 |
0 |
jobs = new MsaWSJob[njobs]; |
345 |
0 |
for (int j = 0; j < njobs; j++) |
346 |
|
{ |
347 |
0 |
if (j != 0) |
348 |
|
{ |
349 |
0 |
jobs[j] = new MsaWSJob(wsinfo.addJobPane(), conmsa[j]); |
350 |
|
} |
351 |
|
else |
352 |
|
{ |
353 |
0 |
jobs[j] = new MsaWSJob(0, conmsa[j]); |
354 |
|
} |
355 |
0 |
if (njobs > 0) |
356 |
|
{ |
357 |
0 |
wsinfo.setProgressName("region " + jobs[j].getJobnum(), |
358 |
|
jobs[j].getJobnum()); |
359 |
|
} |
360 |
0 |
wsinfo.setProgressText(jobs[j].getJobnum(), OutputHeader); |
361 |
|
} |
362 |
|
} |
363 |
|
} |
364 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
365 |
0 |
@Override... |
366 |
|
public boolean isCancellable() |
367 |
|
{ |
368 |
0 |
return true; |
369 |
|
} |
370 |
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 12 |
Complexity Density: 0.46 |
|
371 |
0 |
@Override... |
372 |
|
public void cancelJob() |
373 |
|
{ |
374 |
0 |
if (!jobComplete && jobs != null) |
375 |
|
{ |
376 |
0 |
boolean cancelled = true; |
377 |
0 |
for (int job = 0; job < jobs.length; job++) |
378 |
|
{ |
379 |
0 |
if (jobs[job].isSubmitted() && !jobs[job].isSubjobComplete()) |
380 |
|
{ |
381 |
0 |
String cancelledMessage = ""; |
382 |
0 |
try |
383 |
|
{ |
384 |
0 |
vamsas.objects.simple.WsJobId cancelledJob = server |
385 |
|
.cancel(jobs[job].getJobId()); |
386 |
0 |
if (cancelledJob.getStatus() == 2) |
387 |
|
{ |
388 |
|
|
389 |
0 |
cancelledMessage = "Job cancelled."; |
390 |
0 |
((MsaWSJob) jobs[job]).cancel(); |
391 |
0 |
wsInfo.setStatus(jobs[job].getJobnum(), |
392 |
|
WebserviceInfo.STATE_CANCELLED_OK); |
393 |
|
} |
394 |
0 |
else if (cancelledJob.getStatus() == 3) |
395 |
|
{ |
396 |
|
|
397 |
0 |
cancelledMessage += "Server cannot cancel this job. just close the window.\n"; |
398 |
0 |
cancelled = false; |
399 |
|
|
400 |
|
|
401 |
|
} |
402 |
|
|
403 |
0 |
if (cancelledJob.getJobId() != null) |
404 |
|
{ |
405 |
0 |
cancelledMessage += ("[" + cancelledJob.getJobId() + "]"); |
406 |
|
} |
407 |
|
|
408 |
0 |
cancelledMessage += "\n"; |
409 |
|
} catch (Exception exc) |
410 |
|
{ |
411 |
0 |
cancelledMessage += ("\nProblems cancelling the job : Exception received...\n" |
412 |
|
+ exc + "\n"); |
413 |
0 |
Console.warn( |
414 |
|
"Exception whilst cancelling " + jobs[job].getJobId(), |
415 |
|
exc); |
416 |
|
} |
417 |
0 |
wsInfo.setProgressText(jobs[job].getJobnum(), |
418 |
|
OutputHeader + cancelledMessage + "\n"); |
419 |
|
} |
420 |
|
} |
421 |
0 |
if (cancelled) |
422 |
|
{ |
423 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK); |
424 |
0 |
jobComplete = true; |
425 |
|
} |
426 |
0 |
this.interrupt(); |
427 |
|
} |
428 |
|
else |
429 |
|
{ |
430 |
0 |
if (!jobComplete) |
431 |
|
{ |
432 |
0 |
wsInfo.setProgressText(OutputHeader |
433 |
|
+ "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); |
434 |
|
} |
435 |
|
} |
436 |
|
} |
437 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
438 |
0 |
@Override... |
439 |
|
public void pollJob(AWsJob job) throws Exception |
440 |
|
{ |
441 |
0 |
((MsaWSJob) job).result = server.getResult(((MsaWSJob) job).getJobId()); |
442 |
|
} |
443 |
|
|
|
|
| 0% |
Uncovered Elements: 39 (39) |
Complexity: 9 |
Complexity Density: 0.33 |
|
444 |
0 |
@Override... |
445 |
|
public void StartJob(AWsJob job) |
446 |
|
{ |
447 |
0 |
if (!(job instanceof MsaWSJob)) |
448 |
|
{ |
449 |
0 |
throw new Error(MessageManager.formatMessage( |
450 |
|
"error.implementation_error_msawbjob_called", new String[] |
451 |
|
{ job.getClass().toString() })); |
452 |
|
} |
453 |
0 |
MsaWSJob j = (MsaWSJob) job; |
454 |
0 |
if (j.isSubmitted()) |
455 |
|
{ |
456 |
0 |
if (Console.isDebugEnabled()) |
457 |
|
{ |
458 |
0 |
Console.debug( |
459 |
|
"Tried to submit an already submitted job " + j.getJobId()); |
460 |
|
} |
461 |
0 |
return; |
462 |
|
} |
463 |
0 |
if (j.seqs.getSeqs() == null) |
464 |
|
{ |
465 |
|
|
466 |
0 |
j.setSubmitted(true); |
467 |
0 |
j.result = new MsaResult(); |
468 |
0 |
j.result.setFinished(true); |
469 |
0 |
j.result.setStatus( |
470 |
|
MessageManager.getString("label.empty_alignment_job")); |
471 |
0 |
((MsaResult) j.result).setMsa(null); |
472 |
|
} |
473 |
0 |
try |
474 |
|
{ |
475 |
0 |
vamsas.objects.simple.WsJobId jobsubmit = server.align(j.seqs); |
476 |
|
|
477 |
0 |
if ((jobsubmit != null) && (jobsubmit.getStatus() == 1)) |
478 |
|
{ |
479 |
0 |
j.setJobId(jobsubmit.getJobId()); |
480 |
0 |
j.setSubmitted(true); |
481 |
0 |
j.setSubjobComplete(false); |
482 |
|
|
483 |
|
} |
484 |
|
else |
485 |
|
{ |
486 |
0 |
if (jobsubmit == null) |
487 |
|
{ |
488 |
0 |
throw new Exception(MessageManager.formatMessage( |
489 |
|
"exception.web_service_returned_null_try_later", |
490 |
|
new String[] |
491 |
|
{ WsUrl })); |
492 |
|
} |
493 |
|
|
494 |
0 |
throw new Exception(jobsubmit.getJobId()); |
495 |
|
} |
496 |
|
} catch (Exception e) |
497 |
|
{ |
498 |
|
|
499 |
|
|
500 |
0 |
jalview.bin.Console.errPrintln(WebServiceName |
501 |
|
+ "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" |
502 |
|
+ "When contacting Server:" + WsUrl + "\n" + e.toString() |
503 |
|
+ "\n"); |
504 |
0 |
j.setAllowedServerExceptions(0); |
505 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); |
506 |
0 |
wsInfo.setStatus(j.getJobnum(), |
507 |
|
WebserviceInfo.STATE_STOPPED_SERVERERROR); |
508 |
0 |
wsInfo.appendProgressText(j.getJobnum(), MessageManager |
509 |
|
.getString("info.failed_to_submit_sequences_for_alignment")); |
510 |
|
|
511 |
|
|
512 |
|
} |
513 |
|
} |
514 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
515 |
0 |
private jalview.datamodel.Sequence[] getVamsasAlignment(... |
516 |
|
vamsas.objects.simple.Alignment valign) |
517 |
|
{ |
518 |
|
|
519 |
0 |
vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs(); |
520 |
0 |
jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.length]; |
521 |
|
|
522 |
0 |
for (int i = 0, j = seqs.length; i < j; i++) |
523 |
|
{ |
524 |
0 |
msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), |
525 |
|
seqs[i].getSeq()); |
526 |
|
} |
527 |
|
|
528 |
0 |
return msa; |
529 |
|
} |
530 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 9 |
Complexity Density: 0.45 |
|
531 |
0 |
@Override... |
532 |
|
public void parseResult() |
533 |
|
{ |
534 |
0 |
int results = 0; |
535 |
0 |
JobStateSummary finalState = new JobStateSummary(); |
536 |
0 |
try |
537 |
|
{ |
538 |
0 |
for (int j = 0; j < jobs.length; j++) |
539 |
|
{ |
540 |
0 |
finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); |
541 |
0 |
if (jobs[j].isSubmitted() && jobs[j].isSubjobComplete() |
542 |
|
&& jobs[j].hasResults()) |
543 |
|
{ |
544 |
0 |
results++; |
545 |
|
|
546 |
|
|
547 |
|
|
548 |
|
|
549 |
|
|
550 |
|
|
551 |
|
|
552 |
0 |
vamsas.objects.simple.Alignment valign = ((MsaResult) ((MsaWSJob) jobs[j]).result) |
553 |
|
.getMsa(); |
554 |
0 |
if (valign != null) |
555 |
|
{ |
556 |
0 |
wsInfo.appendProgressText(jobs[j].getJobnum(), MessageManager |
557 |
|
.getString("info.alignment_object_method_notes")); |
558 |
0 |
String[] lines = valign.getMethod(); |
559 |
0 |
for (int line = 0; line < lines.length; line++) |
560 |
|
{ |
561 |
0 |
wsInfo.appendProgressText(jobs[j].getJobnum(), |
562 |
|
lines[line] + "\n"); |
563 |
|
} |
564 |
|
|
565 |
|
|
566 |
|
|
567 |
|
|
568 |
|
} |
569 |
|
} |
570 |
|
} |
571 |
|
} catch (Exception ex) |
572 |
|
{ |
573 |
|
|
574 |
0 |
Console.error( |
575 |
|
"Unexpected exception when processing results for " + alTitle, |
576 |
|
ex); |
577 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); |
578 |
|
} |
579 |
0 |
if (results > 0) |
580 |
|
{ |
581 |
0 |
wsInfo.showResultsNewFrame |
582 |
|
.addActionListener(new java.awt.event.ActionListener() |
583 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
584 |
0 |
@Override... |
585 |
|
public void actionPerformed(java.awt.event.ActionEvent evt) |
586 |
|
{ |
587 |
0 |
displayResults(true); |
588 |
|
} |
589 |
|
}); |
590 |
0 |
wsInfo.mergeResults |
591 |
|
.addActionListener(new java.awt.event.ActionListener() |
592 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
593 |
0 |
@Override... |
594 |
|
public void actionPerformed(java.awt.event.ActionEvent evt) |
595 |
|
{ |
596 |
0 |
displayResults(false); |
597 |
|
} |
598 |
|
}); |
599 |
0 |
wsInfo.setResultsReady(); |
600 |
|
} |
601 |
|
else |
602 |
|
{ |
603 |
0 |
wsInfo.setFinishedNoResults(); |
604 |
|
} |
605 |
|
} |
606 |
|
|
|
|
| 0% |
Uncovered Elements: 67 (67) |
Complexity: 14 |
Complexity Density: 0.33 |
|
607 |
0 |
void displayResults(boolean newFrame)... |
608 |
|
{ |
609 |
|
|
610 |
0 |
Vector alorders = new Vector(); |
611 |
0 |
SequenceI[][] results = new SequenceI[jobs.length][]; |
612 |
0 |
AlignmentOrder[] orders = new AlignmentOrder[jobs.length]; |
613 |
0 |
for (int j = 0; j < jobs.length; j++) |
614 |
|
{ |
615 |
0 |
if (jobs[j].hasResults()) |
616 |
|
{ |
617 |
0 |
Object[] res = ((MsaWSJob) jobs[j]).getAlignment(); |
618 |
0 |
alorders.add(res[1]); |
619 |
0 |
results[j] = (SequenceI[]) res[0]; |
620 |
0 |
orders[j] = (AlignmentOrder) res[1]; |
621 |
|
|
622 |
|
|
623 |
|
} |
624 |
|
else |
625 |
|
{ |
626 |
0 |
results[j] = null; |
627 |
|
} |
628 |
|
} |
629 |
0 |
Object[] newview = input.getUpdatedView(results, orders, getGapChar()); |
630 |
|
|
631 |
0 |
for (int j = 0; j < jobs.length; j++) |
632 |
|
{ |
633 |
0 |
results[j] = null; |
634 |
0 |
orders[j] = null; |
635 |
|
} |
636 |
0 |
SequenceI[] alignment = (SequenceI[]) newview[0]; |
637 |
0 |
HiddenColumns hidden = (HiddenColumns) newview[1]; |
638 |
0 |
Alignment al = new Alignment(alignment); |
639 |
|
|
640 |
|
|
641 |
0 |
if (dataset != null) |
642 |
|
{ |
643 |
0 |
al.setDataset(dataset); |
644 |
|
} |
645 |
|
|
646 |
0 |
propagateDatasetMappings(al); |
647 |
|
|
648 |
|
|
649 |
0 |
if (newFrame) |
650 |
|
{ |
651 |
0 |
AlignFrame af = new AlignFrame(al, hidden, AlignFrame.DEFAULT_WIDTH, |
652 |
|
AlignFrame.DEFAULT_HEIGHT); |
653 |
|
|
654 |
|
|
655 |
0 |
af.getFeatureRenderer().transferSettings(this.featureSettings); |
656 |
|
|
657 |
0 |
if (alorders.size() > 0) |
658 |
|
{ |
659 |
0 |
if (alorders.size() == 1) |
660 |
|
{ |
661 |
0 |
af.addSortByOrderMenuItem(WebServiceName + " Ordering", |
662 |
|
(AlignmentOrder) alorders.get(0)); |
663 |
|
} |
664 |
|
else |
665 |
|
{ |
666 |
|
|
667 |
0 |
Vector names = new Vector(); |
668 |
0 |
for (int i = 0, l = alorders.size(); i < l; i++) |
669 |
|
{ |
670 |
0 |
String orderName = new String(" Region " + i); |
671 |
0 |
int j = i + 1; |
672 |
|
|
673 |
0 |
while (j < l) |
674 |
|
{ |
675 |
0 |
if (((AlignmentOrder) alorders.get(i)) |
676 |
|
.equals((alorders.get(j)))) |
677 |
|
{ |
678 |
0 |
alorders.remove(j); |
679 |
0 |
l--; |
680 |
0 |
orderName += "," + j; |
681 |
|
} |
682 |
|
else |
683 |
|
{ |
684 |
0 |
j++; |
685 |
|
} |
686 |
|
} |
687 |
|
|
688 |
0 |
if (i == 0 && j == 1) |
689 |
|
{ |
690 |
0 |
names.add(new String("")); |
691 |
|
} |
692 |
|
else |
693 |
|
{ |
694 |
0 |
names.add(orderName); |
695 |
|
} |
696 |
|
} |
697 |
0 |
for (int i = 0, l = alorders.size(); i < l; i++) |
698 |
|
{ |
699 |
0 |
af.addSortByOrderMenuItem( |
700 |
|
WebServiceName + ((String) names.get(i)) + " Ordering", |
701 |
|
(AlignmentOrder) alorders.get(i)); |
702 |
|
} |
703 |
|
} |
704 |
|
} |
705 |
|
|
706 |
0 |
Desktop.addInternalFrame(af, alTitle, AlignFrame.DEFAULT_WIDTH, |
707 |
|
AlignFrame.DEFAULT_HEIGHT); |
708 |
|
|
709 |
|
} |
710 |
|
else |
711 |
|
{ |
712 |
0 |
jalview.bin.Console.outPrintln("MERGE WITH OLD FRAME"); |
713 |
|
|
714 |
|
|
715 |
|
|
716 |
|
} |
717 |
|
} |
718 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
719 |
0 |
@Override... |
720 |
|
public boolean canMergeResults() |
721 |
|
{ |
722 |
0 |
return false; |
723 |
|
} |
724 |
|
} |