lib5c.plotters.extendable.chipseq_extendable_heatmap module

Module for the ChipSeqExtendableHeatmap class, which adds ChIP-seq track plotting functionality for the extendable heatmap system.

class lib5c.plotters.extendable.chipseq_extendable_heatmap.ChipSeqExtendableHeatmap(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 ChIP-seq track plotting functionality.

add_chipseq_track(features, loc='bottom', size='10%', pad=0.05, axis_limits=None, linewidth=0.4, name='chipseq', color='k', track_label=None)[source]

Adds one ChIP-seq track along either the x- or y-axis of the heatmap.

Parameters
  • features (list of dict) –

    Each feature should be a dict with at least the following keys:

    {
        'chrom': str,
        'start': int,
        'end': int,
        'value': float
    }
    

    Each feature will be drawn as a rectangle on the heatmap from ‘start’ to ‘end’ with height ‘value’. If the ‘value’ key is missing, it will be assumed to be one for all features. To get data in this form from bigwig files, consult lib5c.contrib.pybigwig.bigwig.BigWig.query().

  • loc ({'top', 'bottom', 'left', 'right'}) – Which side of the heatmap to add the new ChIP-seq 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.

  • axis_limits (tuple of float, optional) – Axis limits for the ‘value’ of the plotted features (heights of the rectangles) as a (min, max) tuple. Pass None to automatically scale the axis limits.

  • linewidth (float) – The linewidth to use when drawing the rectangles. Pass smaller values for sharper features/peaks.

  • name (str) – Base name for the new axis. This name will be prefixed with the orientation of the track (‘vertical or ‘horizontal’).

  • color (matplotlib color) – The color to draw the rectangles with.

  • track_label (str, optional) – Pass a string to label the track.

Returns

The newly added ChIP-seq track axis.

Return type

pyplot axis

add_chipseq_tracks(features, size='10%', pad=0.05, axis_limits=None, linewidth=0.4, name='chipseq', color='k', track_label=None)[source]

Adds ChIP-seq tracks for a single set of features to both the bottom and left side of the heatmap by calling add_chipseq_track() twice.

Parameters
  • features (list of dict) –

    Each feature should be a dict with at least the following keys:

    {
        'chrom': str,
        'start': int,
        'end': int,
        'value': float
    }
    

    Each feature will be drawn as a rectangle on the heatmap from ‘start’ to ‘end’ with height ‘value’. If the ‘value’ key is missing, it will be assumed to be one for all features. To get data in this form from bigwig files, consult lib5c.contrib.pybigwig.bigwig.BigWig.query().

  • 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, optional) – Axis limits for the ‘value’ of the plotted features (heights of the rectangles) as a (min, max) tuple. Pass None to automatically scale the axis limits.

  • linewidth (float) – The linewidth to use when drawing the rectangles. Pass smaller values for sharper features/peaks.

  • name (str) – Base name for the new axis. This name will be prefixed with the orientation of the track (‘vertical’ or ‘horizontal’).

  • color (matplotlib color) – The color to draw the rectangles with.

  • track_label (str, optional) – Pass a string to label the track.

Returns

The newly added ChIP-seq track axes.

Return type

list of pyplot axes