Changeset 1596 for branches/ralph/src/main/java/de/ugoe
- Timestamp:
- 07/11/14 08:58:02 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
r1592 r1596 221 221 222 222 public void traceback() { 223 MatrixEntry tmp = matrix[length1+1][0] ;223 MatrixEntry tmp = matrix[length1+1][0].getPrevious(); 224 224 LinkedList<Integer> aligned1 = new LinkedList<Integer>(); 225 225 LinkedList<Integer> aligned2 = new LinkedList<Integer>(); … … 237 237 238 238 int count = 0; 239 for (Iterator<Integer> it = aligned1. descendingIterator(); it.hasNext();) {239 for (Iterator<Integer> it = aligned1.iterator(); it.hasNext();) { 240 240 count++; 241 241 reversed1[reversed1.length - count] = it.next(); … … 243 243 } 244 244 count = 0; 245 for (Iterator<Integer> it = aligned2. descendingIterator(); it.hasNext();) {245 for (Iterator<Integer> it = aligned2.iterator(); it.hasNext();) { 246 246 count++; 247 247 reversed2[reversed2.length - count] = it.next(); … … 260 260 261 261 public void printAlignment() { 262 MatrixEntry tmp = matrix[length1+1][0]; 263 String aligned1 = ""; 264 String aligned2 = ""; 265 int count = 0; 266 do 267 { 268 String append1=""; 269 String append2=""; 270 271 if(tmp.getXvalue() == Constants.GAP_SYMBOL) { 272 append1 = " ___"; 273 } 274 else if(tmp.getXvalue() == Constants.UNMATCHED_SYMBOL) { 275 append1 = " ..."; 262 int[] tmp1 = alignment.get(0).getSequence(); 263 int[] tmp2 = alignment.get(1).getSequence(); 264 for (int i=0; i< tmp1.length;i++) { 265 if(tmp1[i] == Constants.GAP_SYMBOL) { 266 System.out.print(" ___"); 267 } 268 else if(tmp1[i] == Constants.UNMATCHED_SYMBOL) { 269 System.out.print(" ..."); 276 270 } 277 271 else { 278 append1 = String.format("%5d", tmp.getXvalue()); 279 } 280 281 if(tmp.getYvalue() == Constants.GAP_SYMBOL) { 282 append2 = " ___"; 283 } 284 else if(tmp.getYvalue() == Constants.UNMATCHED_SYMBOL) { 285 append2 = " ..."; 272 System.out.format("%5d", tmp1[i]); 273 } 274 275 } 276 System.out.println(); 277 for (int i=0; i< tmp2.length;i++) { 278 if(tmp2[i] == Constants.GAP_SYMBOL) { 279 System.out.print(" ___"); 280 } 281 else if(tmp2[i] == Constants.UNMATCHED_SYMBOL) { 282 System.out.print(" ..."); 286 283 } 287 284 else { 288 append2 = String.format("%5d", tmp.getYvalue()); 289 } 290 if(count != 0) 291 { 292 aligned1 = append1 + aligned1; 293 aligned2 = append2 + aligned2; 294 } 295 296 tmp = tmp.getPrevious(); 297 count++; 298 299 } while(tmp.getPrevious() != null); 300 System.out.println(aligned1); 301 System.out.println(aligned2); 285 System.out.format("%5d", tmp2[i]); 286 } 287 288 } 289 System.out.println(); 290 291 292 302 293 } 303 294
Note: See TracChangeset
for help on using the changeset viewer.