def test_window_iterator(config): seq = "AAAAC" expected_windows = ["AAA","AAA","AAC"] expected_windows2 = ["AAA","AAC"] test1 = ensure_eq( expected_windows, list(window_iterator(seq, 3))) test2 = ensure_eq( expected_windows2, list(window_iterator(seq,3,2))) return [test1, test2]
def test_get_marked_ranges(config): test_arr = [0,0,0,1,1,1,0,0,1,0] expected_ranges = [(3,5),(8,8)] range_test = ensure_eq(expected_ranges, get_marked_ranges(test_arr)) return range_test
def test_percent_gc(config): seq = "AAACCCGGG" expected_pcts = [float(1)/4, float(2)/4, float(3)/4, float(4)/4, float(4)/4, float(4)/4] return ensure_eq(expected_pcts, map(percent_gc, window_iterator(seq,4)))
def test_coverage_array_from_ranges(config): ranges_ok = [ (1, 3), (3, 4), (3, 5) ] ranges_ok_expect = [0,1,1,3,2,1] range_test = ensure_eq(ranges_ok_expect, coverage_array_from_ranges(ranges_ok)) return range_test