def alignment_summary(alignment, index='  ', vertical_threshold=5):
 answer = []
 alignment_len = alignment.get_alignment_length()
 rec_count = len(alignment)
 if (rec_count < vertical_threshold):
  for record in alignment:
   answer.append(('%s%s %s' % (index, str_summary(str(record.seq)), record.id)))
 else:
  for i in range(min(5, alignment_len)):
   answer.append(((index + str_summary(alignment[:, i])) + (' alignment column %i' % i)))
  if (alignment_len > 5):
   i = (alignment_len - 1)
   answer.append(((index + str_summary(('|' * rec_count))) + ' ...'))
   answer.append(((index + str_summary(alignment[:, i])) + (' alignment column %i' % i)))
 return '\n'.join(answer)

def alignment_summary ( alignment , index = '  ' , vertical_threshold = 5 ) : answer = [ ] alignment_len = alignment . get_alignment_length ( ) rec_count = len ( alignment ) if ( rec_count < vertical_threshold ) : for record in alignment : answer . append ( ( '%s%s %s' % ( index , str_summary ( str ( record . seq ) ) , record . id ) ) ) else : for i in range ( min ( 5 , alignment_len ) ) : answer . append ( ( ( index + str_summary ( alignment [ : , i ] ) ) + ( ' alignment column %i' % i ) ) ) if ( alignment_len > 5 ) : i = ( alignment_len - 1 ) answer . append ( ( ( index + str_summary ( ( '|' * rec_count ) ) ) + ' ...' ) ) answer . append ( ( ( index + str_summary ( alignment [ : , i ] ) ) + ( ' alignment column %i' % i ) ) ) return '\n' . join ( answer )
returns a concise summary of an alignment object as a string .