def _accumulateCodonFrequencies(self, seq, codon_freq, nucleotide_freq): codons = cai.split(seq) for codon in codons: try: codon_freq[codon]+=1.0 except KeyError,ke: pass
def getSYN(seq, syn_scores): scores = [] for to_codon in cai.split(seq): try: scores.append(syn_scores[to_codon]) except KeyError: continue if len(scores) > 0: res = sum(scores)/len(scores) else: res = None return res
def getSYangNielsen(self, seq): scores = [self.codon_syn_scores[to_codon] for to_codon in cai.split(seq)] return sum(scores)/len(scores)