Did I find the right examples for you? yes no

# cogent.util.misc.DistanceFromMatrix

All Samples(10)  |  Call(6)  |  Derive(0)  |  Import(4)

```from cogent.util.transform import keep_chars, for_seq, per_shortest, \
per_longest
from cogent.util.misc import DistanceFromMatrix
from cogent.core.genetic_code import DEFAULT as DEFAULT_GENETIC_CODE, \
GeneticCodes
```
```        sequences are identical.
"""
return self.distance(other, DistanceFromMatrix(matrix))

def fracSame(self, other):
```
```        sequences are identical.
"""
return self.distance(other, DistanceFromMatrix(matrix))

def shuffle(self):
```

```from cogent.util.transform import keep_chars, for_seq, per_shortest, \
per_longest
from cogent.util.misc import DistanceFromMatrix
from cogent.core.genetic_code import DEFAULT as DEFAULT_GENETIC_CODE, \
GeneticCodes
```
```        sequences are identical.
"""
return self.distance(other, DistanceFromMatrix(matrix))

def fracSame(self, other):
```
```        sequences are identical.
"""
return self.distance(other, DistanceFromMatrix(matrix))

def shuffle(self):
```

```from cogent.app.util import get_tmp_filename
from cogent.util.unit_test import TestCase, main
from cogent.util.misc import (iterable, max_index, min_index,
flatten, is_iterable, is_char, is_char_or_noniterable,
is_str_or_noniterable, not_list_tuple, list_flatten,
```
```    def test_DistanceFromMatrix(self):
"""DistanceFromMatrix should return correct elements"""
m = {'a':{'3':4, 6:1}, 'b':{'3':5,'6':2}}
d = DistanceFromMatrix(m)
self.assertEqual(d('a','3'), 4)
```

```from cogent.app.util import get_tmp_filename
from cogent.util.unit_test import TestCase, main
from cogent.util.misc import (iterable, max_index, min_index,
flatten, is_iterable, is_char, is_char_or_noniterable,
is_str_or_noniterable, not_list_tuple, list_flatten,
```
```    def test_DistanceFromMatrix(self):
"""DistanceFromMatrix should return correct elements"""
m = {'a':{'3':4, 6:1}, 'b':{'3':5,'6':2}}
d = DistanceFromMatrix(m)
self.assertEqual(d('a','3'), 4)
```