Exemple #1
0
def get_line_x_axis(data, width, padding):
    sam = next(iter(data))
    minimum = min([x[0] for x in data[sam]]) - 1
    maximum = max([x[0] for x in data[sam]]) + 1
    return scale.axis([minimum, maximum], [padding, width - padding],
                      "Site Number",
                      tic_values=[x for x in range(minimum + 1, maximum)])
def get_x_axis(pop_data, width, padding):
    minimum = 0
    maximum = math.ceil(max(pop_data.keys())) + 1

    return scale.axis([minimum, maximum], [padding, width - padding],
                      "Copy Number",
                      tics=8)
Exemple #3
0
def get_normalised_y_axis(sample_data, cols, height, padding):
    hap = sample_data["Median_depth"] / 2
    all_data = sample_data[cols[0]] + sample_data[cols[1]]
    mapped_data = [(x[1] / hap) for x in all_data]
    max_val = math.ceil(max(mapped_data))

    return scale.axis([0, max_val], [padding, height - padding], "Approx. CN", tics=4)
Exemple #4
0
def get_bar_y_axis(norm_y_axis, sample_data):
    hap = sample_data["Median_depth"] / 2
    min_val = norm_y_axis["min"] * hap
    max_val = norm_y_axis["max"] * hap
    tics = [round(x * hap) for x in norm_y_axis["tics"]]

    return scale.axis([min_val, max_val], norm_y_axis["domain"], "Read Count", tic_values=tics)
Exemple #5
0
def get_bar_x_axis(sample_data, cols, width, padding):
    length = len(sample_data[cols[0]])
    for col in cols:
        assert len(sample_data[col]) == length

    data = [x[0] for x in sample_data[cols[0]]]
    x_min = min(data) - 1
    x_max = max(data) + 1

    return scale.axis(
        [x_min, x_max],
        [padding, width - padding],
        "Site Number",
        tic_values=[x for x in range(x_min + 1, x_max)]
    )
Exemple #6
0
def get_line_y_axis(data, height, padding):
    max_val = None
    min_val = None
    for sample_id in data:
        sample_min = min([x[1] for x in data[sample_id]]) - 1
        sample_max = max([x[1] for x in data[sample_id]]) + 1

        if max_val is None or max_val < sample_max:
            max_val = sample_max
        if min_val is None or min_val > sample_min:
            min_val = sample_min

    if min_val < 0:
        min_val = 0

    return scale.axis(
        [math.floor(min_val), math.ceil(max_val)], [padding, height - padding],
        "Raw CN",
        tics=6)
def get_y_axis(pop_data, height, padding):
    minimum = 0
    maximum = math.ceil(max(pop_data.values())) + 1

    return scale.axis([minimum, maximum], [padding, height - padding],
                      "Sample Count")