def __init__(self, hic_matrix, regions=None, data=None, window_sizes=None, norm='lin', max_dist=3000000,
                 max_percentile=99.99, algorithm='insulation', matrix_colormap=None,
                 data_colormap=None, log_data=True):
        self.hic_matrix = hic_matrix
        if regions is None:
            regions = []
            for i in range(hic_matrix.shape[0]):
                regions.append(GenomicRegion(chromosome='', start=i, end=i))
        self.regions = regions
        self.norm = norm
        self.fig = None
        self.max_dist = max_dist
        self.algorithm = algorithm
        self.svmax = None
        self.min_value = np.nanmin(self.hic_matrix[np.nonzero(self.hic_matrix)])
        self.min_value_data = None
        self.hic_plot = None
        self.tad_plot = None
        self.data_plot = None
        self.line_plot = None
        self.sdata = None
        self.data_ax = None
        self.line_ax = None
        self.da = None
        self.ws = None
        self.current_window_size = None
        self.window_size_text = None
        self.tad_cutoff_text = None
        self.max_percentile = max_percentile
        self.tad_regions = None
        self.current_da_ix = None
        self.button_save_tads = None
        self.button_save_vector = None
        self.button_save_matrix = None

        self.log_data = log_data

        if algorithm == 'insulation':
            self.tad_algorithm = insulation_index
            self.tad_calling_algorithm = call_tads_insulation_index
            self.is_symmetric = False
            if matrix_colormap is None:
                self.matrix_colormap = LinearSegmentedColormap.from_list('myreds', ['white', 'red'])
            if data_colormap is None:
                self.data_plot_color = 'plasma'
        elif algorithm == 'ninsulation':
            self.tad_algorithm = normalised_insulation_index
            self.tad_calling_algorithm = call_tads_insulation_index
            self.is_symmetric = True
            if matrix_colormap is None:
                self.matrix_colormap = LinearSegmentedColormap.from_list('myreds', ['white', 'red'])
            if data_colormap is None:
                self.data_plot_color = LinearSegmentedColormap.from_list('myreds', ['blue', 'white', 'red'])
        elif algorithm == 'directionality':
            self.tad_algorithm = directionality_index
            self.tad_calling_algorithm = call_tads_directionality_index
            self.is_symmetric = True
            if matrix_colormap is None:
                self.matrix_colormap = LinearSegmentedColormap.from_list('myreds', ['white', 'red'])
            if data_colormap is None:
                self.data_plot_color = LinearSegmentedColormap.from_list('myreds', ['blue', 'white', 'red'])

        if data is None:
            self.da, self.ws = data_array(hic_matrix=self.hic_matrix, regions=self.regions,
                                          tad_method=self.tad_algorithm, window_sizes=window_sizes)
        else:
            self.da = data
            if window_sizes is None:
                raise ValueError("window_sizes parameter cannot be None when providing data!")
            self.ws = window_sizes