crested.pl.modisco.selected_instances

crested.pl.modisco.selected_instances#

crested.pl.modisco.selected_instances(pattern_dict, idcs, ax=None, **kwargs)#

Plot the patterns specified by the indices in idcs from the pattern_dict.

Parameters:
  • pattern_dict (dict) – A dictionary containing pattern data. Each key corresponds to a pattern ID, and the value is a nested structure containing contribution scores and metadata for the pattern. Refer to the output of crested.tl.modisco.process_patterns.

  • idcs (list[int]) – An index or list of indices specifying which patterns to plot. The indices correspond to keys in the pattern_dict.

  • ax (Axes | None (default: None)) – An axis to plot the instance on. Only works if providing a single value for idcs.

  • width – Width of the newly created figure if ax=None. Default is 8.

  • height – Height of the newly created figure if ax=None. Default is 2*`len(idcs)`.

  • sharex – Whether to share the x axes of the created plots. Default is False.

  • sharey – Whether to share the y axes of the created plots. Default is False.

  • kwargs – Additional arguments passed to render_plot() to control the final plot output. Please see render_plot() for details. Defaults for selected_instances: title=[pattern_dict[str(idx)]["pattern"]["id"] for idx in idcs].

Return type:

tuple[Figure, Axes] | tuple[Figure, list[Axes]] | None

Examples

>>> pattern_indices = [0, 1, 2]
>>> crested.pl.modisco.selected_instances(pattern_dict, pattern_indices)
../../_images/modisco_selected_instances.png