API Reference
EntroPlots.apply_count_filterEntroPlots.count_fragmentsEntroPlots.filter_counts_by_referenceEntroPlots.get_rectangle_basicEntroPlots.logoplotEntroPlots.logoplot_with_highlightEntroPlots.logoplot_with_rect_gapsEntroPlots.reduce_entropy!EntroPlots.save_logo_with_rect_gapsEntroPlots.save_logoplot
Plotting
EntroPlots.logoplot — Function
logoplot(pfm[, background]; kwargs...)Render a sequence logo from a position frequency matrix.
Arguments
pfm: position frequency matrix (4 × Nfor DNA/RNA,20 × Nfor protein), each column summing to 1.background: optional background frequencies (length 4 for nucleotides, 20 for protein). Defaults to a uniform background.
Keyword arguments
protein::Bool=false: treat the PFM as a 20-row amino-acid matrix.rna::Bool=false: useA, C, G, Uglyphs instead ofA, C, G, T.tight::Bool=false: use tight plot limits (drops padding around the logo).xaxis,yaxis: toggle axis display.alpha,beta: glyph transparency and width scaling.uniform_color::Bool=false: use a single color for all glyphs.scale_by_frequency::Bool=false: scale letters by frequency only (stack to full height) instead of by information content.dpi,_margin_,pos,xrotation, and additional styling parameters are also accepted.
See also logoplot_with_highlight and save_logoplot.
EntroPlots.logoplot_with_highlight — Function
logoplot_with_highlight(pfm, background, highlighted_regions; kwargs...)Plot a sequence logo with specific regions highlighted.
Arguments
pfm: Position frequency matrixbackground: Background frequencieshighlighted_regions: Vector of UnitRange{Int} specifying positions to highlightscale_by_frequency::Bool=false: If true, scale letters by frequency only (stack to full height)- Additional keyword arguments for customization
logoplot_with_highlight(pfm, highlighted_regions; kwargs...)Plot a sequence logo with highlighted regions using default background frequencies.
EntroPlots.save_logoplot — Function
save_logoplot(pfm, background, save_name; kwargs...)Save a sequence logo plot to a file.
Arguments
pfm::Matrix{Real}: Position frequency matrix (rows = characters, columns = positions)background::Vector{Real}: Background probabilities for each charactersave_name::String: File path to save the plotscale_by_frequency::Bool=false: If true, scale letters by frequency only (stack to full height)
Requirements
pfmmust be a probability matrix (each column sums to 1)backgroundmust be a vector of probabilities that sum to 1- For nucleotides:
backgroundlength = 4; for proteins: length = 20
Example
pfm = [0.02 1.0 0.98 0.0; 0.98 0.0 0.02 0.19; ...]
background = [0.25, 0.25, 0.25, 0.25]
save_logoplot(pfm, background, "logo.png"; dpi=65)save_logoplot(pfm, save_name; kwargs...)Save a sequence logo plot using default background frequencies.
This is equivalent to save_logoplot(pfm, background, save_name; kwargs...) where background is set to uniform frequencies for the sequence type.
PFM utilities
EntroPlots.reduce_entropy! — Function
reduce_entropy!(pfm; factor=10)Sharpen each column of a PFM toward its dominant symbol, in place.
Each column is raised element-wise to the power factor and then renormalized to sum to 1. Larger factor values make the dominant symbol more overwhelming (lower entropy); factor=1 leaves the column unchanged. Useful for cleaning up noisy protein PFMs before plotting.
Count-matrix filtering
Utilities for working with count matrices and reference sequences — used to keep only the columns that deviate from a reference before plotting.
EntroPlots.filter_counts_by_reference — Function
filter_counts_by_reference(counts, ref; tol=1e-9)Keep only columns where dot(col, ref_col) ≠ sum(col). When equal, the column has single nonzero entry matching reference → remove it. Returns indices of columns to keep.
EntroPlots.count_fragments — Function
count_fragments(count_matrices, reference_pfms, starting_indices; tol=1e-9)
count_fragments(count_matrices, reference_pfms; tol=1e-9)Filter count matrices by reference and report the resulting contiguous fragments.
Returns (total_fragments::Int, span::String), where span is a human-readable description of the fragments in global coordinates. Without starting_indices, each matrix is assumed to start at position 1.
Span examples:
- single column at 45 -> "45"
- columns 45-48 -> "45-48"
- two fragments at 45 and 51-55 -> "(45, 51-55)"
EntroPlots.apply_count_filter — Function
apply_count_filter(count_matrices, starting_indices, reference_pfms; tol=1e-9)Filter count matrices by reference, returning new matrices with only non-matching columns. Updates starting indices to reflect new fragment positions.
Legacy: gapped / spacer logos
These functions render multiple logo fragments along a track, joined by rectangular connectors. They are retained for downstream packages.
EntroPlots.logoplot_with_rect_gaps — Function
logoplot_with_rect_gaps(count_matrices, starting_indices, total_length; kwargs...)Plot several logo fragments positioned along a track of length total_length, joined by rectangular connector glyphs across the gaps between them.
count_matrices is a vector of per-fragment count/frequency matrices and starting_indices gives each fragment's starting position on the track. When reference_pfms (a vector of column-wise one-hot BitMatrix) is supplied and filter_by_reference=true, columns that match the reference are dropped via apply_count_filter before plotting.
Notable keyword arguments
reference_pfms=nothing,filter_by_reference=true,filter_tolerance=1e-9: reference-based column filtering.ref_match_color,ref_mismatch_color: colors for reference-matching / mismatching letters.rna,protein,uniform_color,dpi,xrotation,height_top,arrow_shape_scale_ratio,basic_fcn: styling of the logos and connectors.
See also save_logo_with_rect_gaps.
EntroPlots.save_logo_with_rect_gaps — Function
save_logo_with_rect_gaps(count_matrices, starting_indices, total_length, save_name; kwargs...)Render a gapped multi-fragment logo (see logoplot_with_rect_gaps) and save it to save_name. The output format is inferred from the file extension. Accepts the same keyword arguments as logoplot_with_rect_gaps, including reference-based column filtering.
EntroPlots.get_rectangle_basic — Function
get_rectangle_basic(; line_scale=1.0, right=true, x_offset=0.0)Return the basic rectangular arrow-shaft shape used as the connector glyph between logo fragments in the gap/spacer plots. line_scale scales its length, right orients the arrow head, and x_offset shifts it horizontally. Used as the default basic_fcn for logoplot_with_rect_gaps and save_logo_with_rect_gaps.