matrix_object = hic.getMatrixZoomData(chromosome1, chromosome1, "observed", "NONE", "BP", resolution)
ch_1_ch_1 = matrix_object.getRecordsAsMatrix(startingbp1, endingbp1, startingbp1, endingbp1)
matrix_object = hic.getMatrixZoomData(chromosome1, chromosome2, "observed", "NONE", "BP", resolution)
ch_1_ch_2 = matrix_object.getRecordsAsMatrix(startingbp1, endingbp1, startingbp2, endingbp2)
matrix_object = hic.getMatrixZoomData(chromosome2, chromosome1, "observed", "NONE", "BP", resolution)
ch_2_ch_1 = matrix_object.getRecordsAsMatrix(startingbp2, endingbp2, startingbp1, endingbp1)
matrix_object = hic.getMatrixZoomData(chromosome2, chromosome2, "observed", "NONE", "BP", resolution)
ch_2_ch_2 = matrix_object.getRecordsAsMatrix(startingbp2, endingbp2, startingbp2, endingbp2)
# Combine the matrices
upper_left = ch_1_ch_1
upper_right = ch_1_ch_2
lower_left = ch_2_ch_1
lower_right = ch_2_ch_2
# Get the dimensions of the submatrices
rows_ul, cols_ul = upper_left.shape
rows_ur, cols_ur = upper_right.shape
rows_ll, cols_ll = lower_left.shape
rows_lr, cols_lr = lower_right.shape
# Create an empty matrix to hold the combined result
combined_matrix = np.zeros((rows_ul + rows_ll, cols_ul + cols_ur))
# Place the submatrices into the combined matrix
combined_matrix[:rows_ul, :cols_ul] = upper_left
combined_matrix[:rows_ur, cols_ul:] = upper_right
combined_matrix[rows_ul:, :cols_ll] = np.transpose(upper_right)
combined_matrix[rows_ul:, cols_ll:] = lower_right