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

# Bio.Cluster.distancematrix

All Samples(9)  |  Call(5)  |  Derive(0)  |  Import(4)

```'''

from Bio.Cluster import distancematrix
import numpy as np

```
```
segment = x[seg_start:seg_end]
dist =  distancematrix(np.array([base_segment,segment]),dist= dist_metric)[1]
if y is not None:                   # if y series is also given, distance is average of x distance and y distance
segment_y = y[i:i+m]
dist_y =  distancematrix(np.array([base_segment_y,segment_y]),dist= dist_metric)[1]
```

```    def basic(self, p, q):
return bc.distancematrix((p,q), dist = self.dist)

def vector_distances(self, v1, v2):
if v1.dtype == numpy.uint64 or v2.dtype == numpy.uint64:
raise TypeError, "Biopython cannot deal with uint64 arrays"
results = numpy.empty((len(v1),len(v2)))
for i,q in enumerate(v1):
for j,r in enumerate(v2):
results[i,j] = bc.distancematrix((q,r), dist=self.dist)[1][0]
```

```
from math import log, exp
from Bio.Cluster import distancematrix

from jcvi.utils.cbook import human_size
```
```    if not x or not y:
return 0
return 1 - distancematrix((x, y), dist="s")[1][0]

```

```    def test_distancematrix_kmedoids(self):
if TestCluster.module=='Bio.Cluster':
from Bio.Cluster import distancematrix, kmedoids
elif TestCluster.module=='Pycluster':
from Pycluster import distancematrix, kmedoids
```

```    def test_distancematrix_kmedoids(self):