trinity-plugins/bwa-0.5.7-patched_multi_map/bwtaln.c
static int bwt_cal_width(const bwt_t *rbwt, int len, const ubyte_t *str, bwt_width_t *width)
{
	bwtint_t k, l, ok, ol;
	int i, bid;
	bid = 0;
	k = 0; l = rbwt->seq_len;
	for (i = 0; i < len; ++i) {
		ubyte_t c = str[i];
		if (c < 4) {
			bwt_2occ(rbwt, k - 1, l, c, &ok, &ol);
			k = rbwt->L2[c] + ok + 1;
			l = rbwt->L2[c] + ol;
		}
		if (k > l || c > 3) { // then restart
			k = 0;
			l = rbwt->seq_len;
			++bid;
		}
		width[i].w = l - k + 1;
		width[i].bid = bid;
	}
	width[len].w = 0;
	width[len].bid = ++bid;
	return bid;
}
// width must be filled as zero
width must be filled as zero
width must be filled as zero
static int bwt_cal_width(const bwt_t *rbwt, int len, const ubyte_t *str, bwt_width_t *width)
{
	bwtint_t k, l, ok, ol;
	int i, bid;
	bid = 0;
	k = 0; l = rbwt->seq_len;
	for (i = 0; i < len; ++i) {
		ubyte_t c = str[i];
		if (c < 4) {
			bwt_2occ(rbwt, k - 1, l, c, &ok, &ol);
			k = rbwt->L2[c] + ok + 1;
			l = rbwt->L2[c] + ol;
		}
		if (k > l || c > 3) { 
			k = 0;
			l = rbwt->seq_len;
			++bid;
		}
		width[i].w = l - k + 1;
		width[i].bid = bid;
	}
	width[len].w = 0;
	width[len].bid = ++bid;
	return bid;
}
static int bwt_cal_width ( const bwt_t * rbwt , int len , const ubyte_t * str , bwt_width_t * width ) { bwtint_t k , l , ok , ol ; int i , bid ; bid = 0 ; k = 0 ; l = rbwt -> seq_len ; for ( i = 0 ; i < len ; ++ i ) { ubyte_t c = str [ i ] ; if ( c < 4 ) { bwt_2occ ( rbwt , k - 1 , l , c , & ok , & ol ) ; k = rbwt -> L2 [ c ] + ok + 1 ; l = rbwt -> L2 [ c ] + ol ; } if ( k > l || c > 3 ) { k = 0 ; l = rbwt -> seq_len ; ++ bid ; } width [ i ] . w = l - k + 1 ; width [ i ] . bid = bid ; } width [ len ] . w = 0 ; width [ len ] . bid = ++ bid ; return bid ; }
width must be filled as zero
width must be filled as zero
// then restart