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.analysis.SeqsetUtils; |
25 |
|
import jalview.bin.Console; |
26 |
|
import jalview.datamodel.Alignment; |
27 |
|
import jalview.datamodel.AlignmentAnnotation; |
28 |
|
import jalview.datamodel.AlignmentI; |
29 |
|
import jalview.datamodel.AlignmentView; |
30 |
|
import jalview.datamodel.HiddenColumns; |
31 |
|
import jalview.datamodel.SequenceI; |
32 |
|
import jalview.gui.AlignFrame; |
33 |
|
import jalview.gui.Desktop; |
34 |
|
import jalview.gui.WebserviceInfo; |
35 |
|
import jalview.io.DataSourceType; |
36 |
|
import jalview.io.FileFormatI; |
37 |
|
import jalview.io.FormatAdapter; |
38 |
|
import jalview.io.IdentifyFile; |
39 |
|
import jalview.io.JPredFile; |
40 |
|
import jalview.io.JnetAnnotationMaker; |
41 |
|
import jalview.io.PileUpfile; |
42 |
|
import jalview.util.Comparison; |
43 |
|
import jalview.util.MessageManager; |
44 |
|
import jalview.ws.AWsJob; |
45 |
|
import jalview.ws.JobStateSummary; |
46 |
|
import jalview.ws.WSClientI; |
47 |
|
|
48 |
|
import java.util.Hashtable; |
49 |
|
import java.util.List; |
50 |
|
|
51 |
|
import vamsas.objects.simple.JpredResult; |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 150 (150) |
Complexity: 37 |
Complexity Density: 0.38 |
|
53 |
|
class JPredThread extends JWS1Thread implements WSClientI |
54 |
|
{ |
55 |
|
|
56 |
|
|
|
|
| 0% |
Uncovered Elements: 169 (169) |
Complexity: 43 |
Complexity Density: 0.41 |
|
57 |
|
class JPredJob extends WSJob |
58 |
|
{ |
59 |
|
|
60 |
|
|
61 |
|
int[] predMap = null; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
vamsas.objects.simple.Sequence sequence; |
66 |
|
|
67 |
|
vamsas.objects.simple.Msfalignment msa; |
68 |
|
|
69 |
|
java.util.Hashtable SequenceInfo = null; |
70 |
|
|
71 |
|
int msaIndex = 0; |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
@return |
79 |
|
|
80 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 6 |
Complexity Density: 2 |
|
81 |
0 |
@Override... |
82 |
|
public boolean hasResults() |
83 |
|
{ |
84 |
0 |
if (subjobComplete && result != null && result.isFinished() |
85 |
|
&& ((JpredResult) result).getPredfile() != null |
86 |
|
&& ((JpredResult) result).getAligfile() != null) |
87 |
|
{ |
88 |
0 |
return true; |
89 |
|
} |
90 |
0 |
return false; |
91 |
|
} |
92 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
93 |
0 |
@Override... |
94 |
|
public boolean hasValidInput() |
95 |
|
{ |
96 |
0 |
if (sequence != null) |
97 |
|
{ |
98 |
0 |
return true; |
99 |
|
} |
100 |
0 |
return false; |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
@return |
106 |
|
|
107 |
|
|
108 |
|
@throws |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 84 (84) |
Complexity: 17 |
Complexity Density: 0.3 |
|
110 |
0 |
public Object[] getResultSet() throws Exception... |
111 |
|
{ |
112 |
0 |
if (result == null || !result.isFinished()) |
113 |
|
{ |
114 |
0 |
return null; |
115 |
|
} |
116 |
0 |
AlignmentI al = null; |
117 |
0 |
HiddenColumns alhidden = null; |
118 |
0 |
int FirstSeq = -1; |
119 |
|
|
120 |
0 |
JpredResult result = (JpredResult) this.result; |
121 |
|
|
122 |
0 |
Console.debug("Parsing output from JNet job."); |
123 |
|
|
124 |
|
|
125 |
0 |
JPredFile prediction = new JPredFile(result.getPredfile(), |
126 |
|
DataSourceType.PASTE); |
127 |
0 |
SequenceI[] preds = prediction.getSeqsAsArray(); |
128 |
0 |
Console.debug("Got prediction profile."); |
129 |
|
|
130 |
0 |
if ((this.msa != null) && (result.getAligfile() != null)) |
131 |
|
{ |
132 |
0 |
Console.debug("Getting associated alignment."); |
133 |
|
|
134 |
|
|
135 |
0 |
FileFormatI format = new IdentifyFile() |
136 |
|
.identify(result.getAligfile(), DataSourceType.PASTE); |
137 |
|
|
138 |
0 |
if (format != null) |
139 |
|
{ |
140 |
0 |
SequenceI sqs[]; |
141 |
0 |
if (predMap != null) |
142 |
|
{ |
143 |
0 |
Object[] alandcolsel = input |
144 |
|
.getAlignmentAndHiddenColumns(getGapChar()); |
145 |
0 |
sqs = (SequenceI[]) alandcolsel[0]; |
146 |
0 |
al = new Alignment(sqs); |
147 |
0 |
alhidden = (HiddenColumns) alandcolsel[1]; |
148 |
|
} |
149 |
|
else |
150 |
|
{ |
151 |
0 |
al = new FormatAdapter().readFile(result.getAligfile(), |
152 |
|
DataSourceType.PASTE, format); |
153 |
0 |
sqs = new SequenceI[al.getHeight()]; |
154 |
|
|
155 |
0 |
for (int i = 0, j = al.getHeight(); i < j; i++) |
156 |
|
{ |
157 |
0 |
sqs[i] = al.getSequenceAt(i); |
158 |
|
} |
159 |
0 |
if (!SeqsetUtils.deuniquify(SequenceInfo, sqs)) |
160 |
|
{ |
161 |
0 |
throw (new Exception(MessageManager.getString( |
162 |
|
"exception.couldnt_recover_sequence_properties_for_alignment"))); |
163 |
|
} |
164 |
|
} |
165 |
0 |
FirstSeq = 0; |
166 |
0 |
if (currentView.getDataset() != null) |
167 |
|
{ |
168 |
0 |
al.setDataset(currentView.getDataset()); |
169 |
|
|
170 |
|
} |
171 |
|
else |
172 |
|
{ |
173 |
0 |
al.setDataset(null); |
174 |
|
} |
175 |
0 |
JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, |
176 |
|
false, predMap); |
177 |
|
|
178 |
|
} |
179 |
|
else |
180 |
|
{ |
181 |
0 |
throw (new Exception(MessageManager.formatMessage( |
182 |
|
"exception.unknown_format_for_file", new String[] |
183 |
|
{ "", result.getAligfile() }))); |
184 |
|
} |
185 |
|
} |
186 |
|
else |
187 |
|
{ |
188 |
0 |
al = new Alignment(preds); |
189 |
0 |
FirstSeq = prediction.getQuerySeqPosition(); |
190 |
0 |
if (predMap != null) |
191 |
|
{ |
192 |
0 |
char gc = getGapChar(); |
193 |
0 |
SequenceI[] sqs = (SequenceI[]) input |
194 |
|
.getAlignmentAndHiddenColumns(gc)[0]; |
195 |
0 |
if (this.msaIndex >= sqs.length) |
196 |
|
{ |
197 |
0 |
throw new Error(MessageManager.getString( |
198 |
|
"error.implementation_error_invalid_msa_index_for_job")); |
199 |
|
} |
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
0 |
new jalview.commands.RemoveGapsCommand( |
205 |
|
MessageManager.getString("label.remove_gaps"), |
206 |
|
new SequenceI[] |
207 |
|
{ sqs[msaIndex] }, currentView); |
208 |
|
|
209 |
0 |
SequenceI profileseq = al.getSequenceAt(FirstSeq); |
210 |
0 |
profileseq.setSequence(sqs[msaIndex].getSequenceAsString()); |
211 |
|
} |
212 |
|
|
213 |
0 |
if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash( |
214 |
|
al.getSequenceAt(FirstSeq), SequenceInfo)) |
215 |
|
{ |
216 |
0 |
throw (new Exception(MessageManager.getString( |
217 |
|
"exception.couldnt_recover_sequence_props_for_jnet_query"))); |
218 |
|
} |
219 |
|
else |
220 |
|
{ |
221 |
0 |
if (currentView.getDataset() != null) |
222 |
|
{ |
223 |
0 |
al.setDataset(currentView.getDataset()); |
224 |
|
|
225 |
|
} |
226 |
|
else |
227 |
|
{ |
228 |
0 |
al.setDataset(null); |
229 |
|
} |
230 |
0 |
jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, |
231 |
|
FirstSeq, true, predMap); |
232 |
0 |
SequenceI profileseq = al.getSequenceAt(0); |
233 |
0 |
alignToProfileSeq(al, profileseq); |
234 |
0 |
if (predMap != null) |
235 |
|
{ |
236 |
|
|
237 |
|
|
238 |
0 |
alhidden = al.propagateInsertions(profileseq, input); |
239 |
|
} |
240 |
|
} |
241 |
|
} |
242 |
|
|
243 |
0 |
for (AlignmentAnnotation alant : al.getAlignmentAnnotation()) |
244 |
|
{ |
245 |
0 |
if (alant.sequenceRef != null) |
246 |
|
{ |
247 |
0 |
replaceAnnotationOnAlignmentWith(alant, alant.label, |
248 |
0 |
"jalview.jws1.Jpred" + (this.msa == null ? "" : "MSA"), |
249 |
|
alant.sequenceRef); |
250 |
|
} |
251 |
|
} |
252 |
0 |
return new Object[] { al, alhidden }; |
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
@param |
259 |
|
@param |
260 |
|
@param |
261 |
|
@param |
262 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.4 |
|
263 |
0 |
protected void replaceAnnotationOnAlignmentWith(... |
264 |
|
AlignmentAnnotation newAnnot, String typeName, String calcId, |
265 |
|
SequenceI aSeq) |
266 |
|
{ |
267 |
0 |
SequenceI dsseq = aSeq.getDatasetSequence(); |
268 |
0 |
while (dsseq.getDatasetSequence() != null) |
269 |
|
{ |
270 |
0 |
dsseq = dsseq.getDatasetSequence(); |
271 |
|
} |
272 |
|
|
273 |
0 |
List<AlignmentAnnotation> dsan = dsseq.getAlignmentAnnotations(calcId, |
274 |
|
typeName); |
275 |
0 |
if (dsan != null && dsan.size() > 0) |
276 |
|
{ |
277 |
0 |
for (AlignmentAnnotation dssan : dsan) |
278 |
|
{ |
279 |
0 |
dsseq.removeAlignmentAnnotation(dssan); |
280 |
|
} |
281 |
|
} |
282 |
0 |
AlignmentAnnotation dssan = new AlignmentAnnotation(newAnnot); |
283 |
0 |
dsseq.addAlignmentAnnotation(dssan); |
284 |
0 |
dssan.adjustForAlignment(); |
285 |
|
} |
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
@param |
293 |
|
@param |
294 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 8 |
Complexity Density: 0.47 |
|
295 |
0 |
private void alignToProfileSeq(AlignmentI al, SequenceI profileseq)... |
296 |
|
{ |
297 |
0 |
char gc = al.getGapCharacter(); |
298 |
0 |
int[] gapMap = profileseq.gapMap(); |
299 |
|
|
300 |
0 |
for (int lp = 0, r = 0; r < gapMap.length; r++) |
301 |
|
{ |
302 |
0 |
if (gapMap[r] - lp > 1) |
303 |
|
{ |
304 |
0 |
StringBuffer sb = new StringBuffer(); |
305 |
0 |
for (int s = 0, ns = gapMap[r] - lp; s < ns; s++) |
306 |
|
{ |
307 |
0 |
sb.append(gc); |
308 |
|
} |
309 |
0 |
for (int s = 1, ns = al.getHeight(); s < ns; s++) |
310 |
|
{ |
311 |
0 |
String sq = al.getSequenceAt(s).getSequenceAsString(); |
312 |
0 |
int diff = gapMap[r] - sq.length(); |
313 |
0 |
if (diff > 0) |
314 |
|
{ |
315 |
|
|
316 |
0 |
sq = sq + sb; |
317 |
0 |
while ((diff = gapMap[r] - sq.length()) > 0) |
318 |
|
{ |
319 |
0 |
sq = sq + ((diff >= sb.length()) ? sb.toString() |
320 |
|
: sb.substring(0, diff)); |
321 |
|
} |
322 |
0 |
al.getSequenceAt(s).setSequence(sq); |
323 |
|
} |
324 |
|
else |
325 |
|
{ |
326 |
0 |
al.getSequenceAt(s).setSequence(sq.substring(0, gapMap[r]) |
327 |
|
+ sb.toString() + sq.substring(gapMap[r])); |
328 |
|
} |
329 |
|
} |
330 |
|
} |
331 |
0 |
lp = gapMap[r]; |
332 |
|
} |
333 |
|
} |
334 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
335 |
0 |
public JPredJob(Hashtable SequenceInfo, SequenceI seq, int[] delMap)... |
336 |
|
{ |
337 |
0 |
super(); |
338 |
0 |
this.predMap = delMap; |
339 |
0 |
String sq = AlignSeq.extractGaps(Comparison.GapChars, |
340 |
|
seq.getSequenceAsString()); |
341 |
0 |
if (sq.length() >= 20) |
342 |
|
{ |
343 |
0 |
this.SequenceInfo = SequenceInfo; |
344 |
0 |
sequence = new vamsas.objects.simple.Sequence(); |
345 |
0 |
sequence.setId(seq.getName()); |
346 |
0 |
sequence.setSeq(sq); |
347 |
|
} |
348 |
|
else |
349 |
|
{ |
350 |
0 |
errorMessage = "Sequence is too short to predict with JPred - need at least 20 amino acids."; |
351 |
|
} |
352 |
|
} |
353 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
354 |
0 |
public JPredJob(Hashtable SequenceInfo, SequenceI[] msf, int[] delMap)... |
355 |
|
{ |
356 |
0 |
this(SequenceInfo, msf[0], delMap); |
357 |
0 |
if (sequence != null) |
358 |
|
{ |
359 |
0 |
if (msf.length > 1) |
360 |
|
{ |
361 |
0 |
msa = new vamsas.objects.simple.Msfalignment(); |
362 |
0 |
PileUpfile pileup = new PileUpfile(); |
363 |
0 |
msa.setMsf(pileup.print(msf, true)); |
364 |
|
} |
365 |
|
} |
366 |
|
} |
367 |
|
|
368 |
|
String errorMessage = ""; |
369 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
370 |
0 |
public String getValidationMessages()... |
371 |
|
{ |
372 |
0 |
return errorMessage + "\n"; |
373 |
|
} |
374 |
|
} |
375 |
|
|
376 |
|
ext.vamsas.Jpred server; |
377 |
|
|
378 |
|
String altitle = ""; |
379 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
380 |
0 |
JPredThread(WebserviceInfo wsinfo, String altitle,... |
381 |
|
ext.vamsas.Jpred server, String wsurl, AlignmentView alview, |
382 |
|
AlignFrame alframe) |
383 |
|
{ |
384 |
0 |
super(alframe, wsinfo, alview, wsurl); |
385 |
0 |
this.altitle = altitle; |
386 |
0 |
this.server = server; |
387 |
|
} |
388 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
389 |
0 |
JPredThread(WebserviceInfo wsinfo, String altitle,... |
390 |
|
ext.vamsas.Jpred server, String wsurl, Hashtable SequenceInfo, |
391 |
|
SequenceI seq, int[] delMap, AlignmentView alview, |
392 |
|
AlignFrame alframe) |
393 |
|
{ |
394 |
0 |
this(wsinfo, altitle, server, wsurl, alview, alframe); |
395 |
0 |
JPredJob job = new JPredJob(SequenceInfo, seq, delMap); |
396 |
0 |
if (job.hasValidInput()) |
397 |
|
{ |
398 |
0 |
OutputHeader = wsInfo.getProgressText(); |
399 |
0 |
jobs = new WSJob[] { job }; |
400 |
0 |
job.setJobnum(0); |
401 |
|
} |
402 |
|
else |
403 |
|
{ |
404 |
0 |
wsInfo.appendProgressText(job.getValidationMessages()); |
405 |
|
} |
406 |
|
} |
407 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
408 |
0 |
JPredThread(WebserviceInfo wsinfo, String altitle,... |
409 |
|
ext.vamsas.Jpred server, Hashtable SequenceInfo, SequenceI[] msf, |
410 |
|
int[] delMap, AlignmentView alview, AlignFrame alframe, |
411 |
|
String wsurl) |
412 |
|
{ |
413 |
0 |
this(wsinfo, altitle, server, wsurl, alview, alframe); |
414 |
0 |
JPredJob job = new JPredJob(SequenceInfo, msf, delMap); |
415 |
0 |
if (job.hasValidInput()) |
416 |
|
{ |
417 |
0 |
jobs = new WSJob[] { job }; |
418 |
0 |
OutputHeader = wsInfo.getProgressText(); |
419 |
0 |
job.setJobnum(0); |
420 |
|
} |
421 |
|
else |
422 |
|
{ |
423 |
0 |
wsInfo.appendProgressText(job.getValidationMessages()); |
424 |
|
} |
425 |
|
} |
426 |
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 8 |
Complexity Density: 0.28 |
|
427 |
0 |
@Override... |
428 |
|
public void StartJob(AWsJob j) |
429 |
|
{ |
430 |
0 |
if (!(j instanceof JPredJob)) |
431 |
|
{ |
432 |
0 |
throw new Error(MessageManager.formatMessage( |
433 |
|
"error.implementation_error_startjob_called", new String[] |
434 |
|
{ j.getClass().toString() })); |
435 |
|
} |
436 |
0 |
try |
437 |
|
{ |
438 |
0 |
JPredJob job = (JPredJob) j; |
439 |
0 |
if (job.msa != null) |
440 |
|
{ |
441 |
0 |
job.setJobId(server.predictOnMsa(job.msa)); |
442 |
|
} |
443 |
0 |
else if (job.sequence != null) |
444 |
|
{ |
445 |
0 |
job.setJobId(server.predict(job.sequence)); |
446 |
|
|
447 |
|
} |
448 |
|
|
449 |
0 |
if (job.getJobId() != null) |
450 |
|
{ |
451 |
0 |
if (job.getJobId().startsWith("Broken")) |
452 |
|
{ |
453 |
0 |
job.result = new JpredResult(); |
454 |
0 |
job.result.setInvalid(true); |
455 |
0 |
job.result.setStatus(MessageManager |
456 |
|
.formatMessage("label.submission_params", new String[] |
457 |
|
{ job.getJobId().toString() })); |
458 |
0 |
throw new Exception(job.getJobId()); |
459 |
|
} |
460 |
|
else |
461 |
|
{ |
462 |
0 |
job.setSubmitted(true); |
463 |
0 |
job.setSubjobComplete(false); |
464 |
0 |
Console.info(WsUrl + " Job Id '" + job.getJobId() + "'"); |
465 |
|
} |
466 |
|
} |
467 |
|
else |
468 |
|
{ |
469 |
0 |
throw new Exception(MessageManager |
470 |
|
.getString("exception.server_timeout_try_later")); |
471 |
|
} |
472 |
|
} catch (Exception e) |
473 |
|
{ |
474 |
|
|
475 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); |
476 |
0 |
if (e.getMessage().indexOf("Exception") > -1) |
477 |
|
{ |
478 |
0 |
wsInfo.setStatus(j.getJobnum(), |
479 |
|
WebserviceInfo.STATE_STOPPED_SERVERERROR); |
480 |
0 |
wsInfo.setProgressText(j.getJobnum(), |
481 |
|
"Failed to submit the prediction. (Just close the window)\n" |
482 |
|
+ "It is most likely that there is a problem with the server.\n"); |
483 |
0 |
jalview.bin.Console.errPrintln( |
484 |
|
"JPredWS Client: Failed to submit the prediction. Quite possibly because of a server error - see below)\n" |
485 |
|
+ e.getMessage() + "\n"); |
486 |
|
|
487 |
0 |
Console.warn("Server Exception", e); |
488 |
|
} |
489 |
|
else |
490 |
|
{ |
491 |
0 |
wsInfo.setStatus(j.getJobnum(), WebserviceInfo.STATE_STOPPED_ERROR); |
492 |
|
|
493 |
0 |
wsInfo.appendProgressText(j.getJobnum(), |
494 |
|
MessageManager.formatMessage( |
495 |
|
"info.failed_to_submit_prediction", new String[] |
496 |
|
{ e.getMessage(), wsInfo.getProgressText() })); |
497 |
|
|
498 |
0 |
Console.debug("Failed Submission of job " + j.getJobnum(), e); |
499 |
|
|
500 |
|
} |
501 |
0 |
j.setAllowedServerExceptions(-1); |
502 |
0 |
j.setSubjobComplete(true); |
503 |
|
} |
504 |
|
} |
505 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 7 |
Complexity Density: 0.44 |
|
506 |
0 |
@Override... |
507 |
|
public void parseResult() |
508 |
|
{ |
509 |
0 |
int results = 0; |
510 |
0 |
JobStateSummary finalState = new JobStateSummary(); |
511 |
0 |
try |
512 |
|
{ |
513 |
0 |
for (int j = 0; j < jobs.length; j++) |
514 |
|
{ |
515 |
0 |
finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); |
516 |
0 |
if (jobs[j].isSubmitted() && jobs[j].isSubjobComplete() |
517 |
|
&& jobs[j].hasResults()) |
518 |
|
{ |
519 |
0 |
results++; |
520 |
|
} |
521 |
|
} |
522 |
|
} catch (Exception ex) |
523 |
|
{ |
524 |
|
|
525 |
0 |
Console.error( |
526 |
|
"Unexpected exception when processing results for " + altitle, |
527 |
|
ex); |
528 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); |
529 |
|
} |
530 |
0 |
if (results > 0) |
531 |
|
{ |
532 |
0 |
wsInfo.showResultsNewFrame |
533 |
|
.addActionListener(new java.awt.event.ActionListener() |
534 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
535 |
0 |
@Override... |
536 |
|
public void actionPerformed(java.awt.event.ActionEvent evt) |
537 |
|
{ |
538 |
0 |
displayResults(true); |
539 |
|
} |
540 |
|
}); |
541 |
0 |
wsInfo.mergeResults |
542 |
|
.addActionListener(new java.awt.event.ActionListener() |
543 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
544 |
0 |
@Override... |
545 |
|
public void actionPerformed(java.awt.event.ActionEvent evt) |
546 |
|
{ |
547 |
0 |
displayResults(false); |
548 |
|
} |
549 |
|
}); |
550 |
0 |
wsInfo.setResultsReady(); |
551 |
|
} |
552 |
|
else |
553 |
|
{ |
554 |
0 |
wsInfo.setStatus(wsInfo.STATE_STOPPED_ERROR); |
555 |
0 |
wsInfo.appendInfoText("No jobs ran."); |
556 |
0 |
wsInfo.setFinishedNoResults(); |
557 |
|
} |
558 |
|
} |
559 |
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 11 |
Complexity Density: 0.37 |
|
560 |
0 |
void displayResults(boolean newWindow)... |
561 |
|
{ |
562 |
|
|
563 |
0 |
if (jobs != null) |
564 |
|
{ |
565 |
0 |
Object[] res = null; |
566 |
0 |
boolean msa = false; |
567 |
0 |
for (int jn = 0; jn < jobs.length; jn++) |
568 |
|
{ |
569 |
0 |
Object[] jobres = null; |
570 |
0 |
JPredJob j = (JPredJob) jobs[jn]; |
571 |
|
|
572 |
0 |
if (j.hasResults()) |
573 |
|
{ |
574 |
|
|
575 |
|
|
576 |
0 |
msa = (j.msa != null) ? true : msa; |
577 |
0 |
try |
578 |
|
{ |
579 |
0 |
Console.debug("Parsing output of job " + jn); |
580 |
0 |
jobres = j.getResultSet(); |
581 |
0 |
Console.debug("Finished parsing output."); |
582 |
0 |
if (jobs.length == 1) |
583 |
|
{ |
584 |
0 |
res = jobres; |
585 |
|
} |
586 |
|
else |
587 |
|
{ |
588 |
|
|
589 |
0 |
throw new Error(MessageManager.getString( |
590 |
|
"error.multiple_jnet_subjob_merge_not_implemented")); |
591 |
|
} |
592 |
|
} catch (Exception e) |
593 |
|
{ |
594 |
0 |
Console.error("JNet Client: JPred Annotation Parse Error", e); |
595 |
0 |
wsInfo.setStatus(j.getJobnum(), |
596 |
|
WebserviceInfo.STATE_STOPPED_ERROR); |
597 |
0 |
wsInfo.appendProgressText(j.getJobnum(), |
598 |
|
MessageManager.formatMessage( |
599 |
|
"info.invalid_jnet_job_result_data", |
600 |
|
new String[] |
601 |
|
{ OutputHeader.toString(), j.result.getStatus(), |
602 |
|
e.getMessage() })); |
603 |
0 |
j.result.setBroken(true); |
604 |
|
} |
605 |
|
} |
606 |
|
} |
607 |
|
|
608 |
0 |
if (res != null) |
609 |
|
{ |
610 |
0 |
if (newWindow) |
611 |
|
{ |
612 |
0 |
AlignFrame af; |
613 |
0 |
((AlignmentI) res[0]) |
614 |
|
.setSeqrep(((AlignmentI) res[0]).getSequenceAt(0)); |
615 |
0 |
if (input == null) |
616 |
|
{ |
617 |
0 |
if (res[1] != null) |
618 |
|
{ |
619 |
0 |
af = new AlignFrame((Alignment) res[0], |
620 |
|
(HiddenColumns) res[1], AlignFrame.DEFAULT_WIDTH, |
621 |
|
AlignFrame.DEFAULT_HEIGHT); |
622 |
|
} |
623 |
|
else |
624 |
|
{ |
625 |
0 |
af = new AlignFrame((Alignment) res[0], |
626 |
|
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); |
627 |
|
} |
628 |
|
} |
629 |
|
else |
630 |
|
{ |
631 |
|
|
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
|
640 |
|
|
641 |
|
|
642 |
|
|
643 |
|
|
644 |
|
|
645 |
0 |
af = new AlignFrame((Alignment) res[0], (HiddenColumns) res[1], |
646 |
|
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); |
647 |
|
} |
648 |
0 |
Desktop.addInternalFrame(af, altitle, AlignFrame.DEFAULT_WIDTH, |
649 |
|
AlignFrame.DEFAULT_HEIGHT); |
650 |
|
} |
651 |
|
else |
652 |
|
{ |
653 |
0 |
Console.info("Append results onto existing alignment."); |
654 |
|
} |
655 |
|
} |
656 |
|
} |
657 |
|
} |
658 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
659 |
0 |
@Override... |
660 |
|
public void pollJob(AWsJob job) throws Exception |
661 |
|
{ |
662 |
0 |
((JPredJob) job).result = server.getresult(job.getJobId()); |
663 |
|
} |
664 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
665 |
0 |
@Override... |
666 |
|
public boolean isCancellable() |
667 |
|
{ |
668 |
0 |
return false; |
669 |
|
} |
670 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
671 |
0 |
@Override... |
672 |
|
public void cancelJob() |
673 |
|
{ |
674 |
0 |
throw new Error(MessageManager.getString("error.implementation_error")); |
675 |
|
} |
676 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
677 |
0 |
@Override... |
678 |
|
public boolean canMergeResults() |
679 |
|
{ |
680 |
0 |
return false; |
681 |
|
} |
682 |
|
|
683 |
|
} |