Skip to content

Commit

Permalink
Ensure that we respect max_motif
Browse files Browse the repository at this point in the history
  • Loading branch information
isaksamsten committed Dec 5, 2022
1 parent 5064e60 commit 5d4cc5e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 22 deletions.
60 changes: 41 additions & 19 deletions docs/examples/notebooks/annotate/motif.ipynb

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions docs/more/versions/v1.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ Dependencies

Wildboar 1.1 requires Python 3.8+, numpy 1.17.3+, scipy 1.3.2+ and scikit-learn 1.1+.

Version 1.1.1
=============

Changelog
---------

.. grid:: 1

.. grid-item-card::

:mod:`wildboar.annotate`
^^^

- |Fix| Correctly return ``max_motif`` motifs from :func:`annotate.motifs`.


Version 1.1.0
=============
Expand Down
4 changes: 1 addition & 3 deletions src/wildboar/annotate/_motifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,8 @@ def motifs(
motif_index = []
if callable(max_distance):
cutoff = max_distance(mp[i])
for j in range(max_motif):
if len(motif_index) > max_motif:
break

while len(motif_index) < max_motif and not np.all(np.isinf(mp)):
candidate = np.argmin(mp[i])
if mp[i, candidate] > cutoff:
break
Expand Down

0 comments on commit 5d4cc5e

Please sign in to comment.