Esempio n. 1
0
def draw_dna_connections(dna_helix_graph: nx.DiGraph,
                         nucleotide_plots: Dict[Nucleotide, _NUCLEOTIDE_PLOT],
                         subplot: plt_axes.Subplot,
                         verbosity: int = 0):
    """
    Draw dna connections on given subplot according to verbosity level

    Parameters
    ----------
    dna_helix_graph
        directed graph with nucleotides as nodes
    nucleotide_plots
        mapping of nucleotide to its plot
    subplot
        subplot to draw on
    verbosity
        verbosity of the visualization;
        if verbosity == 0, then only the connections between
        nucleotide are drawn, otherwise connections between nucleotide keys
        are drawn
    """
    nucleotide_positions = {
        each_nucleotide: each_nucleotide_plot.body.center
        for each_nucleotide, each_nucleotide_plot in nucleotide_plots.items()}
    _draw_dna_connections(
        subplot, dna_helix_graph, nucleotide_positions, nucleotide_plots,
        verbosity=verbosity)
    subplot.add_callback(
        partial(_draw_dna_connections,
                dna_helix_graph=dna_helix_graph,
                nucleotide_positions=nucleotide_positions,
                nucleotide_plots=nucleotide_plots, verbosity=verbosity))