예제 #1
0
def plot_bpg_connection(ref_placements, prev_seg_index_is_adj, bpg_dict,
                        seg_end_pos_d):
    connect_width = bar_width / 2.
    for ind, refObj in ref_placements.items():
        next_ind = (ind + 1) % len(ref_placements)
        next_refObj = ref_placements[next_ind]
        if not prev_seg_index_is_adj[
                next_ind]:  # or next_ind == 0 to try and close
            bpg_adjacency = vu.pair_is_edge(refObj.id, next_refObj.id,
                                            refObj.direction,
                                            next_refObj.direction, bpg_dict,
                                            seg_end_pos_d)

            if not bpg_adjacency or ind == len(ref_placements) - 1:
                continue

            bpg_connector_len = next_refObj.abs_start_pos - refObj.abs_end_pos
            # makes the reference genome wedges
            patches.append(
                mpatches.Rectangle(
                    (refObj.abs_end_pos, ref_bar_height + bar_width / 4.),
                    bpg_connector_len, connect_width))
            f_color_v.append('grey')
            e_color_v.append('grey')
            lw_v.append(0.2)
예제 #2
0
def plot_bpg_connection(ref_placements, cycle, total_length,
                        prev_seg_index_is_adj, bpg_dict, seg_end_pos_d):
    connect_width = bar_width / 2.
    for ind, refObj in ref_placements.items():
        next_ind = (ind + 1) % len(ref_placements)
        next_refObj = ref_placements[next_ind]
        if not prev_seg_index_is_adj[
                next_ind]:  # or next_ind == 0 to try and close
            bpg_adjacency = vu.pair_is_edge(refObj.id, next_refObj.id,
                                            refObj.direction,
                                            next_refObj.direction, bpg_dict,
                                            seg_end_pos_d)

            if not bpg_adjacency:
                continue

            start_angle, end_angle = start_end_angle(next_refObj.abs_start_pos,
                                                     refObj.abs_end_pos,
                                                     total_length)
            # makes the reference genome wedges
            patches.append(
                mpatches.Wedge((0, 0),
                               outer_bar - bar_width / 4,
                               end_angle,
                               start_angle,
                               width=connect_width))
            f_color_v.append('grey')
            e_color_v.append('grey')
            lw_v.append(0.2)