fixed off by one bug in end sequence from getSubSequence and added new
authorjprocter <Jim Procter>
Mon, 14 Aug 2006 12:50:35 +0000 (12:50 +0000)
committerjprocter <Jim Procter>
Mon, 14 Aug 2006 12:50:35 +0000 (12:50 +0000)
subSequence method (not properly tested yet).

src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceI.java

index dee67d3..0225c88 100755 (executable)
@@ -351,7 +351,7 @@ public class Sequence implements SequenceI
       if (seq=="")
         return null;
       int nstart = findPosition(start);
-      int nend=findPosition(end-1)-1;
+      int nend=findPosition(end)-1;
       // JBPNote - this is an incomplete copy.
       SequenceI nseq = new Sequence(this.getName(), seq, nstart, nend);
       nseq.setDatasetSequence(getDatasetSequence());
@@ -710,4 +710,12 @@ public class Sequence implements SequenceI
      sequence = newSeq.toString();
     }
 
+  public SequenceI getSubSequence(int start)
+  {
+    int e=getLength();
+    if (start>=e)
+      return null;
+    return getSubSequence(start, getLength());
+  }
+
 }
index d711788..0842d94 100755 (executable)
  */\r
 package jalview.datamodel;\r
 \r
-import java.awt.*;\r
-\r
 import java.util.*;\r
 \r
+import java.awt.*;\r
+\r
 \r
 /**\r
  * DOCUMENT ME!\r
@@ -264,4 +264,11 @@ public interface SequenceI
 \r
     public void toggleCase(int start, int end);\r
 \r
+  /**\r
+   * getSubSequence from start to end of sequence\r
+   * @param start first residue in subSequence\r
+   * @return SequenceI\r
+   */\r
+  public SequenceI getSubSequence(int start);\r
+\r
 }\r