def _abi_trim(seq_record):
 start = False
 segment = 20
 trim_start = 0
 cutoff = 0.05
 if (len(seq_record) <= segment):
  return seq_record
 else:
  score_list = [(cutoff - (10 ** (qual / (-10.0)))) for qual in seq_record.letter_annotations['phred_quality']]
  cummul_score = [0]
  for i in range(1, len(score_list)):
   score = (cummul_score[(-1)] + score_list[i])
   if (score < 0):
    cummul_score.append(0)
   else:
    cummul_score.append(score)
    if (not start):
     trim_start = i
     start = True
  trim_finish = cummul_score.index(max(cummul_score))
  return seq_record[trim_start:trim_finish]

def _abi_trim ( seq_record ) : start = False segment = 20 trim_start = 0 cutoff = 0.05 if ( len ( seq_record ) <= segment ) : return seq_record else : score_list = [ ( cutoff - ( 10 ** ( qual / ( - 10.0 ) ) ) ) for qual in seq_record . letter_annotations [ 'phred_quality' ] ] cummul_score = [ 0 ] for i in range ( 1 , len ( score_list ) ) : score = ( cummul_score [ ( - 1 ) ] + score_list [ i ] ) if ( score < 0 ) : cummul_score . append ( 0 ) else : cummul_score . append ( score ) if ( not start ) : trim_start = i start = True trim_finish = cummul_score . index ( max ( cummul_score ) ) return seq_record [ trim_start : trim_finish ]
trims the sequence using richard motts modified trimming algorithm .