X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FMsaWSThread.java;h=0dedce2f7b64f72d7b932ff49adb4dba37fcd505;hb=7e1a8203d671e11bdc3eedf19c808f30f7a7c348;hp=2946ba88a4915b94236cdf44f7c015b97a488dec;hpb=4822456539ebf9fe5a5b0fb2728f52465418e4fc;p=jalview.git diff --git a/src/jalview/ws/MsaWSThread.java b/src/jalview/ws/MsaWSThread.java index 2946ba8..0dedce2 100644 --- a/src/jalview/ws/MsaWSThread.java +++ b/src/jalview/ws/MsaWSThread.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,7 +24,6 @@ import jalview.analysis.*; import jalview.bin.*; import jalview.datamodel.*; import jalview.datamodel.Alignment; -import jalview.datamodel.Sequence; import jalview.gui.*; import vamsas.objects.simple.MsaResult; @@ -59,7 +58,8 @@ class MsaWSThread // order - class MsaWSJob extends WSThread.WSJob + class MsaWSJob + extends WSThread.WSJob { // hold special input for this vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple. @@ -127,20 +127,20 @@ class MsaWSThread { seqarray[n] = new vamsas.objects.simple.Sequence(); seqarray[n].setId(newname); - seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequence() + seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString() : AlignSeq.extractGaps( jalview.util.Comparison.GapChars, seqs[i] - .getSequence())); + .getSequenceAsString())); } else { String empty = null; if (seqs[i].getEnd() >= seqs[i].getStart()) { - empty = (submitGaps) ? seqs[i].getSequence() + empty = (submitGaps) ? seqs[i].getSequenceAsString() : AlignSeq.extractGaps( jalview.util.Comparison.GapChars, seqs[i] - .getSequence()); + .getSequenceAsString()); } emptySeqs.add(new String[] {newname, empty}); @@ -158,7 +158,8 @@ class MsaWSThread public boolean hasResults() { if (subjobComplete && result != null && result.isFinished() - && ((MsaResult) result).getMsa() != null && ((MsaResult) result).getMsa().getSeqs() != null) + && ( (MsaResult) result).getMsa() != null && + ( (MsaResult) result).getMsa().getSeqs() != null) { return true; } @@ -173,10 +174,10 @@ class MsaWSThread SequenceI[] alseqs = null; char alseq_gapchar = '-'; int alseq_l = 0; - if (((MsaResult) result).getMsa() != null) + if ( ( (MsaResult) result).getMsa() != null) { - alseqs = getVamsasAlignment(((MsaResult) result).getMsa()); - alseq_gapchar = ((MsaResult) result).getMsa().getGapchar().charAt(0); + alseqs = getVamsasAlignment( ( (MsaResult) result).getMsa()); + alseq_gapchar = ( (MsaResult) result).getMsa().getGapchar().charAt(0); alseq_l = alseqs.length; } if (emptySeqs.size() > 0) @@ -224,7 +225,7 @@ class MsaWSThread if (nw > sw) { // pad at end - alseqs[i].setSequence(t_alseqs[i].getSequence() + + alseqs[i].setSequence(t_alseqs[i].getSequenceAsString() + insbuff.substring(0, sw - nw)); } } @@ -267,26 +268,31 @@ class MsaWSThread } return null; } + /** * mark subjob as cancelled and set result object appropriatly */ - void cancel() { - cancelled=true; + void cancel() + { + cancelled = true; subjobComplete = true; result = null; } + /** * * @return boolean true if job can be submitted. */ - boolean hasValidInput() { - if (seqs.getSeqs()!=null) + boolean hasValidInput() + { + if (seqs.getSeqs() != null) + { return true; + } return false; } } - String alTitle; // name which will be used to form new alignment window. Alignment dataset; // dataset to which the new alignment will be @@ -306,14 +312,10 @@ class MsaWSThread AlignmentView alview, String wsname, boolean subgaps, boolean presorder) { + super(alFrame, wsinfo, alview, wsname, wsUrl); this.server = server; - this.WsUrl = wsUrl; - this.wsInfo = wsinfo; - this.WebServiceName = wsname; - this.input = alview; this.submitGaps = subgaps; this.preserveOrder = presorder; - this.alignFrame = alFrame; } /** @@ -339,6 +341,7 @@ class MsaWSThread OutputHeader = wsInfo.getProgressText(); alTitle = title; dataset = seqset; + SequenceI[][] conmsa = _msa.getVisibleContigs('-'); if (conmsa != null) { @@ -355,11 +358,14 @@ class MsaWSThread jobs[j] = new MsaWSJob(0, conmsa[j]); } if (njobs > 0) + { wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); + } wsinfo.setProgressText(jobs[j].jobnum, OutputHeader); } } } + public boolean isCancellable() { return true; @@ -383,7 +389,7 @@ class MsaWSThread { // CANCELLED_JOB cancelledMessage = "Job cancelled."; - ((MsaWSJob) jobs[job]).cancel(); + ( (MsaWSJob) jobs[job]).cancel(); wsInfo.setStatus(jobs[job].jobnum, WebserviceInfo.STATE_CANCELLED_OK); } @@ -409,7 +415,8 @@ class MsaWSThread cancelledMessage += ("\nProblems cancelling the job : Exception received...\n" + exc + "\n"); - Cache.log.warn("Exception whilst cancelling "+jobs[job].jobId,exc); + Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId, + exc); } wsInfo.setProgressText(jobs[job].jobnum, OutputHeader + cancelledMessage + "\n"); @@ -432,13 +439,19 @@ class MsaWSThread } } } - void pollJob(WSJob job) throws Exception { - ((MsaWSJob) job).result = server.getResult(((MsaWSJob) job).jobId); + + void pollJob(WSJob job) + throws Exception + { + ( (MsaWSJob) job).result = server.getResult( ( (MsaWSJob) job).jobId); } + void StartJob(WSJob job) { - if (!(job instanceof MsaWSJob)) { - throw new Error("StartJob(MsaWSJob) called on a WSJobInstance "+job.getClass()); + if (! (job instanceof MsaWSJob)) + { + throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " + + job.getClass()); } MsaWSJob j = (MsaWSJob) job; if (j.submitted) @@ -456,7 +469,7 @@ class MsaWSThread j.result = new MsaResult(); j.result.setFinished(true); j.result.setStatus("Empty Alignment Job"); - ((MsaResult) j.result).setMsa(null); + ( (MsaResult) j.result).setMsa(null); } try { @@ -534,7 +547,8 @@ class MsaWSThread if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults()) { results++; - vamsas.objects.simple.Alignment valign = ((MsaResult) jobs[j].result).getMsa(); + vamsas.objects.simple.Alignment valign = ( (MsaResult) jobs[j].result). + getMsa(); if (valign != null) { wsInfo.appendProgressText(jobs[j].jobnum, @@ -579,49 +593,59 @@ class MsaWSThread } }); wsInfo.setResultsReady(); - } else + } + else + { wsInfo.setFinishedNoResults(); + } } void displayResults(boolean newFrame) { // view input or result data for each block Vector alorders = new Vector(); - SequenceI[][] results=new SequenceI[jobs.length][]; + SequenceI[][] results = new SequenceI[jobs.length][]; AlignmentOrder[] orders = new AlignmentOrder[jobs.length]; - SequenceI[] first=null; - for (int j=0; j>>This is a fix for the moment, until a better solution is // found!!<<< @@ -643,7 +667,7 @@ class MsaWSThread { String orderName = new String(" Region " + i); int j = i + 1; - int r = l; + while (j < l) { if ( ( (AlignmentOrder) alorders.get(i)).equals( ( ( @@ -671,7 +695,7 @@ class MsaWSThread for (int i = 0, l = alorders.size(); i < l; i++) { af.addSortByOrderMenuItem(WebServiceName - +( (String) names.get(i)) + + + ( (String) names.get(i)) + " Ordering", (AlignmentOrder) alorders.get(i)); } @@ -690,6 +714,7 @@ class MsaWSThread } } + public boolean canMergeResults() { return false;