lib5c.plotters.extendable.motif_extendable_heatmap module¶
Module for the MotifExtendableHeatmap class, which adds motif track plotting functionality for the extendable heatmap system.
-
class
lib5c.plotters.extendable.motif_extendable_heatmap.
MotifExtendableHeatmap
(array, grange_x, grange_y=None, colorscale=None, colormap='obs', norm=None)[source]¶ Bases:
lib5c.plotters.extendable.base_extendable_heatmap.BaseExtendableHeatmap
ExtendableHeatmap mixin class providing motif track plotting functionality.
-
add_motif_track
(motifs, loc='bottom', size='3%', pad=0.0, name='motif', axis_limits=(0, 1), intron_height=0.05, motif_linewidth=1, exon_height=0.5, colors=None, track_label=None)[source]¶ Adds one motif track along either the x- or y-axis of the heatmap.
Parameters: - motifs (list of dict) –
Each dict should represent a motif instance and could have the following keys:
{ 'chrom' : str, 'start' : int, 'end' : int, 'strand': '+' or '-' }
- loc ({'top', 'bottom', 'left', 'right'}) – Which side of the heatmap to add the new motif track to.
- size (str) – The size of the new axis as a percentage of the main heatmap width. Should be passed as a string ending in ‘%’.
- pad (float) – The padding to use between the existing parts of the figure and the newly added axis.
- name (str) – Base name for the new axis. This name will be prefixed with the orientation of the track (‘vertical’ or ‘horizontal’).
- axis_limits (tuple of float) – Axis limits for the non-genomic axis of the motif track.
- intron_height (float) – Controls height of the rectangle spanning the length of the motif.
- motif_linewidth (float) – The linewidth to use when plotting.
- exon_height (float) – Controls the size of the arrowhead that indicates the motif orientation.
- colors (dict, optional) – Map from the value of the ‘strand’ key in the
motifs
dicts (usually ‘+’ or ‘-‘) to color name for motifs with that strand value (i.e., orientation). If not provided for a given strand, color is black by default. - track_label (str, optional) – Pass a string to label the track.
Returns: The newly added motif track axis.
Return type: pyplot axis
- motifs (list of dict) –
-
add_motif_tracks
(motifs, size='3%', pad=0.0, axis_limits=(0, 1), intron_height=0.05, exon_height=0.5, name='motif', motif_linewidth=1, colors=None, track_label=None)[source]¶ Adds motif tracks for a single set of motifs to both the bottom and left side of the heatmap by calling
add_motif_track()
twice.Parameters: - motifs (list of dict) –
Each dict should represent a motif instance and could have the following keys:
{ 'chrom' : str, 'start' : int, 'end' : int, 'strand': '+' or '-' }
- size (str) – The size of the new axis as a percentage of the main heatmap width. Should be passed as a string ending in ‘%’.
- pad (float) – The padding to use between the existing parts of the figure and the newly added axis.
- axis_limits (tuple of float) – Axis limits for the non-genomic axis of the motif track.
- intron_height (float) – Controls height of the rectangle spanning the length of the motif.
- exon_height (float) – Controls the size of the arrowhead that indicates the motif orientation.
- name (str) – Base name for the new axis. This name will be prefixed with the orientation of the track (‘vertical’ or ‘horizontal’).
- motif_linewidth (float) – The linewidth to use when plotting.
- colors (dict, optional) – Map from the value of the ‘strand’ key in the
motifs
dicts (usually ‘+’ or ‘-‘) to color name for motifs with that strand value (i.e., orientation). If not provided for a given strand, color is black by default. - track_label (str, optional) – Pass a string to label the track.
Returns: The newly added motif track axes.
Return type: list of pyplot axes
- motifs (list of dict) –
-