def _get_blocks(rows, coords, idx):
 for idx_name in ('query', 'hit', 'midline', 'qannot', 'hannot'):
  assert (idx_name in idx)
 blocks = []
 for (start, end) in coords:
  block = {}
  block['query'] = rows[idx['query']][start:end]
  block['hit'] = rows[idx['hit']][start:end]
  block['similarity'] = rows[idx['midline']][start:end]
  if (idx['qannot'] is not None):
   block['query_annotation'] = rows[idx['qannot']][start:end]
  if (idx['hannot'] is not None):
   block['hit_annotation'] = rows[idx['hannot']][start:end]
  blocks.append(block)
 return blocks

def _get_blocks ( rows , coords , idx ) : for idx_name in ( 'query' , 'hit' , 'midline' , 'qannot' , 'hannot' ) : assert ( idx_name in idx ) blocks = [ ] for ( start , end ) in coords : block = { } block [ 'query' ] = rows [ idx [ 'query' ] ] [ start : end ] block [ 'hit' ] = rows [ idx [ 'hit' ] ] [ start : end ] block [ 'similarity' ] = rows [ idx [ 'midline' ] ] [ start : end ] if ( idx [ 'qannot' ] is not None ) : block [ 'query_annotation' ] = rows [ idx [ 'qannot' ] ] [ start : end ] if ( idx [ 'hannot' ] is not None ) : block [ 'hit_annotation' ] = rows [ idx [ 'hannot' ] ] [ start : end ] blocks . append ( block ) return blocks
returns a list of dictionaries of sequences split by the coordinates .