trackc.pl.mapC#

trackc.pl.mapC(ax: ~matplotlib.axes._axes.Axes | None = None, mat: ~numpy.ndarray | None = None, mat2: ~numpy.ndarray | None = None, cmap: ~typing.Sequence[~matplotlib.colors.Colormap] | ~typing.Sequence[str] | ~matplotlib.colors.Colormap | str | None = [<matplotlib.colors.LinearSegmentedColormap object>, 'YlOrRd'], label: ~typing.Sequence[str] | str | None = None, label_fontsize: ~typing.Sequence[int] | int = 10, label_color: ~typing.Sequence[str] | str | None = 'k', logdata: ~typing.Sequence[bool] | bool = False, maxrange: ~typing.Sequence[float] | float | None = None, minrange: ~typing.Sequence[float] | float | None = None, trim_range: ~typing.Sequence[float] | float = 0.98, map_type: str | None = 'triangle', height: int = 0, trans_ax: bool = False, symmetric: bool = False, ax_on: bool = True, aspect: str | float = 'auto')[source]#

Plot contact map, support for multiple or reverse genome regions. This function implements the plot method for np.ndarray, which could get from trackc.tl.extractCisContact or trackc.tl.extractContactRegions By default, the trim_range value is fixed so that the 98th percentile (resp. 2th percentile) of each interaction matrix is discarded. It therefore allow to remove the extreme values from the matrix, mat or mat2 is plotted independently If the maxrange parameter is set, data higher that this threshold will be fixed to the maxrange value.

cmap, label, label_fontsize, label_color, logdata, minrange, maxrange, trim_range, those parameters can be set as a list, mat and mat2 will set to the first two values. If those parameters are one single value or the length of list is one, then mat and mat2 both set the same value

Parameters:
  • ax (matplotlib.axes.Axes object) –

  • mat (np.ndarray) – matrix for plot upper or right of heatmap

  • mat2 (np.ndarray) – matrix for plot bottom or left of heatmap

  • cmap (str | matplotlib.colors.Colormap | list) – colormap for continuous annotations, if set as list, mat and mat2 will set to the first two values

  • label (str) – the title of the track, will show on the left

  • label_fontsize (int) – the label text fontsize

  • label_color (str) – the label text color

  • logdata (bool | bool list) – do you want to log the data before plotting the heatmap

  • minrange (float | float list) – the minimum range of values used to define the color palette

  • maxrange (float | float list) – the maximum range of values used to define the color palette

  • trim_range (float | float list) – remove the extreme values by trimming the counts.[0,1] define the maxrange and minrange values using the percentile of the interaction matrix

  • map_type (str) – optional is [‘square’, ‘squ’, ‘triangle’, ‘tri’, ‘rectangle’, ‘rec’], default is square que is the same as square, tri is the same as triangle, rec is the same as rectangle. triangle and rectangle default is flip the image 45 degrees to the left. for rectangle type, the corresponding length of height will be truncated from both ends of the input matrix.

  • height (int) – if map_type is one of [‘triangle’, ‘rectangle’], height indicates the longest interaction bin interval you want to show

  • trans_ax (bool) – whether flip the image 45 degrees to the right

  • symmetric (bool) – whether to display a symmetrical heatmap when only one of mat and mat2 is set

  • ax_on (bool) – whether show the spines

  • aspect (str | float) – optional is ‘auto’ or 1 length-width ratio of heatmap

Example

>>> import trackc as tc
>>> import cooler
>>> BxPC3 = cooler.Cooler('./BxPC3.chr18.mcool::/resolutions/25000')
>>> neo_domain_regions = ['18:47950000-48280000', '18:75280000-74850000']
>>> tumor_zoom = tc.tl.extractContactRegions(clr=BxPC3, row_regions=neo_domain_regions)
>>> ten = tc.tenon(figsize=(6,1))
>>> ten.add(pos='bottom', height=0.7, hspace=0.05)
>>> tc.pl.mapC(ax=ten.axs(0), mat=tumor_zoom.cmat, map_type='tri',
        maxrange=200, minrange=10, label='tumor res=25k', ax_on=False, height=40)
>>> tc.savefig('trackc_mapc.pdf')