X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws2%2FMsaWSClient.java;h=5fe3e74e2c59f99dd0b6369ebb957e484d8db0fb;hb=e2d6753e8cf3c5eaf8bccf34f4f5e9d651e9cb8e;hp=c3661c3724d2b5e631a9beb5bfdf0d7929f0f4e3;hpb=02a721469b0aa9d336db4e3b243250ba0eb9d372;p=jalview.git diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index c3661c3..5fe3e74 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * 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. * @@ -22,7 +22,6 @@ package jalview.ws.jws2; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentView; -import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; @@ -175,47 +174,20 @@ public class MsaWSClient extends Jws2Client MsaWSThread msathread = new MsaWSThread(server, preset, paramset, WsURL, wsInfo, alignFrame, WebServiceName, jobtitle, msa, submitGaps, preserveOrder, seqdataset); - wsInfo.setthisService(msathread); - - msathread.start(); - - } - - private boolean isValidAlignment(AlignmentView av) - { - int validSeqCount = 0; - List seqs = av.getVisibleAlignment('c').getSequences(); // .getSequences(); - if (seqs.size() < 2) + if (msathread.hasValidInput()) { - JOptionPane - .showMessageDialog( - alignFrame, - "A minimum of two sequences is required to perform this operation", - "Invalid selection", JOptionPane.INFORMATION_MESSAGE); - - return false; + wsInfo.setthisService(msathread); + wsInfo.setVisible(true); + msathread.start(); } - - for (SequenceI seq : seqs) + else { - - if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){3}[a-zA-Z-]*")) - { - ++validSeqCount; - } - if (validSeqCount > 1) - { - return true; - } + JOptionPane.showMessageDialog(alignFrame, + MessageManager.getString("info.invalid_msa_input_mininfo"), + MessageManager.getString("info.invalid_msa_notenough"), + JOptionPane.INFORMATION_MESSAGE); + wsInfo.setVisible(false); } - - JOptionPane - .showMessageDialog( - alignFrame, - "A minimum of two sequences with at least three non-gap character \nis required to perform this operation", - "Invalid selection", JOptionPane.INFORMATION_MESSAGE); - - return false; } public static void main(String[] args) @@ -300,7 +272,7 @@ public class MsaWSClient extends Jws2Client { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); - if (isValidAlignment(msa)) + if (msa != null) { new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps, true, alignFrame.getViewport().getAlignment() @@ -324,10 +296,9 @@ public class MsaWSClient extends Jws2Client public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); - - if (isValidAlignment(msa)) + if (msa != null) { - new MsaWSClient(service, null, null, true, alignFrame + new MsaWSClient(service, null, null, true, alignFrame .getTitle(), msa, withGaps, true, alignFrame .getViewport().getAlignment().getDataset(), alignFrame); } @@ -382,9 +353,10 @@ public class MsaWSClient extends Jws2Client AlignmentView msa = alignFrame .gatherSequencesForAlignment(); - if (isValidAlignment(msa)) + if (msa != null) { - new MsaWSClient(service, preset, alignFrame.getTitle(), + MsaWSClient msac = new MsaWSClient(service, preset, + alignFrame.getTitle(), msa, false, true, alignFrame.getViewport() .getAlignment().getDataset(), alignFrame); }