private int count_gaps ( int [ ] i1 , int [ ] i2 ) { int i0 = i1 [ 0 ] ; int j0 = i2 [ 0 ] ; int gaps = 0 ; for ( int i = 1 ; i < i1 . length ; i ++ ) { if ( Math . abs ( i1 [ i ] - i0 ) != 1 || ( Math . abs ( i2 [ i ] - j0 ) != 1 ) ) { gaps += 1 ; } i0 = i1 [ i ] ; j0 = i2 [ i ] ; } return gaps ; }
Count the number of gaps in an alignment represented by idx1 idx2 .