public static int getBlockNrForAlignPos ( AFPChain afpChain , int aligPos ) { // moved here from DisplayAFP; int blockNum = afpChain . getBlockNum ( ) ; int [ ] optLen = afpChain . getOptLen ( ) ; int [ ] [ ] [ ] optAln = afpChain . getOptAln ( ) ; int len = 0 ; int p1b = 0 ; int p2b = 0 ; for ( int i = 0 ; i < blockNum ; i ++ ) { for ( int j = 0 ; j < optLen [ i ] ; j ++ ) { int p1 = optAln [ i ] [ 0 ] [ j ] ; int p2 = optAln [ i ] [ 1 ] [ j ] ; if ( len != 0 ) { // check for gapped region int lmax = ( p1 - p1b - 1 ) > ( p2 - p2b - 1 ) ? ( p1 - p1b - 1 ) : ( p2 - p2b - 1 ) ; for ( int k = 0 ; k < lmax ; k ++ ) { len ++ ; } } p1b = p1 ; p2b = p2 ; if ( len >= aligPos ) { return i ; } len ++ ; } } return blockNum ; }
get the block number for an aligned position