mimakaev committed b2e23b5

Simple test for highResolutionHiC added.

  • Participants
  • Parent commits 189d882

Comments (0)

Files changed (3)

File src/hiclib/

             self.genome = genome
-        assert isinstance(self.genome, Genome)
+        assert hasattr(self.genome, "chrmCount")
         if resolution is not None:
             self.resolution = resolution

File src/hiclib/

                 print "Please load data!"
                 raise ValueError("Please load data first")
     def _marginalError(self, marginals=None):
         "Checks after each pass of IC, if marginals are close enough to 1"
         if marginals is None:
     def getMarginals(self, normalizeForIC=False):
         Returns a sum over each row/column, and saves them to self.marginals

File tests/highResBinnedData/

+This is an example of how HiResBinnedData behaves exactly like binnedData
+It uses genome with 5 chromosomes because hiResBinnedData has a small per-chromosome
+overhead, and therefore having 23*11 chromosome pairs would slow it down a bit.
+Note the trick of converting a global heatmap map to a smaller map.
+It tests only iterative correction now.
+from hiclib.highResBinnedData import HiResHiC
+from mirnylib.genome import Genome
+from hiclib.binnedData import binnedData
+from mirnylib.plotting import mat_img
+from mirnylib.h5dict import h5dict
+import numpy as np
+genome = Genome("../../../data/hg19", readChrms=["1", "2", "3", "4", "5"])
+a = HiResHiC(genome, 1000000, "hiResDict", mode='w')
+b = binnedData(1000000, genome)
+data = {"heatmap": h5dict("../fragmentHiC/")["heatmap"]}
+lim = b.genome.chrmEndsBinCont[-1]
+data["heatmap"] = data["heatmap"][:lim, :lim]
+b.simpleLoad(data, "data")
+dataHigh = a.getCombinedMatrix()
+dataLow = b.dataDict["data"]
+dataHigh /= dataHigh.mean()
+dataLow /= dataLow.mean()
+assert np.abs(dataHigh - dataLow).max() < 1e-6