trackc.pl.links_track#
- trackc.pl.links_track(ax: Axes | None = None, data: DataFrame | str | None = None, regions: Sequence[str] | str | None = None, links_type: str | None = 'arc', color: Sequence[str] | None = '#66AC84', maxrange: int | None = 3000000, invert_y: bool | None = False, anchor: str | None = 'inside', label: str | None = None, label_rotation: int | None = 0, label_fontsize: int | None = 12, ax_on: bool = False)[source]#
Plot loop arc, support for multiple or reverse genome regions.
- Parameters:
ax (
matplotlib.axes.Axesobject) –data (pd.DataFrame or path of loops file, the file should be no header.) – the file format expected is like this: chr1 x1 x2 chr2 y1 y2 the fields after the y2 will be ignored, recommend the result of juicer loop calling
regions (str | str list) – The genome regions to show the arc. 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 regionlinks_type (str) – Optional is [‘arc’]
color (str or str list) – the color of the arc links, if multiple regions, color para can set as list
maxrange (int) – The maximum distance between two anchor of loop, to filter loops if value is None, all loop will bed plotted
invert_y (bool) – whether reverse the y-axis
anchor (str) – Optional is [‘inside’, ‘outside’] inside: arc link x2 y1 outside: arc link x2 y1
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
ax_on (bool) – whether show the spines
Example
>>> import trackc as tc >>> regions = ['chr7:153000000-151000000', 'chr11:118500000-116500000']
>>> ten = tc.tenon(figsize=(8,1)) >>> ten.add(pos='bottom', height=1) >>> ten.add(pos='bottom', height=1, hspace=0.1) >>> ten.add(pos='bottom', height=0.4, hspace=0.1)
>>> loops='/path/ENCFF041XLP.bedpe' >>> tc.pl.links_track(ax=ten.axs(0), data=loops, label='GM12878', regions=regions, color=['#66AC84', 'tab:purple'], maxrange=3000000, anchor='inside') >>> tc.pl.links_track(ax=ten.axs(1), data=loops, label='GM12878', regions=regions, color='tab:purple', invert_y=True, anchor='outside', ax_on=True) >>> tc.pl.multi_scale_track(ten.axs(2), regions=regions, scale_adjust='Mb', intervals=1, tick_rotation=0, tick_fontsize=10, colors=['#66AC84', 'tab:purple']) >>> tc.savefig('trackc_links_track.pdf')