Ignore:
Timestamp:
06/18/14 08:59:41 (10 years ago)
Author:
rkrimmel
Message:

Building distance matrix between sequences

File:
1 edited

Legend:

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

    r1559 r1568  
    7171         * @return Cost of substitution of the character in str1 by the one in str2 
    7272         */ 
    73         private float similarity(int i, int j) {  
     73        private double similarity(int i, int j) {  
    7474                return submat.getDistance(input1[i - 1], input2[j - 1]); 
    7575        } 
     
    101101                        // F(i,0) = max { F(i-1,0), F(i-1,j)-T  j=1,...,m 
    102102                         
    103                         float firstRowLeftScore = matrix[i-1][0].getScore(); 
     103                        double firstRowLeftScore = matrix[i-1][0].getScore(); 
    104104                        //for sequences of length 1 
    105                         float tempMax; 
     105                        double tempMax; 
    106106                        int maxRowIndex; 
    107107                        if(length2 == 1) { 
     
    138138                                matrix[i][0].setXvalue(input1[i-1]); 
    139139                                matrix[i][0].setYvalue(-2); 
    140                                  
    141140                        } 
    142141                        else {  
     
    147146                         
    148147                        for (int j = 1; j < length2; j++) { 
    149                                 float diagScore = matrix[i - 1][j - 1].getScore() + similarity(i, j); 
    150                                 float upScore = matrix[i][j - 1].getScore() + submat.getGapPenalty(); 
    151                                 float leftScore = 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(); 
    152151 
    153152                                matrix[i][j].setScore(Math.max(diagScore,Math.max(upScore, Math.max(leftScore,matrix[i][0].getScore())))); 
     
    207206         * Get the alignment score between the two input strings. 
    208207         */ 
    209         public float getAlignmentScore() { 
     208        public double getAlignmentScore() { 
    210209                return matrix[length1+1][0].getScore(); 
    211210        } 
     
    213212         
    214213         
    215          
    216         /** 
    217          * given the bottom right corner point trace back the top left conrner. at 
    218          * entry: i, j hold bottom right (end of Aligment coords) at return: hold 
    219          * top left (start of Alignment coords) 
    220          */ 
    221214        private int[] traceback(int i, int j) { 
    222215                 
     
    225218        } 
    226219         
    227         public void traceback() { 
     220        public List<Match> traceback() { 
    228221                MatrixEntry tmp = matrix[length1+1][0]; 
    229222                String aligned1 = ""; 
     
    266259                System.out.println(aligned1); 
    267260                System.out.println(aligned2); 
     261                return null; 
    268262        } 
    269263         
Note: See TracChangeset for help on using the changeset viewer.