Ignore:
Timestamp:
06/25/14 19:21:42 (10 years ago)
Author:
rkrimmel
Message:

Added Constants for the gap and unmatched symbol

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java

    r1575 r1578  
    22 
    33import java.util.ArrayList; 
    4 import java.util.Iterator; 
    5 import java.util.LinkedList; 
    64import java.util.List; 
    75import java.util.logging.Level; 
    86 
    97import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 
     8import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants; 
    109import de.ugoe.cs.util.console.Console; 
    1110 
     
    7978         */ 
    8079        private double similarity(int i, int j) {  
    81                 return submat.getDistance(input1[i - 1], input2[j - 1]); 
     80                return submat.getScore(input1[i - 1], input2[j - 1]); 
    8281        } 
    8382 
     
    129128 
    130129                        } 
    131                          
    132130                                         
    133131                        tempMax -= scoreThreshold; 
     
    145143                        { 
    146144                                matrix[i][0].setXvalue(input1[i-1]); 
    147                                 matrix[i][0].setYvalue(-2); 
     145                                matrix[i][0].setYvalue(Constants.UNMATCHED_SYMBOL); 
    148146                        } 
    149147                        else {  
     
    161159 
    162160                                // find the directions that give the maximum scores. 
    163                                 // Multiple directions are ignored TODO 
     161                                // TODO: Multiple directions are ignored, we choose the first maximum score  
    164162                                //True if we had a match 
    165163                                if (diagScore == matrix[i][j].getScore()) { 
     
    171169                                if (leftScore == matrix[i][j].getScore()) { 
    172170                                        matrix[i][j].setXvalue(input1[i-1]); 
    173                                         matrix[i][j].setYvalue(-1); 
     171                                        matrix[i][j].setYvalue(Constants.GAP_SYMBOL); 
    174172                                        matrix[i][j].setPrevious(matrix[i-1][j]); 
    175173                                } 
    176174                                //true if we took an event from sequence y and not from x 
    177175                                if (upScore == matrix[i][j].getScore()) { 
    178                                         matrix[i][j].setXvalue(-1); 
     176                                        matrix[i][j].setXvalue(Constants.GAP_SYMBOL); 
    179177                                        matrix[i][j].setYvalue(input2[j-1]); 
    180178                                        matrix[i][j].setPrevious(matrix[i][j-1]); 
     
    184182                                        matrix[i][j].setPrevious(matrix[i][0]); 
    185183                                        matrix[i][j].setXvalue(input1[i-1]); 
    186                                         matrix[i][j].setYvalue(-2); 
     184                                        matrix[i][j].setYvalue(Constants.UNMATCHED_SYMBOL); 
    187185                                } 
    188186                        } 
     
    271269                        String append2=""; 
    272270                                         
    273                         if(tmp.getXvalue() == -1) { 
     271                        if(tmp.getXvalue() == Constants.GAP_SYMBOL) { 
    274272                                append1 = "  ___"; 
    275273                        } 
    276                         else if(tmp.getXvalue() == -2) { 
     274                        else if(tmp.getXvalue() == Constants.UNMATCHED_SYMBOL) { 
    277275                                append1 = "  ..."; 
    278276                        } 
     
    281279                        } 
    282280 
    283                         if(tmp.getYvalue() == -1) { 
     281                        if(tmp.getYvalue() == Constants.GAP_SYMBOL) { 
    284282                                append2 = "  ___"; 
    285283                        } 
    286                         else if(tmp.getYvalue() == -2) { 
     284                        else if(tmp.getYvalue() == Constants.UNMATCHED_SYMBOL) { 
    287285                                append2 = "  ..."; 
    288286                        } 
Note: See TracChangeset for help on using the changeset viewer.