-
- seqA = ' ' + A; lA = seqA.length(); // the algorithm requires that the first character be a dummy value
- seqB = ' ' + B; lB = seqB.length(); // the algorithm requires that the first character be a dummy value
-
- for(int i=1;i<lB;i++){ // the recursion here is shown in Webb and Miller, Fig. 1A. Note that
- for(int j=1;j<lA;j++){ // if we need to conserve on space we should see Fig. 1B, which is linear
- // in space, which I think is unnecessary
- float diagonal;
- if(seqB[i] == seqA[j]) { diagonal = alignment[i-1][j-1].cValue + match; }
- else { diagonal = alignment[i-1][j-1].cValue + mismatch; }
-
- alignment[i][j].iValue = max(alignment[i][j-1].iValue, alignment[i][j-1].cValue + gapOpen) + gapExtend;
- alignment[i][j].dValue = max(alignment[i-1][j].dValue, alignment[i-1][j].cValue + gapOpen) + gapExtend;
-
- if(alignment[i][j].iValue > alignment[i][j].dValue){
- if(alignment[i][j].iValue > diagonal){
- alignment[i][j].cValue = alignment[i][j].iValue;
- alignment[i][j].prevCell = 'l';
+ try {
+ seqA = ' ' + A; lA = seqA.length(); // the algorithm requires that the first character be a dummy value
+ seqB = ' ' + B; lB = seqB.length(); // the algorithm requires that the first character be a dummy value
+
+ for(int i=1;i<lB;i++){ // the recursion here is shown in Webb and Miller, Fig. 1A. Note that
+ for(int j=1;j<lA;j++){ // if we need to conserve on space we should see Fig. 1B, which is linear
+ // in space, which I think is unnecessary
+ float diagonal;
+ if(seqB[i] == seqA[j]) { diagonal = alignment[i-1][j-1].cValue + match; }
+ else { diagonal = alignment[i-1][j-1].cValue + mismatch; }
+
+ alignment[i][j].iValue = max(alignment[i][j-1].iValue, alignment[i][j-1].cValue + gapOpen) + gapExtend;
+ alignment[i][j].dValue = max(alignment[i-1][j].dValue, alignment[i-1][j].cValue + gapOpen) + gapExtend;
+
+ if(alignment[i][j].iValue > alignment[i][j].dValue){
+ if(alignment[i][j].iValue > diagonal){
+ alignment[i][j].cValue = alignment[i][j].iValue;
+ alignment[i][j].prevCell = 'l';
+ }
+ else{
+ alignment[i][j].cValue = diagonal;
+ alignment[i][j].prevCell = 'd';
+ }