public int [] getExactMapping()\r
{\r
// Print out the matching chars\r
- int [] mapping = new int[astr1.length()];\r
- int agap=0, bgap=0;\r
- boolean gap;\r
+ int size = s2.getLength();\r
+ int [] mapping = new int[size];\r
+ for(int i=0; i<size; i++)\r
+ mapping[i] = -1;\r
+\r
+ int pdbpos = seq2start-2;\r
+ int alignpos = seq1start-2;\r
+\r
+\r
for(int i=0; i<astr1.length(); i++)\r
{\r
- mapping[i] = -1;\r
- gap = false;\r
-\r
- if(astr1.charAt(i)=='-')\r
- {\r
- agap++;gap = true;\r
- }\r
- if(astr2.charAt(i)=='-')\r
- {\r
- bgap++;gap = true;\r
- }\r
-\r
- if(!gap && astr1.charAt(i)==astr2.charAt(i))\r
- {\r
- mapping[i-agap] = i - bgap;\r
- }\r
-\r
- System.out.println(astr1.charAt(i)+" "+i + " "+mapping[i-agap]+" "+astr2.charAt(i));\r
+ if (astr1.charAt(i) != '-')\r
+ {\r
+ alignpos++;\r
+ }\r
+\r
+ if (astr2.charAt(i) != '-')\r
+ {\r
+ pdbpos++;\r
+ }\r
+\r
+ if (astr1.charAt(i) == astr2.charAt(i))\r
+ {\r
+ mapping[pdbpos] = alignpos;\r
+ }\r
}\r
\r
+ /* for(int i=0; i<mapping.length; i++)\r
+ {\r
+ if(mapping[i]!=-1)\r
+ System.out.println(i+" "+s2.getCharAt(i) + " " + mapping[i] + " " +\r
+ s1.findIndex(mapping[i])+" "+\r
+ s1.getCharAt(s1.findIndex(mapping[i])-1));\r
+ else\r
+ System.out.println(i+" "+"XX"+s2.getCharAt(i));\r
+ }*/\r
+\r
return mapping;\r
}\r
\r