From 9517cfb136bcc31b0afdbc278a426b71929358d5 Mon Sep 17 00:00:00 2001 From: shitohana Date: Sat, 23 Sep 2023 18:24:33 +0300 Subject: [PATCH] cleanup before API change --- src/bismarkplot/Bismark.py | 13 ++++++------- src/bismarkplot/BismarkFiles.py | 11 ++++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bismarkplot/Bismark.py b/src/bismarkplot/Bismark.py index da9936f..4b23079 100644 --- a/src/bismarkplot/Bismark.py +++ b/src/bismarkplot/Bismark.py @@ -36,14 +36,10 @@ def __init__( self.genome = genome self.bismark = read_bismark_batches(file, genome, flank_windows, gene_windows, batch_size, cpu) - self.__flank_windows = flank_windows - self.__gene_windows = gene_windows - - self.__line_plot = None - self.__heat_map = None - self.__bar_plot = None - self.__box_plot = None + self.__flank_windows, self.__gene_windows = flank_windows, gene_windows + self.__line_plot, self.__heat_map, self.__bar_plot, self.__box_plot = [None]*4 + @property def line_plot(self) -> LinePlot: """ Getter for line plot. Calculates data once after first call. @@ -52,6 +48,7 @@ def line_plot(self) -> LinePlot: self.__line_plot = LinePlot(self.bismark) return self.__line_plot + @property def heat_map(self) -> HeatMap: """ Getter for heat map. Calculates data once after first call. @@ -60,6 +57,7 @@ def heat_map(self) -> HeatMap: self.__heat_map = HeatMap(self.bismark) return self.__heat_map + @property def box_plot(self) -> BoxPlot: """ Getter for box plot. Calculates data once after first call. @@ -68,6 +66,7 @@ def box_plot(self) -> BoxPlot: self.__box_plot = BoxPlot(self.bismark) return self.__box_plot + @property def bar_plot(self) -> BarPlot: """ Getter for bar plot. Calculates data once after first call. diff --git a/src/bismarkplot/BismarkFiles.py b/src/bismarkplot/BismarkFiles.py index b4c0f26..8675979 100644 --- a/src/bismarkplot/BismarkFiles.py +++ b/src/bismarkplot/BismarkFiles.py @@ -2,6 +2,7 @@ import logging import os +import matplotlib.axes import matplotlib.pyplot as plt import numpy as np import pandas as pd @@ -82,13 +83,13 @@ def __init__( bismark = Bismark(file, genome, flank_windows, gene_windows, batch_size, cpu) if line_plot: - self.line_plots.append(bismark.line_plot()) + self.line_plots.append(bismark.line_plot) if heat_map: - self.heat_maps.append(bismark.heat_map()) + self.heat_maps.append(bismark.heat_map) if bar_plot: - self.bar_plots.append(bismark.bar_plot()) + self.bar_plots.append(bismark.bar_plot) if box_plot: - self.box_plots.append(bismark.box_plot()) + self.box_plots.append(bismark.box_plot) if store_res: self.bismarks.append(bismark) @@ -202,7 +203,7 @@ def draw_heat_maps_filtered( image = ax.imshow( im_data, interpolation="nearest", aspect='auto', cmap=colormaps['cividis'], vmin=vmin, vmax=vmax ) - + assert isinstance(ax, matplotlib.axes.Axes) ax.set(title=labels[number]) ax.set_xlabel('Position') ax.set_ylabel('')