Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# Bio.CodonAlign.CodonSeq.cal_dn_ds

All Samples(7)  |  Call(5)  |  Derive(0)  |  Import(2)

```
from Bio.CodonAlign.CodonAlphabet import default_codon_table, default_codon_alphabet
from Bio.CodonAlign.CodonSeq import _get_codon_list, CodonSeq, cal_dn_ds
from Bio.CodonAlign.chisq import chisqprob

```
```            for j in range(i+1):
if i != j:
dn, ds = cal_dn_ds(self._records[i], self._records[j],
method=method)
dn_matrix[i].append(dn)
```

```    def test_dn_ds(self):
from Bio.CodonAlign.CodonSeq import cal_dn_ds
codon_seq1 = self.aln[0]
codon_seq2 = self.aln[1]
dN, dS = cal_dn_ds(codon_seq1, codon_seq2, method='NG86')
self.assertAlmostEqual(round(dN, 4), 0.0209, places=4)
self.assertAlmostEqual(round(dS, 4), 0.0178, places=4)
dN, dS = cal_dn_ds(codon_seq1, codon_seq2, method='LWL85')
```
```        # This should be present:
from scipy.linalg import expm
dN, dS = cal_dn_ds(codon_seq1, codon_seq2, method='YN00')
self.assertAlmostEqual(round(dN, 4), 0.0198, places=4)
self.assertAlmostEqual(round(dS, 4), 0.0222, places=4)

try:
# New in scipy v0.11
from scipy.optimize import minimize
dN, dS = cal_dn_ds(codon_seq1, codon_seq2, method='ML')
```