fixed tree building exception when one residue or a single column of residues is...
authorjprocter <Jim Procter>
Wed, 27 Sep 2006 14:35:43 +0000 (14:35 +0000)
committerjprocter <Jim Procter>
Wed, 27 Sep 2006 14:35:43 +0000 (14:35 +0000)
src/jalview/appletgui/AlignViewport.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java

index 0fd974b..87753f4 100755 (executable)
@@ -940,9 +940,9 @@ public class AlignViewport
       }\r
       // Final match if necessary.\r
       if (last<end)\r
-        selection.addOperation(CigarArray.M, end-last);\r
+        selection.addOperation(CigarArray.M, end-last+1);\r
     } else {\r
-      selection.addOperation(CigarArray.M, end-start);\r
+      selection.addOperation(CigarArray.M, end-start+1);\r
     }\r
     return selection;\r
   }\r
index 807b6e3..ef228df 100755 (executable)
@@ -2166,9 +2166,15 @@ public class AlignFrame
   {
     TreePanel tp;
 
-    if ( (viewport.getSelectionGroup() != null) &&
-        (viewport.getSelectionGroup().getSize(false) > 3))
-    {
+    if (viewport.getSelectionGroup() != null) {
+      if (viewport.getSelectionGroup().getSize(false) < 3) {
+        JOptionPane.showMessageDialog(Desktop.desktop,
+                                      "You need to have more than two sequences selected to build a tree!",
+                                      "Not enough sequences",
+                                      JOptionPane.WARNING_MESSAGE);
+        return;
+      }
+
       int s = 0;
       SequenceGroup sg = viewport.getSelectionGroup();
 
index 30113c3..05a52dd 100755 (executable)
@@ -1334,9 +1334,9 @@ public class AlignViewport
         }
         // Final match if necessary.
         if (last<end)
-          selection.addOperation(CigarArray.M, end-last);
+          selection.addOperation(CigarArray.M, end-last+1);
       } else {
-        selection.addOperation(CigarArray.M, end-start);
+        selection.addOperation(CigarArray.M, end-start+1);
       }
       return selection;
     }