Visualization Module

This module provides visualization tools for genomic analysis, including genome-wide symbol frequency plots, skew diagrams for replication origin estimation, and motif logos to represent conservation across aligned DNA motifs.

Symbol array

GenomeVisualizer.visualization.plot_symbol_array(symbol_array: dict[int, int], symbol: str, genome_label: str = 'genome') None[source]

Plots the symbol frequency array across the genome.

This function visualizes the number of occurrences of a specified nucleotide in a sliding window (typically of size genome_length/2), showing variation in composition across the genome.

Parameters:
  • symbol_array (dict[int, int]) – Dictionary mapping genome positions to the count of a symbol in the sliding window.

  • symbol (str) – The nucleotide symbol (‘A’, ‘C’, ‘G’, or ‘T’) used for counting.

  • genome_label (str, optional) – Label for the genome, used in the figure title. Default is “genome”.

Returns:

The function displays the plot using matplotlib.

Return type:

None

Example

>>> arr = FasterSymbolArray(genome, 'C')
>>> plot_symbol_array(arr, 'C', genome_label="E. coli")

Skew array

GenomeVisualizer.visualization.plot_skew_array_with_ori(skew: list[int], ori_positions: list[int], genome_label: str = 'genome') None[source]

Plots the skew array and highlights the estimated origin(s) of replication.

Parameters:
  • skew (list[int]) – Skew values computed across the genome.

  • ori_positions (list[int]) – Positions where the skew reaches its minimum (possible ori sites).

  • genome_label (str, optional) – Name of the genome to show in the title. Default is “genome”.

Returns:

The function displays the plot using matplotlib.

Return type:

None

Example

>>> skew = SkewArray(genome)
>>> ori_pos = MinimumSkew(genome)
>>> plot_skew_array_with_ori(skew, ori_pos, genome_label="E. coli")