Changeset 1568 for branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
- Timestamp:
- 06/18/14 08:59:41 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
r1559 r1568 71 71 * @return Cost of substitution of the character in str1 by the one in str2 72 72 */ 73 private floatsimilarity(int i, int j) {73 private double similarity(int i, int j) { 74 74 return submat.getDistance(input1[i - 1], input2[j - 1]); 75 75 } … … 101 101 // F(i,0) = max { F(i-1,0), F(i-1,j)-T j=1,...,m 102 102 103 floatfirstRowLeftScore = matrix[i-1][0].getScore();103 double firstRowLeftScore = matrix[i-1][0].getScore(); 104 104 //for sequences of length 1 105 floattempMax;105 double tempMax; 106 106 int maxRowIndex; 107 107 if(length2 == 1) { … … 138 138 matrix[i][0].setXvalue(input1[i-1]); 139 139 matrix[i][0].setYvalue(-2); 140 141 140 } 142 141 else { … … 147 146 148 147 for (int j = 1; j < length2; j++) { 149 floatdiagScore = matrix[i - 1][j - 1].getScore() + similarity(i, j);150 floatupScore = matrix[i][j - 1].getScore() + submat.getGapPenalty();151 floatleftScore = matrix[i - 1][j].getScore() + submat.getGapPenalty();148 double diagScore = matrix[i - 1][j - 1].getScore() + similarity(i, j); 149 double upScore = matrix[i][j - 1].getScore() + submat.getGapPenalty(); 150 double leftScore = matrix[i - 1][j].getScore() + submat.getGapPenalty(); 152 151 153 152 matrix[i][j].setScore(Math.max(diagScore,Math.max(upScore, Math.max(leftScore,matrix[i][0].getScore())))); … … 207 206 * Get the alignment score between the two input strings. 208 207 */ 209 public floatgetAlignmentScore() {208 public double getAlignmentScore() { 210 209 return matrix[length1+1][0].getScore(); 211 210 } … … 213 212 214 213 215 216 /**217 * given the bottom right corner point trace back the top left conrner. at218 * entry: i, j hold bottom right (end of Aligment coords) at return: hold219 * top left (start of Alignment coords)220 */221 214 private int[] traceback(int i, int j) { 222 215 … … 225 218 } 226 219 227 public voidtraceback() {220 public List<Match> traceback() { 228 221 MatrixEntry tmp = matrix[length1+1][0]; 229 222 String aligned1 = ""; … … 266 259 System.out.println(aligned1); 267 260 System.out.println(aligned2); 261 return null; 268 262 } 269 263
Note: See TracChangeset
for help on using the changeset viewer.