trackc.pl.bw_track#

trackc.pl.bw_track(bw, ax: Axes | None = None, regions: Sequence[str] | str | None = None, binsize: int | None = 50000, style: str | None = 'bar', summary_type: str | None = 'mean', vmin: float | None = None, vmax: float | None = None, primary_col: Sequence[str] | None = '#3271B2', secondary_col: Sequence[str] | None = '#FBD23C', alpha: float | None = 1.0, invert_y: bool | None = False, label: str | None = None, label_rotation: int | None = 0, label_fontsize: int | None = 9, tick_fontsize: int | None = 7, tick_fl: str | None = '%0.2f', ax_on: bool = False)[source]#

Plot bigwig signal track, support for multiple or reverse genome regions.

Parameters:
  • bw (pyBigWig.open query object, or bigwig file path) –

  • ax (matplotlib.axes.Axes object) –

  • regions (str | str list) – The genome regions to show the signal. e.g. "chr6:1000000-2000000" or ["chr6:1000000-2000000", "chr3:5000000-4000000", "chr5"] The start can be larger than the end (eg. "chr6:2000000-1000000"), which means the reverse region

  • binsize (int) – binsize divided to computing signal summary statistics

  • style (str) – plot type, default=’bar’, options=[‘bar’, ‘line’]

  • summary_type (str) – Summary type (mean, min, max, coverage, std), default ‘mean’.

  • vmin (float) – the minimum range of values used to define the ylim

  • vmax (float) – the maximum range of values used to define the ylim

  • primary_col (str) – the signal bar color

  • secondary_col (str) – the signal bar color for negative values

  • alpha (float) – alpha of plot color

  • invert_y (bool) – whether reverse the y-axis

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

  • label_rotation (int) – the label text rotation

  • label_fontsize (int) – the label text fontsize

  • tick_fontsize (int) – values range ticks text fontsize

  • tick_fl (str) – values range ticks retains a few decimal places

  • ax_on (bool) – whether show the spines

Example

>>> import trackc as tc
>>> import pyBigWig
>>> H3K27ac = pyBigWig.open('./GSM4604189.bigwig')
>>> ten = tc.tenon(figsize=(8,1))
>>> ten.add(pos='bottom', height=1, hspace=0.1)
>>> ten.add(pos='bottom', height=1, hspace=0.2)
>>> regions = ['chr8:127000000-129200000', 'chr14:96500000-99300000']
>>> tc.pl.bw_track(H3K27ac, ten.axs(0), regions=regions, vmax=20, label='H3K27ac', binsize=10000, primary_col='tab:blue')
>>> tc.pl.bw_track(H3K27ac, ten.axs(1), regions=regions, vmax=5, label='H3K27ac', binsize=10000, invert_y=True, ax_on=True)
>>> tc.savefig('trackc_bigwig_track.pdf')