tfmindi.pl.dbd_cluster_logos

tfmindi.pl.dbd_cluster_logos#

tfmindi.pl.dbd_cluster_logos(patterns, dbd_name, ic_threshold=0.2, min_nucleotides=4, ncols=None, sort_by='ic', **kwargs)#

Create a subplot grid showing sequence logos for all clusters of a specific DBD.

This function filters patterns by the specified DBD and creates one subplot per cluster/pattern, showing the diversity of motifs within that domain.

Parameters:
  • patterns (dict[str, Pattern]) – Dictionary mapping cluster IDs to Pattern objects with DBD annotations.

  • dbd_name (str) – Name of the DNA-binding domain to display (e.g., “bHLH”, “Homeobox”). Only patterns with this DBD annotation will be shown.

  • ic_threshold (float (default: 0.2)) – Information content threshold for logo trimming.

  • min_nucleotides (int (default: 4)) – Minimum number of nucleotides required after trimming to show logo. Patterns with fewer nucleotides will be skipped.

  • ncols (int | None (default: None)) – Number of columns in the subplot grid. If None, automatically determined based on the number of patterns (aim for roughly square grid).

  • sort_by (str (default: 'ic')) – How to sort the patterns in the grid. Options: - “ic”: Sort by average information content (descending) - “n_seqlets”: Sort by number of seqlets (descending) - “cluster_id”: Sort by cluster ID (ascending)

  • **kwargs – Additional arguments passed to render_plot() for styling and display options. Common options include title, show, save_path, dpi.

Return type:

Figure | None

Returns:

Figure with logo subplot grid, or None if show=True.

Examples

>>> import tfmindi as tm
>>> # After clustering and creating patterns with DBD annotations
>>> patterns = tm.tl.create_patterns(adata)
>>> # Show all bHLH patterns
>>> fig = tm.pl.dbd_cluster_logos(patterns, "bHLH", title="bHLH Motif Variants")
>>> # Custom layout and sorting
>>> tm.pl.dbd_cluster_logos(patterns, "Homeobox", ncols=4, sort_by="n_seqlets", save_path="homeobox_variants.png")