def _get_aln_slice_coords(parsed_hsp):
 seq = parsed_hsp['seq']
 seq_stripped = seq.strip('-')
 disp_start = int(parsed_hsp['_display_start'])
 start = int(parsed_hsp['_start'])
 stop = int(parsed_hsp['_stop'])
 if (start <= stop):
  start = (start - disp_start)
  stop = ((stop - disp_start) + 1)
 else:
  start = (disp_start - start)
  stop = ((disp_start - stop) + 1)
 stop += seq_stripped.count('-')
 assert ((0 <= start) and (start < stop) and (stop <= len(seq_stripped))), ('Problem with sequence start/stop,\n%s[%i:%i]\n%s' % (seq, start, stop, parsed_hsp))
 return (start, stop)

def _get_aln_slice_coords ( parsed_hsp ) : seq = parsed_hsp [ 'seq' ] seq_stripped = seq . strip ( '-' ) disp_start = int ( parsed_hsp [ '_display_start' ] ) start = int ( parsed_hsp [ '_start' ] ) stop = int ( parsed_hsp [ '_stop' ] ) if ( start <= stop ) : start = ( start - disp_start ) stop = ( ( stop - disp_start ) + 1 ) else : start = ( disp_start - start ) stop = ( ( disp_start - stop ) + 1 ) stop += seq_stripped . count ( '-' ) assert ( ( 0 <= start ) and ( start < stop ) and ( stop <= len ( seq_stripped ) ) ) , ( 'Problem with sequence start/stop,\n%s[%i:%i]\n%s' % ( seq , start , stop , parsed_hsp ) ) return ( start , stop )
helper function for the main parsing code .