New method for helping to quickly map different aligned versions of a
authorjprocter <Jim Procter>
Wed, 6 Apr 2005 16:05:43 +0000 (16:05 +0000)
committerjprocter <Jim Procter>
Wed, 6 Apr 2005 16:05:43 +0000 (16:05 +0000)
sequence.

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

index 99f2de2..5db051a 100755 (executable)
@@ -194,6 +194,22 @@ public class Sequence implements SequenceI
     }\r
     return pos;\r
   }\r
+\r
+  public int[] gapMap() {\r
+    // Returns an int array giving the position of each residue in the sequence in the alignment\r
+    String seq = jalview.analysis.AlignSeq.extractGaps("-. ",sequence);\r
+    int[] map = new int[seq.length()];\r
+    int j=0;\r
+    int p=0;\r
+    while (j<sequence.length()) {\r
+      if (!jalview.util.Comparison.isGap(sequence.charAt(j))) {\r
+        map[p++]=j;\r
+      }\r
+      j++;\r
+    }\r
+    return map;\r
+  }\r
+\r
   public void deleteCharAt(int i)\r
   {\r
     StringBuffer sbuffer = new StringBuffer(sequence);\r
index a056a36..36afd4b 100755 (executable)
@@ -29,7 +29,7 @@ public interface SequenceI {
 \r
   public int         findIndex(int pos);\r
   public int         findPosition(int i);\r
-\r
+  public int[]         gapMap();\r
   public void       deleteChars(int i, int j);\r
   public void       deleteCharAt(int i);\r
   public void       insertCharAt(int i, char c);\r