Package: python-cogent / 1.9-14

numpy_xor.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: Use xor rather than subtraction on booleans
 Numpy no longer accepts the ambiguous construction of a-b when a and b are bools.
 Normally, this can be replaced with XORs.
Author: Stuart Prescott <stuart@debian.org>
Last-Update: Tue, 05 Jun 2018 15:32:46 +0000 (UTC)
Origin: https://github.com/pycogent/pycogent/files/2072984/numpy_xor.patch
Bug-Debian: https://bugs.debian.org/899205

--- a/cogent/core/sequence.py
+++ b/cogent/core/sequence.py
@@ -1248,7 +1248,7 @@
         gap_indices = map(self.Alphabet.index, self.MolType.Gaps)
         valid_indices = self._data < len(self.Alphabet)
         for i in gap_indices:
-            valid_indices -= self._data == i
+            valid_indices ^= self._data == i
         result = compress(valid_indices, self._data)
         return self.__class__(result, Info=self.Info)
 
--- a/cogent/maths/distance_transform.py
+++ b/cogent/maths/distance_transform.py
@@ -670,9 +670,9 @@
         return zeros((0,0),'d')
     dists = zeros((numrows,numrows),'d')
     for i in range(numrows):
-        r1 = datamtx[i] # cache here
+        r1 = datamtx[i].astype(dists.dtype) # cache here
         for j in range(i):
-            dists[i,j] = dists[j,i] = sum(abs(r1 - datamtx[j]))
+            dists[i,j] = dists[j,i] = sum(abs(r1 - datamtx[j].astype(dists.dtype)))
             
     return dists