Permalink
Browse files

Fix corner case drawing small JAGGY features on circular diagrams.

The assertion that start <= tail <= head <= end could fail due
to minor floating point calculation differences for tail & head.

Bug report with test case from Peter Thorpe, thank you!
  • Loading branch information...
peterjc committed Jul 23, 2013
1 parent 0c4831d commit b6e88aa368c13bf14233ec09d56eb137aa5c3d0c
Showing with 3 additions and 0 deletions.
  1. +3 −0 Bio/Graphics/GenomeDiagram/_CircularDrawer.py
@@ -1408,6 +1408,9 @@ def _draw_sigil_jaggy(self, bottom, center, top,
if head_length_ratio and tail_length_ratio:
headangle = max(endangle - min(height*head_length_ratio/(center*teeth), angle*0.5), startangle)
tailangle = min(startangle + min(height*tail_length_ratio/(center*teeth), angle*0.5), endangle)
+ #With very small features, can due to floating point calculations
+ #violate the assertion below that start <= tail <= head <= end
+ tailangle = min(tailangle, headangle)
elif head_length_ratio:
headangle = max(endangle - min(height*head_length_ratio/(center*teeth), angle), startangle)
tailangle = startangle

0 comments on commit b6e88aa

Please sign in to comment.