public static Last [ ] setScorePoint ( int x , int y , int gop , int gep , int sub , int [ ] [ ] [ ] scores ) { Last [ ] pointers = new Last [ 3 ] ; // substitution if ( scores [ x - 1 ] [ y - 1 ] [ 1 ] >= scores [ x - 1 ] [ y - 1 ] [ 0 ] && scores [ x - 1 ] [ y - 1 ] [ 1 ] >= scores [ x - 1 ] [ y - 1 ] [ 2 ] ) { scores [ x ] [ y ] [ 0 ] = scores [ x - 1 ] [ y - 1 ] [ 1 ] + sub ; pointers [ 0 ] = Last . DELETION ; } else if ( scores [ x - 1 ] [ y - 1 ] [ 0 ] >= scores [ x - 1 ] [ y - 1 ] [ 2 ] ) { scores [ x ] [ y ] [ 0 ] = scores [ x - 1 ] [ y - 1 ] [ 0 ] + sub ; pointers [ 0 ] = Last . SUBSTITUTION ; } else { scores [ x ] [ y ] [ 0 ] = scores [ x - 1 ] [ y - 1 ] [ 2 ] + sub ; pointers [ 0 ] = Last . INSERTION ; } // deletion if ( scores [ x - 1 ] [ y ] [ 1 ] >= scores [ x - 1 ] [ y ] [ 0 ] + gop ) { scores [ x ] [ y ] [ 1 ] = scores [ x - 1 ] [ y ] [ 1 ] + gep ; pointers [ 1 ] = Last . DELETION ; } else { scores [ x ] [ y ] [ 1 ] = scores [ x - 1 ] [ y ] [ 0 ] + gop + gep ; pointers [ 1 ] = Last . SUBSTITUTION ; } // insertion if ( scores [ x ] [ y - 1 ] [ 0 ] + gop >= scores [ x ] [ y - 1 ] [ 2 ] ) { scores [ x ] [ y ] [ 2 ] = scores [ x ] [ y - 1 ] [ 0 ] + gop + gep ; pointers [ 2 ] = Last . SUBSTITUTION ; } else { scores [ x ] [ y ] [ 2 ] = scores [ x ] [ y - 1 ] [ 2 ] + gep ; pointers [ 2 ] = Last . INSERTION ; } return pointers ; }
Calculate the optimal alignment score for the given sequence positions with an affine or constant gap penalty