<commit_before><commit_msg>Logic to compute data points on interval<commit_after>import pysam


def data_points(file_path, start, stop, chrm, step, size):
    start, stop, step, size = int(start), int(stop), int(step), int(size)
    points = []
    w_size = (stop-start)/size

    p_window = start + w_size
    w_vals = []
    tabixfile = pysam.Tabixfile(file_path)
    for gtf in tabixfile.fetch(chrm, start, stop):
        _chrm, _start, _end, _val = gtf.split()
        _start, _end, _val = int(_start), int(_end), int(_val)

        for coor in range(_start, _end):
            if coor < p_window:
                w_vals.append(_val)
            else:
                points.append(sum(w_vals)/len(w_vals))
                p_window = p_window + w_size
                w_vals = [_val]


    if len(w_vals) > 0:
        points.append(sum(w_vals)/len(w_vals))

    return points[0:size]
{'fraction_non_alphanumeric': 0.12175873731679819, 'fraction_numerical': 0.002254791431792559, 'mean_word_length': 2.4153846153846152, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2316347', 'n_tokens_mistral': 318, 'n_tokens_neox': 305, 'n_words': 71}