def test_no_collapse_real_data(self): positions = pd.read_csv("testFiles/testAssignRegions.csv") arms = HT.get_arms_hg19() cooler_file = cooler.Cooler( "testFiles/test3_realdata.mcool::resolutions/50000") expected = HT.get_expected(cooler_file, arms) result = HT.do_pileup_obs_exp(cooler_file, expected, positions, proc=1, collapse=False) expected = np.load( "testFiles/real_data_obsexp_pileup_not_collapsed.npy") self.assertTrue(np.allclose(result, expected, equal_nan=True))
def test_expected_real_data(self): """Tests expected counts for real Hi-C data with multiple chromosomal arms. Known values were provided and expected counts for each diagonal calculated.""" arms = HT.get_arms_hg19() cooler_file = cooler.Cooler( "testFiles/test3_realdata.mcool::/resolutions/50000") result = HT.get_expected( cooler_file, arms, proc=1, ignore_diagonals=0).drop(columns=["count.sum"]) check = pd.read_csv("testFiles/test_expected_realdata.csv") # merge regions for new expected format check.loc[:, "region"] = check.apply( lambda x: f"{x['chrom']}:{x['start']}-{x['end']}", axis=1) check_final = (check.drop( columns=["chrom", "start", "end"])[result.columns].sort_values( by=["region", "diag"]).reset_index(drop=True)) sorted_result = result.sort_values(by=["region", "diag"]).reset_index( drop=True) assert_frame_equal(sorted_result, check_final)
def test_arms(self): """Tests whether fetching and generating of supports for chromosomal arms of hg19 works.""" check = pd.read_csv("./testFiles/arms.csv") arms = HT.get_arms_hg19() assert_frame_equal(check, arms)