Skip to content

Commit

Permalink
Fix #81
Browse files Browse the repository at this point in the history
  • Loading branch information
veghp committed Nov 1, 2023
1 parent 81c3fb0 commit 3ec1a47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
5 changes: 3 additions & 2 deletions dna_features_viewer/CircularGraphicRecord/ArrowWedge.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ class ArrowWedge(mpatches.Wedge):
"""

def __init__(self, center, radius, theta1, theta2, width, direction=+1, **kwargs):

self.direction = direction
self.radius = radius
mpatches.Wedge.__init__(self, center, radius, theta1, theta2, width, **kwargs)
mpatches.Wedge.__init__(
self, center, radius, theta1, theta2, width=width, **kwargs
)
self._recompute_path()

def _recompute_path(self):
Expand Down
15 changes: 4 additions & 11 deletions dna_features_viewer/CircularGraphicRecord/CircularGraphicRecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def __init__(
labels_spacing=12,
**kw
):

self.radius = 1.0
self.sequence_length = sequence_length
self.features = features
Expand All @@ -61,8 +60,7 @@ def __init__(
self.labels_spacing = labels_spacing

def initialize_ax(self, ax, draw_line, with_ruler):
"""Initialize the ax with a circular line, sets limits, aspect etc.
"""
"""Initialize the ax with a circular line, sets limits, aspect etc."""

if draw_line:
circle = mpatches.Circle(
Expand Down Expand Up @@ -111,11 +109,7 @@ def finalize_ax(
ax.figure.set_size_inches(figure_width, figure_width * ratio)

def plot_feature(self, ax, feature, level):
"""Plot an ArrowWedge representing the feature at the given height
level.
"""
"""Plot an ArrowWedge representing the feature at the given height level."""
a_start = self.position_to_angle(feature.start)
a_end = self.position_to_angle(feature.end)
a_start, a_end = sorted([a_start, a_end])
Expand All @@ -140,8 +134,7 @@ def position_to_angle(self, position):
return 90 - a

def coordinates_in_plot(self, position, level):
"""Convert a sequence position and height level to (x, y) coordinates.
"""
"""Convert a sequence position and height level to (x, y) coordinates."""
r = self.radius + level * self.feature_level_height
angle = self.position_to_angle(position)
rad_angle = np.deg2rad(angle)
Expand All @@ -157,7 +150,7 @@ def determine_annotation_height(self, max_annotations_level):
return min(0.25, 3.0 * self.radius / (1.0 + max_annotations_level))

def compute_padding(self, ax):
""
""""""
ax_width = ax.get_window_extent(ax.figure.canvas.get_renderer()).width
xmin, xmax = ax.get_xlim()
return 3 * self.labels_spacing * (xmax - xmin) / (1.0 * ax_width)

0 comments on commit 3ec1a47

Please sign in to comment.