def _runWithProfiling(self, runStr, globals, locals): if self.USE_PROFILER: print 'Running with profiling..' profiler = Profiler() res = profiler.run(runStr, globals, locals) profiler.printStats(graphDir=get_data_output_path(), id=self.__class__.__name__) return res else: return eval(runStr, globals, locals)
def test_bedgraph(self): bedgraph_fn = os.path.join(get_data_path(), "chrY_coverage.bedgraph") trackfn = os.path.join(get_data_output_path(), "test_io_track") track = load_bedgraph(bedgraph_fn, trackfn=trackfn) self.assertEquals(len(track), 60) first = tuple(track[0]) self.assertEquals(first, (24, 0L, 1000000L)) last = tuple(track[-1]) self.assertEquals(last, (24, 59000000, 59373566)) self.assertRaises(KeyError, track.get_node_values, "datax") data = track.get_node_values("data") self.assertEquals(len(data), 60) self.assertTrue(data.shape == (60,)) track.close()
def get_fn(self): #fd, fn = tempfile.mkstemp() #os.close(fd) trackfn = os.path.join(get_data_output_path(), 'test_core_track') return trackfn