X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws1%2FSeqSearchWSThread.java;h=dd734c809f2d9c3e09affbcf514f668b1bdbf581;hb=bc1a3842b31a35a7794f4afec4911ad421c7c3e4;hp=aeefcd1b12406585a79a6806478b3822420c5072;hpb=a45774ee31d9f35d4eff46d54d7deab719afb092;p=jalview.git
diff --git a/src/jalview/ws/jws1/SeqSearchWSThread.java b/src/jalview/ws/jws1/SeqSearchWSThread.java
index aeefcd1..dd734c8 100644
--- a/src/jalview/ws/jws1/SeqSearchWSThread.java
+++ b/src/jalview/ws/jws1/SeqSearchWSThread.java
@@ -1,32 +1,46 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
-import java.util.*;
-
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
+import jalview.analysis.AlignSeq;
+import jalview.api.FeatureColourI;
+import jalview.bin.Console;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.WebserviceInfo;
import jalview.io.NewickFile;
+import jalview.util.MessageManager;
import jalview.ws.AWsJob;
import jalview.ws.JobStateSummary;
import jalview.ws.WSClientI;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Vector;
+
import vamsas.objects.simple.MsaResult;
import vamsas.objects.simple.SeqSearchResult;
@@ -58,7 +72,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
subjobComplete = true;
result = new MsaResult();
result.setFinished(true);
- result.setStatus("Job never ran - input returned to user.");
+ result.setStatus(MessageManager.getString("label.job_never_ran"));
}
}
@@ -81,8 +95,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
int nseqs = 0;
if (minlen < 0)
{
- throw new Error(
- "Implementation error: minlen must be zero or more.");
+ throw new Error(MessageManager.getString(
+ "error.implementation_error_minlen_must_be_greater_zero"));
}
for (int i = 0; i < seqs.length; i++)
{
@@ -93,7 +107,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
}
boolean valid = nseqs >= 1; // need at least one sequence for valid input
// TODO: generalise
- vamsas.objects.simple.Sequence[] seqarray = (valid) ? new vamsas.objects.simple.Sequence[nseqs]
+ vamsas.objects.simple.Sequence[] seqarray = (valid)
+ ? new vamsas.objects.simple.Sequence[nseqs]
: null;
boolean submitGaps = (nseqs == 1) ? false : true; // profile is submitted
// with gaps
@@ -119,12 +134,11 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
String empty = null;
if (seqs[i].getEnd() >= seqs[i].getStart())
{
- empty = (submitGaps) ? seqs[i].getSequenceAsString() : AlignSeq
- .extractGaps(jalview.util.Comparison.GapChars,
+ empty = (submitGaps) ? seqs[i].getSequenceAsString()
+ : AlignSeq.extractGaps(jalview.util.Comparison.GapChars,
seqs[i].getSequenceAsString());
}
- emptySeqs.add(new String[]
- { newname, empty });
+ emptySeqs.add(new String[] { newname, empty });
}
}
if (submitGaps)
@@ -140,13 +154,13 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
*
* @return true if getAlignment will return a valid alignment result.
*/
+ @Override
public boolean hasResults()
{
- if (subjobComplete
- && result != null
- && result.isFinished()
+ if (subjobComplete && result != null && result.isFinished()
&& ((SeqSearchResult) result).getAlignment() != null
- && ((SeqSearchResult) result).getAlignment().getSeqs() != null)
+ && ((SeqSearchResult) result).getAlignment()
+ .getSeqs() != null)
{
return true;
}
@@ -158,7 +172,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
*
* @return null or { Alignment(+features and annotation), NewickFile)}
*/
- public Object[] getAlignment(Alignment dataset, Hashtable featureColours)
+ public Object[] getAlignment(AlignmentI dataset,
+ Map featureColours)
{
if (result != null && result.isFinished())
@@ -168,8 +183,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
// int alseq_l = 0;
if (((SeqSearchResult) result).getAlignment() != null)
{
- alseqs = getVamsasAlignment(((SeqSearchResult) result)
- .getAlignment());
+ alseqs = getVamsasAlignment(
+ ((SeqSearchResult) result).getAlignment());
// alseq_gapchar = ( (SeqSearchResult)
// result).getAlignment().getGapchar().charAt(0);
// alseq_l = alseqs.length;
@@ -193,13 +208,13 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
if (inFile != null && inFile.length() > 0)
{
new jalview.io.AnnotationFile().readAnnotationFile(al, inFile,
- jalview.io.AppletFormatAdapter.PASTE);
+ jalview.io.DataSourceType.PASTE);
}
} catch (Exception e)
{
- System.err
- .println("Failed to parse the annotation file associated with the alignment.");
- System.err.println(">>>EOF" + inFile + "\n<<>>EOF" + inFile + "\n<< 0)
{
- jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(
- inFile, jalview.io.AppletFormatAdapter.PASTE);
+ jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(inFile,
+ jalview.io.DataSourceType.PASTE);
ff.parse(al, featureColours, false);
}
} catch (Exception e)
{
- System.err
- .println("Failed to parse the Features file associated with the alignment.");
- System.err.println(">>>EOF" + inFile + "\n<<>>EOF" + inFile + "\n<< 0)
{
nf = new jalview.io.NewickFile(inFile,
- jalview.io.AppletFormatAdapter.PASTE);
+ jalview.io.DataSourceType.PASTE);
if (!nf.isValid())
{
nf.close();
@@ -235,9 +250,9 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
}
} catch (Exception e)
{
- System.err
- .println("Failed to parse the treeFile associated with the alignment.");
- System.err.println(">>>EOF" + inFile + "\n<<>>EOF" + inFile + "\n<< 0)
@@ -570,6 +589,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
wsInfo.showResultsNewFrame
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(java.awt.event.ActionEvent evt)
{
displayResults(true);
@@ -578,6 +598,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
wsInfo.mergeResults
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(java.awt.event.ActionEvent evt)
{
displayResults(false);
@@ -595,7 +616,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
{
if (!newFrame)
{
- System.err.println("MERGE WITH OLD FRAME NOT IMPLEMENTED");
+ jalview.bin.Console
+ .errPrintln("MERGE WITH OLD FRAME NOT IMPLEMENTED");
return;
}
// each subjob is an independent alignment for the moment
@@ -603,7 +625,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
// NewickFile nf[] = new NewickFile[jobs.length];
for (int j = 0; j < jobs.length; j++)
{
- Hashtable featureColours = new Hashtable();
+ Map featureColours = new HashMap();
Alignment al = null;
NewickFile nf = null;
if (jobs[j].hasResults())
@@ -641,11 +663,13 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
* propagateDatasetMappings(al); }
*/
- AlignFrame af = new AlignFrame(al,// columnselection,
+ AlignFrame af = new AlignFrame(al, // columnselection,
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
if (nf != null)
{
- af.ShowNewickTree(nf, "Tree from " + this.alTitle);
+ af.showNewickTree(nf,
+ MessageManager.formatMessage("label.tree_from", new String[]
+ { this.alTitle }));
}
// initialise with same renderer settings as in parent alignframe.
af.getFeatureRenderer().transferSettings(this.featureSettings);
@@ -654,6 +678,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
}
}
+ @Override
public boolean canMergeResults()
{
return false;