Esempio n. 1
0
 def test_region_spans_multiple_supports(self):
     """Tests assign regions when region spans multiple supports."""
     bed_file = pd.read_csv("testFiles/multiple_support_regions.csv")
     result = HT.assign_regions(
         window=1000000,
         binsize=20000,
         chroms=bed_file["chrom"],
         positions=bed_file["pos"],
         arms=self.arms,
     )
     expected = pd.read_csv("testFiles/multiple_support_regions_result.csv")
     assert_series_equal(result["region"], expected["region"])
Esempio n. 2
0
 def test_case1(self):
     """Test assignment of small, synthetic set of regions."""
     bed_file = pd.read_csv("testFiles/testSmall.bed", sep="\t")
     result = HT.assign_regions(
         window=500000,
         binsize=50000,
         chroms=bed_file["chrom"],
         positions=bed_file["pos"],
         arms=self.arms,
     )
     expected = pd.read_csv("testFiles/testAssignRegions.csv")
     assert_frame_equal(result, expected)
Esempio n. 3
0
 def test_regions_are_close_to_supports(self):
     """Tests assign regions when regions are close to supports -> bug was found"""
     bed_file = pd.read_csv(
         "testFiles/regions_close_to_support_boundary.tsv", sep="\t")
     result = HT.assign_regions(
         window=1000000,
         binsize=20000,
         chroms=bed_file["chrom"],
         positions=bed_file["pos"],
         arms=self.arms,
     )
     expected = pd.read_csv(
         "testFiles/regions_close_to_support_boundary_result.tsv",
         delim_whitespace=True,
     )
     assert_series_equal(result["region"], expected["region"])
Esempio n. 4
0
 def test_collapse(self):
     """Tests pileup of synthetic Hi-C data, with collapsing results."""
     position_frame = pd.read_csv("testFiles/posPileups.csv")
     arms = pd.DataFrame({
         "chrom": "chrSyn",
         "start": 0,
         "end": 4990000
     },
                         index=[0])
     assigned = HT.assign_regions(50000, 10000, position_frame["chrom"],
                                  position_frame["pos"], arms)
     cooler_file = cooler.Cooler(
         "testFiles/test2.mcool::/resolutions/10000")
     result = HT.do_pileup_iccf(cooler_file,
                                assigned,
                                proc=1,
                                collapse=True)
     expected = np.load("testFiles/test_pileups_iccf_collapse.npy")
     self.assertTrue(np.allclose(result, expected))