def testSlice(self): m = self._m sm = self._sm AssertList(m[0:0], sm[0:0], self.assertEqual) AssertList(m[0:100], sm[0:100], self.assertEqual) AssertList(m[10:20], sm[10:20], self.assertEqual) AssertList(m[90:110], sm[90:110], self.assertEqual) AssertList(m[110:120], sm[110:120], self.assertEqual)
def _assertTVEqual(self, target, other): self.assertEqual(target.genomeAnchor, other.genomeAnchor) self.assertEqual(target.trackFormat, other.trackFormat) AssertList([el.start() for el in target], [el.start() for el in other], self.assertEqual) AssertList([el.end() for el in target], [el.end() for el in other], self.assertEqual) AssertList([el.val() for el in target], [el.val() for el in other], self.assertAlmostEqual) AssertList([el.strand() for el in target], [el.strand() for el in other], self.assertEqual)
def _assertSplitUserBin(self, compBins, start, end): region = GenomeRegion('hg18', 'chr1', start, end) compBinRegions = [ GenomeRegion('hg18', 'chr1', elStart, elEnd) for elStart, elEnd in compBins ] AssertList(compBinRegions, CompBinManager.splitUserBin(region), self.assertEqual)
def _assertSlicing(self, i, j): AssertList([x + 1 for x in self._array[i:j]], self._vpe[i:j], self.assertEqual)
def testIndexing(self): AssertList([x + 1 for x in self._array], self._vpe, self.assertEqual)
def _assertIndexFile(self, contents, prefix): fn = self.path + os.sep + prefix + '.int32' self.assertTrue(os.path.exists(fn)) fileContents = [el for el in memmap(fn, 'int32', mode='r')] AssertList(contents, fileContents, self.assertEqual)
def _assertSlide(self, targetWindows, windowSize, source): windows = SlidingWindow(source, windowSize) self.assertEqual(len(targetWindows), len([el for el in windows])) for i, window in enumerate(windows): AssertList(targetWindows[i], window, self.assertEqual)
def _assertList(self, target, other): AssertList(target, other, self.assertEqual)