JAL-1604 Entire sequence submision for MSA job bugfix
[jalview.git] / src / jalview / ws / jws2 / MsaWSClient.java
index d9452a3..39be454 100644 (file)
@@ -199,8 +199,7 @@ public class MsaWSClient extends Jws2Client
     for (SequenceI seq : seqs)
     {
 
-      if (seq.getSequenceAsString().matches(
-              "([(a-zA-Z?)(-?)(.?)]+)?[a-zA-Z]([(a-zA-Z?)(-?)(.?)]+)?"))
+      if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){3}[a-zA-Z-]*"))
       {
         ++validSeqCount;
       }
@@ -213,7 +212,7 @@ public class MsaWSClient extends Jws2Client
     JOptionPane
             .showMessageDialog(
                     alignFrame,
-                    "A minimum of two sequences with at least one non-gap character \nin each sequence is required to perform this operation",
+                    "All selected sequence for this job must have a  minimum of \nthree non-gap character to perform this operation",
                     "Invalid selection", JOptionPane.INFORMATION_MESSAGE);
 
     return false;
@@ -221,9 +220,7 @@ public class MsaWSClient extends Jws2Client
 
   public static void main(String[] args)
   {
-    System.out
-            .println("A"
-                    .matches("([(a-zA-Z?)(-?)(.?)]+)?[a-zA-Z]([(a-zA-Z?)(-?)(.?)]+)?"));
+    System.out.println("A".matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*"));
   }
 
 
@@ -303,7 +300,7 @@ public class MsaWSClient extends Jws2Client
         {
           AlignmentView msa = alignFrame.gatherSequencesForAlignment();
 
-          if (isValidAlignment(msa))
+          if (msa != null && isValidAlignment(msa))
           {
           new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps,
                   true, alignFrame.getViewport().getAlignment()
@@ -328,7 +325,7 @@ public class MsaWSClient extends Jws2Client
           {
             AlignmentView msa = alignFrame.gatherSequencesForAlignment();
 
-            if (isValidAlignment(msa))
+            if (msa != null && isValidAlignment(msa))
             {
             new MsaWSClient(service, null, null, true, alignFrame
                     .getTitle(), msa, withGaps, true, alignFrame
@@ -385,7 +382,7 @@ public class MsaWSClient extends Jws2Client
                 AlignmentView msa = alignFrame
                         .gatherSequencesForAlignment();
 
-                if (isValidAlignment(msa))
+                if (msa != null && isValidAlignment(msa))
                 {
                 new MsaWSClient(service, preset, alignFrame.getTitle(),
                         msa, false, true, alignFrame.getViewport()