X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws1%2FJPredThread.java;h=86bb56f85a836ebd230f02ff4dc26b8506c946c4;hb=ee198b3ca3687f18a2ee186f4e7c7330f4ea30f0;hp=8299e3cc889709094f4e45c26da00b23f8ccf5c2;hpb=0bec4854366c4bc4608ed0d7dc1506fc6afe2285;p=jalview.git diff --git a/src/jalview/ws/jws1/JPredThread.java b/src/jalview/ws/jws1/JPredThread.java index 8299e3c..86bb56f 100644 --- a/src/jalview/ws/jws1/JPredThread.java +++ b/src/jalview/ws/jws1/JPredThread.java @@ -21,6 +21,7 @@ package jalview.ws.jws1; import jalview.analysis.AlignSeq; +import jalview.analysis.SeqsetUtils; import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; @@ -31,7 +32,12 @@ import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.WebserviceInfo; +import jalview.io.DataSourceType; +import jalview.io.FileFormatI; import jalview.io.FormatAdapter; +import jalview.io.IdentifyFile; +import jalview.io.JPredFile; +import jalview.io.JnetAnnotationMaker; import jalview.util.Comparison; import jalview.util.MessageManager; import jalview.ws.AWsJob; @@ -71,6 +77,7 @@ class JPredThread extends JWS1Thread implements WSClientI * @return true if getResultSet will return a valid alignment and prediction * result. */ + @Override public boolean hasResults() { if (subjobComplete && result != null && result.isFinished() @@ -82,6 +89,7 @@ class JPredThread extends JWS1Thread implements WSClientI return false; } + @Override public boolean hasValidInput() { if (sequence != null) @@ -110,23 +118,23 @@ class JPredThread extends JWS1Thread implements WSClientI JpredResult result = (JpredResult) this.result; - jalview.bin.Cache.log.debug("Parsing output from JNet job."); + Cache.log.debug("Parsing output from JNet job."); // JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", // "File"); - jalview.io.JPredFile prediction = new jalview.io.JPredFile( - result.getPredfile(), "Paste"); + JPredFile prediction = new JPredFile( + result.getPredfile(), DataSourceType.PASTE); SequenceI[] preds = prediction.getSeqsAsArray(); - jalview.bin.Cache.log.debug("Got prediction profile."); + Cache.log.debug("Got prediction profile."); if ((this.msa != null) && (result.getAligfile() != null)) { - jalview.bin.Cache.log.debug("Getting associated alignment."); + Cache.log.debug("Getting associated alignment."); // we ignore the returned alignment if we only predicted on a single // sequence - String format = new jalview.io.IdentifyFile().identify( - result.getAligfile(), "Paste"); + FileFormatI format = new IdentifyFile().identify( + result.getAligfile(), DataSourceType.PASTE); - if (jalview.io.FormatAdapter.isValidFormat(format)) + if (format != null) { SequenceI sqs[]; if (predMap != null) @@ -140,14 +148,14 @@ class JPredThread extends JWS1Thread implements WSClientI else { al = new FormatAdapter().readFile(result.getAligfile(), - "Paste", format); + DataSourceType.PASTE, format); sqs = new SequenceI[al.getHeight()]; for (int i = 0, j = al.getHeight(); i < j; i++) { sqs[i] = al.getSequenceAt(i); } - if (!jalview.analysis.SeqsetUtils.deuniquify(SequenceInfo, sqs)) + if (!SeqsetUtils.deuniquify(SequenceInfo, sqs)) { throw (new Exception( MessageManager @@ -164,7 +172,7 @@ class JPredThread extends JWS1Thread implements WSClientI { al.setDataset(null); } - jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, + JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, false, predMap); } @@ -172,7 +180,7 @@ class JPredThread extends JWS1Thread implements WSClientI { throw (new Exception(MessageManager.formatMessage( "exception.unknown_format_for_file", new String[] { - format, result.getAligfile() }))); + format.toString(), result.getAligfile() }))); } } else @@ -420,6 +428,7 @@ class JPredThread extends JWS1Thread implements WSClientI } } + @Override public void StartJob(AWsJob j) { if (!(j instanceof JPredJob)) @@ -502,6 +511,7 @@ class JPredThread extends JWS1Thread implements WSClientI } } + @Override public void parseResult() { int results = 0; // number of result sets received @@ -529,6 +539,7 @@ class JPredThread extends JWS1Thread implements WSClientI wsInfo.showResultsNewFrame .addActionListener(new java.awt.event.ActionListener() { + @Override public void actionPerformed(java.awt.event.ActionEvent evt) { displayResults(true); @@ -537,6 +548,7 @@ class JPredThread extends JWS1Thread implements WSClientI wsInfo.mergeResults .addActionListener(new java.awt.event.ActionListener() { + @Override public void actionPerformed(java.awt.event.ActionEvent evt) { displayResults(false); @@ -652,21 +664,25 @@ class JPredThread extends JWS1Thread implements WSClientI } } + @Override public void pollJob(AWsJob job) throws Exception { ((JPredJob) job).result = server.getresult(job.getJobId()); } + @Override public boolean isCancellable() { return false; } + @Override public void cancelJob() { throw new Error(MessageManager.getString("error.implementation_error")); } + @Override public boolean canMergeResults() { return false;