def load_data(self, pyramid):
        """
        :param pyramid: hic pyramid
        """
        import colorsys

        logger.info("loading data from level = {}".format(self.level))
        # self.im_init = np.array(pyramid.data[str(self.level)],
        # dtype=np.int32)
        # self.n_frags = self.im_init.shape[0]

        # start loading sparse matrix #####
        self.n_frags = int(np.copy(pyramid.data[str(self.level)]["nfrags"][0]))
        self.np_2_scipy_sparse = np.copy(pyramid.data[str(self.level)]["data"])
        self.sparse_mat_csr = sp.csr_matrix(
            (self.np_2_scipy_sparse[2, :], self.np_2_scipy_sparse[0:2, :]),
            shape=(self.n_frags, self.n_frags),
        )
        self.sparse_mat_csc = sp.csc_matrix(
            (self.np_2_scipy_sparse[2, :], self.np_2_scipy_sparse[0:2, :]),
            shape=(self.n_frags, self.n_frags),
        )
        # end loading sparse matrix #####

        int_n_frags = np.int32(self.n_frags)
        self.pos_vect_frags_4_GL = np.ndarray(
            (int_n_frags, 4), dtype=np.float32
        )
        self.col_vect_frags_4_GL = np.ndarray(
            (int_n_frags, 4), dtype=np.float32
        )

        self.dict_contigs = dict()
        ContFrags = pyramid.spec_level[str(self.level)]["contigs_dict"]
        if str(self.level - 1) in pyramid.spec_level:
            subContFrags = pyramid.spec_level[str(self.level - 1)][
                "contigs_dict"
            ]
        else:
            subContFrags = ContFrags
        coord_cont = dict()

        n_contigs = len(list(ContFrags.keys()))
        # print "n init contigs = ", n_contigs
        HSV_tuples = [
            (x * 2.5 / n_contigs, 0.5, 0.5) for x in range(n_contigs)
        ]
        RGB_tuples = [colorsys.hsv_to_rgb(*x) for x in HSV_tuples]
        self.distri_frag = []

        # list_contigs = ContFrags.keys()
        # print "Cont frags keys = ", ContFrags.keys()
        list_contigs_id = pyramid.list_contigs_id
        # debugggg
        # list_contigs.sort()

        for i in range(0, self.n_frags):
            self.frags_init_contigs.append("")

        for id_cont in list_contigs_id:
            self.dict_contigs[id_cont] = dict()
            cont_frag = ContFrags[id_cont]
            sub_cont_frag = subContFrags[id_cont]
            coord_cont[id_cont] = []
            name_contig = cont_frag[0].init_contig
            tick_kb = []
            end_frags_kb = []

            id_f_prev = -1
            lim_curr_cont = len(cont_frag)
            sub_lim_curr_cont = len(sub_cont_frag)
            len_curr_contig_bp = 0
            curr_sub_pos = 0
            for id_f in range(0, lim_curr_cont):
                f = cont_frag[id_f]
                lkb = f.length_kb
                len_curr_contig_bp += lkb
            for id_f in range(0, lim_curr_cont):
                f = cont_frag[id_f]
                lkb = f.length_kb
                self.distri_frag.append(lkb)
                start = f.start_pos
                end = f.end_pos
                pos_kb = start + lkb / 2.0
                tick_kb.append(pos_kb)
                end_frags_kb.append(end)
                id_f_curr = f.np_id_abs - 1
                n_accu_frags = f.n_accu_frags
                n_sub_frags = f.sub_frag_end - f.sub_frag_start + 1

                self.frags_init_contigs[id_f_curr] = f.init_contig

                if id_f < lim_curr_cont - 1:
                    id_f_next = cont_frag[id_f + 1].np_id_abs - 1
                else:
                    id_f_next = -1
                f_T_frag = (
                    np.int32(f.curr_id - 1),
                    np.int32(f.contig_id),
                    np.int32(start),
                    np.int32(lkb),
                    np.int32(0),
                    np.int32(id_f_curr),
                    np.int32(id_f_prev),
                    np.int32(id_f_next),
                    np.int32(lim_curr_cont),
                    np.int32(len_curr_contig_bp),
                    np.int32(n_accu_frags),
                )
                self.pos_vect_frags_4_GL[id_f_curr, 0] = (
                    np.float32(f.curr_id - 1) / 100.0
                )
                self.pos_vect_frags_4_GL[id_f_curr, 1] = (
                    np.float32(f.contig_id) / 100.0
                )
                # self.pos_vect_frags_4_GL[id_f_curr, 2] = np.float32(0.0)
                self.pos_vect_frags_4_GL[id_f_curr, 2] = 0.0
                self.pos_vect_frags_4_GL[id_f_curr, 3] = np.float32(1.0)
                # GL_pos_frag = (np.float32(f.curr_id - 1),
                #            np.float32(f.contig_id),
                #            np.float32(lim_curr_cont),
                #            np.float32(0.0))
                # self.col_vect_frags_4_GL[id_f_curr,0] = np.float32(0.)
                # self.col_vect_frags_4_GL[id_f_curr,1] = np.float32(1.)
                # self.col_vect_frags_4_GL[id_f_curr,2] = np.float32(0.)
                # self.col_vect_frags_4_GL[id_f_curr,3] = np.float32(1.)
                self.col_vect_frags_4_GL[id_f_curr, 0] = np.float32(
                    RGB_tuples[id_cont - 1][0]
                )
                self.col_vect_frags_4_GL[id_f_curr, 1] = np.float32(
                    RGB_tuples[id_cont - 1][1]
                )
                self.col_vect_frags_4_GL[id_f_curr, 2] = np.float32(
                    RGB_tuples[id_cont - 1][2]
                )
                self.col_vect_frags_4_GL[id_f_curr, 3] = np.float32(1.0)

                # GL_col_frag = (np.float32(RGB_tuples[id_cont - 1][0],
                #                np.float32(RGB_tuples[id_cont - 1][1]),
                #                np.float32(RGB_tuples[id_cont - 1][2]),
                #                np.float32(1.0))
                self.S_o_A_frags["pos"].append(f.curr_id - 1)
                self.S_o_A_frags["sub_pos"].append(curr_sub_pos)  # TO DO !!!!
                self.S_o_A_frags["id_c"].append(f.contig_id)
                self.S_o_A_frags["start_bp"].append(start)
                self.S_o_A_frags["len_bp"].append(lkb)
                self.S_o_A_frags["sub_len"].append(n_sub_frags)
                self.S_o_A_frags["circ"].append(0)
                self.S_o_A_frags["id"].append(id_f_curr)
                self.S_o_A_frags["prev"].append(id_f_prev)
                self.S_o_A_frags["next"].append(id_f_next)
                self.S_o_A_frags["l_cont"].append(lim_curr_cont)
                self.S_o_A_frags["sub_l_cont"].append(sub_lim_curr_cont)
                self.S_o_A_frags["l_cont_bp"].append(len_curr_contig_bp)
                self.S_o_A_frags["n_accu"].append(n_accu_frags)

                id_f_prev = id_f_curr
                self.vect_frag_np.append(f_T_frag)
                curr_sub_pos += n_sub_frags

                # self.pos_vect_frags_4_GL.append(GL_pos_frag)
                # self.col_vect_frags_4_GL.append(GL_col_frag)
            for f in cont_frag:
                coord_cont[id_cont].append(f.np_id_abs - 1)
            self.dict_contigs[id_cont]["intra_coord"] = coord_cont[id_cont]
            self.dict_contigs[id_cont]["frags"] = cont_frag
            self.dict_contigs[id_cont]["name"] = name_contig
            self.dict_contigs[id_cont]["tick_kb"] = np.array(tick_kb)
            self.dict_contigs[id_cont]["end_frags_kb"] = np.array(end_frags_kb)
            #######################

        self.vect_frag_np = np.array(self.vect_frag_np, dtype=self.T_frag)

        # self.pos_vect_frags_4_GL = np.array(self.pos_vect_frags_4_GL,
        # dtype=self.float4) self.col_vect_frags_4_GL =
        # np.array(self.col_vect_frags_4_GL, dtype=self.float4)

        for key in list(self.S_o_A_frags.keys()):
            self.S_o_A_frags[key] = np.array(
                self.S_o_A_frags[key], dtype=np.int32
            )

        total_trans = 0
        n_tot = 0
        n_tot_intra = 0
        for id_cont in range(1, len(self.dict_contigs) + 1):
            sub_sp_mat_tmp = self.sparse_mat_csr[coord_cont[id_cont], :]
            n_full_contact = sub_sp_mat_tmp.sum()
            sub_sp_mat_tmp_csc = sub_sp_mat_tmp.tocsc()
            sub_sp_mat_tmp_intra = sub_sp_mat_tmp_csc[:, coord_cont[id_cont]]
            shape_test = sub_sp_mat_tmp_intra.shape
            test = shape_test[0] == shape_test[1]
            if not test:
                logger.info("MIERDA!!!!")
            n_intra = sub_sp_mat_tmp_intra.sum()

            total_trans += n_full_contact
            total_trans -= n_intra
            # n_tot += (sub_sp_mat_tmp.shape[0] * sub_sp_mat_tmp.shape[1]) -
            # sub_sp_mat_tmp_intra.shape[0]*sub_sp_mat_tmp_intra.shape[1]
            n_tot_intra += shape_test[0] * (shape_test[0] - 1) / 2

        # for id_cont in xrange(1, len(self.dict_contigs)+1):
        #    full = self.im_init[coord_cont[id_cont], :]
        #    intra = self.im_init[np.ix_(coord_cont[id_cont],
        #    coord_cont[id_cont])]
        #    total_trans += full.sum()
        #    total_trans -= intra.sum()
        #    n_tot += (full.shape[0]*full.shape[1]) -
        #    intra.shape[0]*intra.shape[1]
        n_tot = (
            self.sparse_mat_csr.shape[0]
            * (self.sparse_mat_csr.shape[0] - 1)
            / 2
            - n_tot_intra
        )
        self.mean_value_trans = total_trans / np.float32(n_tot)
        if np.isnan(self.mean_value_trans):
            self.mean_value_trans = np.amin(self.sparse_mat_csr.data) / 10.0
        logger.debug(
            "computed mean trans value ... = {}".format(self.mean_value_trans)
        )

        self.distri_frag = np.array(self.distri_frag)

        # self.define_inter_chrom_coord()
        # self.init_data()

        self.n_contigs = len(self.dict_contigs)