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

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

src/b/i/biopython-HEAD/Bio/CodonAlign/CodonAlignment.py   biopython(Download)
    def get_dn_ds_matrix(self, method="NG86"):
        """Available methods include NG86, LWL85, YN00 and ML.
        """
        from Bio.Phylo.TreeConstruction import _DistanceMatrix as DM
        names = [i.id for i in self._records]
                    dn_matrix[i].append(0.0)
                    ds_matrix[i].append(0.0)
        dn_dm = DM(names, matrix=dn_matrix)
        ds_dm = DM(names, matrix=ds_matrix)
        return dn_dm, ds_dm

src/b/i/biopython-HEAD/Tests/test_TreeConstruction.py   biopython(Download)
from Bio.Phylo import Consensus
from Bio.Phylo.TreeConstruction import _Matrix
from Bio.Phylo.TreeConstruction import _DistanceMatrix
from Bio.Phylo.TreeConstruction import DistanceCalculator
from Bio.Phylo.TreeConstruction import DistanceTreeConstructor
    def test_good_construction(self):
        dm = _DistanceMatrix(self.names, self.matrix)
        self.assertTrue(isinstance(dm, TreeConstruction._DistanceMatrix))
        self.assertEqual(dm.names[0], 'Alpha')
        self.assertEqual(dm.matrix[2][1], 3)
    def test_good_manipulation(self):
        dm = _DistanceMatrix(self.names, self.matrix)
        # getitem
        self.assertEqual(dm[1], [1, 0, 3, 5])
        self.assertEqual(dm[2, 1], 3)
    def test_bad_manipulation(self):
        dm = _DistanceMatrix(self.names, self.matrix)
        #getitem
        self.assertRaises(ValueError, dm.__getitem__, 'A')
        self.assertRaises(ValueError, dm.__getitem__, ('Alpha', 'A'))