X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws1%2FSeqSearchWSThread.java;h=0f28230f60f4b0cad3edb6b45dd0065c71def625;hb=cb8e52fbbc5f725e3f7f48c672cdddb0690bd978;hp=d920e37ea2bcad3acb246bd1f178a8b24560bb27;hpb=ab43013b7e357b84b4abade0dba949668dfb2a0e;p=jalview.git diff --git a/src/jalview/ws/jws1/SeqSearchWSThread.java b/src/jalview/ws/jws1/SeqSearchWSThread.java index d920e37..0f28230 100644 --- a/src/jalview/ws/jws1/SeqSearchWSThread.java +++ b/src/jalview/ws/jws1/SeqSearchWSThread.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) - * Copyright (C) 2014 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. * @@ -20,17 +20,27 @@ */ 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; @@ -85,7 +95,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI int nseqs = 0; if (minlen < 0) { - throw new Error(MessageManager.getString("error.implementation_error_minlen_must_be_greater_zero")); + throw new Error(MessageManager.getString( + "error.implementation_error_minlen_must_be_greater_zero")); } for (int i = 0; i < seqs.length; i++) { @@ -96,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 @@ -122,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) @@ -143,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; } @@ -161,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()) @@ -171,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; @@ -196,12 +208,12 @@ 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( + "Failed to parse the annotation file associated with the alignment."); System.err.println(">>>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( + "Failed to parse the Features file associated with the alignment."); System.err.println(">>>EOF" + inFile + "\n<< 0) { nf = new jalview.io.NewickFile(inFile, - jalview.io.AppletFormatAdapter.PASTE); + jalview.io.DataSourceType.PASTE); if (!nf.isValid()) { nf.close(); @@ -238,8 +250,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI } } catch (Exception e) { - System.err - .println("Failed to parse the treeFile associated with the alignment."); + System.err.println( + "Failed to parse the treeFile associated with the alignment."); System.err.println(">>>EOF" + inFile + "\n<<