def _comp_coords(hsp, seq_type, inter_lens):
 assert (seq_type in ('hit', 'query'))
 seq_step = (1 if (hsp[('%s_strand' % seq_type)] >= 0) else (-1))
 fstart = hsp[('%s_start' % seq_type)]
 fend = (fstart + (len(hsp[seq_type][0].replace('-', '').replace('>', '').replace('<', '')) * seq_step))
 coords = [(fstart, fend)]
 for (idx, block) in enumerate(hsp[seq_type][1:]):
  bstart = (coords[(-1)][1] + (inter_lens[idx] * seq_step))
  bend = (bstart + (seq_step * len(block.replace('-', ''))))
  coords.append((bstart, bend))
 if (seq_step != 1):
  for (idx, coord) in enumerate(coords):
   coords[idx] = (coords[idx][1], coords[idx][0])
 return coords

def _comp_coords ( hsp , seq_type , inter_lens ) : assert ( seq_type in ( 'hit' , 'query' ) ) seq_step = ( 1 if ( hsp [ ( '%s_strand' % seq_type ) ] >= 0 ) else ( - 1 ) ) fstart = hsp [ ( '%s_start' % seq_type ) ] fend = ( fstart + ( len ( hsp [ seq_type ] [ 0 ] . replace ( '-' , '' ) . replace ( '>' , '' ) . replace ( '<' , '' ) ) * seq_step ) ) coords = [ ( fstart , fend ) ] for ( idx , block ) in enumerate ( hsp [ seq_type ] [ 1 : ] ) : bstart = ( coords [ ( - 1 ) ] [ 1 ] + ( inter_lens [ idx ] * seq_step ) ) bend = ( bstart + ( seq_step * len ( block . replace ( '-' , '' ) ) ) ) coords . append ( ( bstart , bend ) ) if ( seq_step != 1 ) : for ( idx , coord ) in enumerate ( coords ) : coords [ idx ] = ( coords [ idx ] [ 1 ] , coords [ idx ] [ 0 ] ) return coords
fill the block coordinates of the given hsp dictionary .