From 3ec1a47fcaa96287733a5440505ec154ee9acfc4 Mon Sep 17 00:00:00 2001 From: Peter Vegh Date: Wed, 1 Nov 2023 02:09:56 +0000 Subject: [PATCH] Fix #81 --- .../CircularGraphicRecord/ArrowWedge.py | 5 +++-- .../CircularGraphicRecord.py | 15 ++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/dna_features_viewer/CircularGraphicRecord/ArrowWedge.py b/dna_features_viewer/CircularGraphicRecord/ArrowWedge.py index 086d2df..2882056 100644 --- a/dna_features_viewer/CircularGraphicRecord/ArrowWedge.py +++ b/dna_features_viewer/CircularGraphicRecord/ArrowWedge.py @@ -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): diff --git a/dna_features_viewer/CircularGraphicRecord/CircularGraphicRecord.py b/dna_features_viewer/CircularGraphicRecord/CircularGraphicRecord.py index 9145aeb..f276801 100644 --- a/dna_features_viewer/CircularGraphicRecord/CircularGraphicRecord.py +++ b/dna_features_viewer/CircularGraphicRecord/CircularGraphicRecord.py @@ -51,7 +51,6 @@ def __init__( labels_spacing=12, **kw ): - self.radius = 1.0 self.sequence_length = sequence_length self.features = features @@ -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( @@ -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]) @@ -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) @@ -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)