Changeset 1574 for branches/ralph/src/main/java/de/ugoe/cs/autoquest
- Timestamp:
- 06/23/14 08:38:03 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
r1572 r1574 63 63 64 64 buildMatrix(); 65 traceback(); 65 66 } 66 67 … … 216 217 217 218 218 private int[] traceback(int i, int j) {219 220 221 return null;222 }223 224 225 219 public void traceback() { 226 220 MatrixEntry tmp = matrix[length1+1][0]; 227 228 int aligned1[] = new int[length1+length2]; 229 int aligned2[] = new int[length1+length2]; 221 //TODO: Why do we need such long arrays, also, add a check if we reach the limit? 222 int aligned1[] = new int[2*length1+2*length2]; 223 int aligned2[] = new int[2*length1+2*length2]; 224 System.out.println("Aligned length: " + aligned1.length); 230 225 int count = 0; 231 226 do … … 239 234 tmp = tmp.getPrevious(); 240 235 count++; 236 System.out.println(count); 241 237 242 238 } while(tmp != null); … … 246 242 int reversed2[] = new int[count]; 247 243 248 for(int i = count; count > 0; count ++) { 249 244 245 for(int i = count-1; i > 0; i--) { 246 reversed1[reversed1.length-i]= aligned1[i]; 247 reversed2[reversed2.length-i]= aligned2[i]; 250 248 } 251 249 … … 328 326 } 329 327 330 /**331 * Return a set of Matches identified in Dynamic programming matrix. A match332 * is a pair of subsequences whose score is higher than the preset333 * scoreThreshold334 **/335 public List<Match> getMatches() {336 ArrayList<Match> matchList = new ArrayList();337 int fA = 0, fB = 0;338 // skip the first row and column, find the next maxScore after339 // prevmaxScore340 for (int i = 1; i <= length1; i++) {341 for (int j = 1; j <= length2; j++) {342 if (matrix[i][j].getScore() > scoreThreshold343 && matrix[i][j].getScore() > matrix[i - 1][j - 1].getScore()344 && matrix[i][j].getScore() > matrix[i - 1][j].getScore()345 && matrix[i][j].getScore() > matrix[i][j - 1].getScore()) {346 if (i == length1 || j == length2347 || matrix[i][j].getScore() > matrix[i + 1][j + 1].getScore()) {348 // should be lesser than prev maxScore349 fA = i;350 fB = j;351 int[] f = traceback(fA, fB); // sets the x, y to352 // startAlignment353 // coordinates354 System.out.println(f[0] + " " + i + " " + f[1] + " "355 + j + " " + matrix[i][j].getScore());356 // TODO Add matches to matchList357 }358 }359 }360 }361 return matchList;362 }363 364 328 365 329 public List<NumberSequence> getAlignment() {
Note: See TracChangeset
for help on using the changeset viewer.