Skip to content

Commit

Permalink
Store motif letter counts with Python floats
Browse files Browse the repository at this point in the history
This adds a cast to avoid storing numpy floats
which as of numpy 2.0 have a different __repr__
and this complicate our doctest behaviour.

Closes #4676.
  • Loading branch information
peterjc committed May 13, 2024
1 parent ff3bbf8 commit 20c9b4a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Bio/motifs/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def __init__(self, alphabet, values):
self.length = len(values[letter])
elif self.length != len(values[letter]):
raise Exception("data has inconsistent lengths")
self[letter] = list(values[letter])
# Cast any numpy floats into Python floats:
self[letter] = [float(_) for _ in values[letter]]
self.alphabet = alphabet

def __str__(self):
Expand Down

0 comments on commit 20c9b4a

Please sign in to comment.