def _extract_alignment_region(alignment_seq_with_flanking, annotation):
 align_stripped = alignment_seq_with_flanking.strip('-')
 display_start = int(annotation['al_display_start'])
 if (int(annotation['al_start']) <= int(annotation['al_stop'])):
  start = (int(annotation['al_start']) - display_start)
  end = ((int(annotation['al_stop']) - display_start) + 1)
 else:
  start = (display_start - int(annotation['al_start']))
  end = ((display_start - int(annotation['al_stop'])) + 1)
 end += align_stripped.count('-')
 assert ((0 <= start) and (start < end) and (end <= len(align_stripped))), ('Problem with sequence start/stop,\n%s[%i:%i]\n%s' % (alignment_seq_with_flanking, start, end, annotation))
 return align_stripped[start:end]

def _extract_alignment_region ( alignment_seq_with_flanking , annotation ) : align_stripped = alignment_seq_with_flanking . strip ( '-' ) display_start = int ( annotation [ 'al_display_start' ] ) if ( int ( annotation [ 'al_start' ] ) <= int ( annotation [ 'al_stop' ] ) ) : start = ( int ( annotation [ 'al_start' ] ) - display_start ) end = ( ( int ( annotation [ 'al_stop' ] ) - display_start ) + 1 ) else : start = ( display_start - int ( annotation [ 'al_start' ] ) ) end = ( ( display_start - int ( annotation [ 'al_stop' ] ) ) + 1 ) end += align_stripped . count ( '-' ) assert ( ( 0 <= start ) and ( start < end ) and ( end <= len ( align_stripped ) ) ) , ( 'Problem with sequence start/stop,\n%s[%i:%i]\n%s' % ( alignment_seq_with_flanking , start , end , annotation ) ) return align_stripped [ start : end ]
helper function for the main parsing code .