if endRes <1, calc the endRes
authoramwaterhouse <Andrew Waterhouse>
Fri, 29 Jul 2005 09:48:19 +0000 (09:48 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 29 Jul 2005 09:48:19 +0000 (09:48 +0000)
src/jalview/datamodel/Sequence.java

index 34c1cd9..824a33b 100755 (executable)
@@ -18,8 +18,6 @@
 */\r
 package jalview.datamodel;\r
 \r
-import MCview.*;\r
-\r
 import jalview.analysis.*;\r
 \r
 import java.awt.*;\r
@@ -57,10 +55,30 @@ public class Sequence implements SequenceI
      */\r
     public Sequence(String name, String sequence, int start, int end)\r
     {\r
-        this.name = name;\r
-        this.sequence = sequence;\r
-        this.start = start;\r
-        this.end = end;\r
+      this.name = name;\r
+      this.sequence = sequence;\r
+      this.start = start;\r
+      this.end = end;\r
+\r
+      if (end < 1)\r
+      {\r
+        int endRes = 0;\r
+        char ch;\r
+        for (int j = 0; j < sequence.length(); j++)\r
+        {\r
+          ch = sequence.charAt(j);\r
+          if (!jalview.util.Comparison.isGap( (ch)))\r
+          {\r
+            endRes++;\r
+          }\r
+        }\r
+        if (endRes > 0)\r
+        {\r
+          endRes += start - 1;\r
+        }\r
+\r
+        this.end = endRes;\r
+      }\r
 \r
         setDisplayId();\r
     }\r