def _get_TV(codon_lst1, codon_lst2, codon_table=default_codon_table):
 purine = ('A', 'G')
 pyrimidine = ('C', 'T')
 TV = [0, 0]
 sites = 0
 for (codon1, codon2) in zip(codon_lst1, codon_lst2):
  if ('---' not in (codon1, codon2)):
   for (i, j) in zip(codon1, codon2):
    if (i == j):
     pass
    elif ((i in purine) and (j in purine)):
     TV[0] += 1
    elif ((i in pyrimidine) and (j in pyrimidine)):
     TV[0] += 1
    else:
     TV[1] += 1
    sites += 1
 return ((TV[0] / sites), (TV[1] / sites))

def _get_TV ( codon_lst1 , codon_lst2 , codon_table = default_codon_table ) : purine = ( 'A' , 'G' ) pyrimidine = ( 'C' , 'T' ) TV = [ 0 , 0 ] sites = 0 for ( codon1 , codon2 ) in zip ( codon_lst1 , codon_lst2 ) : if ( '---' not in ( codon1 , codon2 ) ) : for ( i , j ) in zip ( codon1 , codon2 ) : if ( i == j ) : pass elif ( ( i in purine ) and ( j in purine ) ) : TV [ 0 ] += 1 elif ( ( i in pyrimidine ) and ( j in pyrimidine ) ) : TV [ 0 ] += 1 else : TV [ 1 ] += 1 sites += 1 return ( ( TV [ 0 ] / sites ) , ( TV [ 1 ] / sites ) )
get tv .