X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws1%2FJPredThread.java;h=b0210d8668cb175282c6dc803d68ada1438c3458;hb=4decc3e365ce990f54773d24bb9583df48d2797a;hp=79c39b4372b04039c097681e4faff8e2b09e4e43;hpb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;p=jalview.git diff --git a/src/jalview/ws/jws1/JPredThread.java b/src/jalview/ws/jws1/JPredThread.java index 79c39b4..b0210d8 100644 --- a/src/jalview/ws/jws1/JPredThread.java +++ b/src/jalview/ws/jws1/JPredThread.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) - * Copyright (C) 2015 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -21,17 +21,24 @@ package jalview.ws.jws1; import jalview.analysis.AlignSeq; +import jalview.analysis.SeqsetUtils; import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; -import jalview.datamodel.ColumnSelection; +import jalview.datamodel.HiddenColumns; 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.io.PileUpfile; import jalview.util.Comparison; import jalview.util.MessageManager; import jalview.ws.AWsJob; @@ -71,6 +78,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 +90,7 @@ class JPredThread extends JWS1Thread implements WSClientI return false; } + @Override public boolean hasValidInput() { if (sequence != null) @@ -105,49 +114,49 @@ class JPredThread extends JWS1Thread implements WSClientI return null; } AlignmentI al = null; - ColumnSelection alcsel = null; + HiddenColumns alhidden = null; int FirstSeq = -1; // the position of the query sequence in Alignment al 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) { Object[] alandcolsel = input - .getAlignmentAndColumnSelection(getGapChar()); + .getAlignmentAndHiddenColumns(getGapChar()); sqs = (SequenceI[]) alandcolsel[0]; al = new Alignment(sqs); - alcsel = (ColumnSelection) alandcolsel[1]; + alhidden = (HiddenColumns) alandcolsel[1]; } 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,15 +173,15 @@ class JPredThread extends JWS1Thread implements WSClientI { al.setDataset(null); } - jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, + JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, false, predMap); } else { throw (new Exception(MessageManager.formatMessage( - "exception.unknown_format_for_file", new String[] { - format, result.getAligfile() }))); + "exception.unknown_format_for_file", new String[] { "", + result.getAligfile() }))); } } else @@ -183,7 +192,7 @@ class JPredThread extends JWS1Thread implements WSClientI { char gc = getGapChar(); SequenceI[] sqs = (SequenceI[]) input - .getAlignmentAndColumnSelection(gc)[0]; + .getAlignmentAndHiddenColumns(gc)[0]; if (this.msaIndex >= sqs.length) { throw new Error( @@ -228,7 +237,7 @@ class JPredThread extends JWS1Thread implements WSClientI { // Adjust input view for gaps // propagate insertions into profile - alcsel = ColumnSelection.propagateInsertions(profileseq, al, + alhidden = HiddenColumns.propagateInsertions(profileseq, al, input); } } @@ -243,7 +252,7 @@ class JPredThread extends JWS1Thread implements WSClientI alant.sequenceRef); } } - return new Object[] { al, alcsel }; // , FirstSeq, noMsa}; + return new Object[] { al, alhidden }; // , FirstSeq, noMsa}; } /** @@ -355,8 +364,8 @@ class JPredThread extends JWS1Thread implements WSClientI if (msf.length > 1) { msa = new vamsas.objects.simple.Msfalignment(); - jalview.io.PileUpfile pileup = new jalview.io.PileUpfile(); - msa.setMsf(pileup.print(msf)); + PileUpfile pileup = new PileUpfile(); + msa.setMsf(pileup.print(msf, true)); } } } @@ -420,6 +429,7 @@ class JPredThread extends JWS1Thread implements WSClientI } } + @Override public void StartJob(AWsJob j) { if (!(j instanceof JPredJob)) @@ -502,6 +512,7 @@ class JPredThread extends JWS1Thread implements WSClientI } } + @Override public void parseResult() { int results = 0; // number of result sets received @@ -529,6 +540,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 +549,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); @@ -612,7 +625,7 @@ class JPredThread extends JWS1Thread implements WSClientI if (res[1] != null) { af = new AlignFrame((Alignment) res[0], - (ColumnSelection) res[1], AlignFrame.DEFAULT_WIDTH, + (HiddenColumns) res[1], AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } else @@ -638,7 +651,8 @@ class JPredThread extends JWS1Thread implements WSClientI */ af = new AlignFrame((Alignment) res[0], - (ColumnSelection) res[1], AlignFrame.DEFAULT_WIDTH, + (HiddenColumns) res[1], + AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } Desktop.addInternalFrame(af, altitle, AlignFrame.DEFAULT_WIDTH, @@ -652,21 +666,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;