trackc.pl.bed_track#
- trackc.pl.bed_track(ax: Axes | None = None, bed: DataFrame | str | None = None, regions: Sequence[str] | str | None = None, style: str | None = 'bar', primary_col: Sequence[str] | None = '#3271B2', secondary_col: Sequence[str] | None = '#FBD23C', cmap: Colormap | str | None = None, intervals: int | None = 1, alpha: float | None = 1, invert_y: bool | None = False, label: str | None = None, label_fontsize: int | None = 12, label_rotation: int | None = 0, vmin: float | None = None, vmax: float | None = None, tick_fontsize: int | None = 8, tick_fl: str | None = '%0.2f', score_label_size: int | None = 7)[source]#
Plot bed track, support for multiple or reverse genome regions. support bed3 and bed5, the fields after the column5 will be ignored, should be sorted py chromStart if
styleis line- Parameters:
ax (
matplotlib.axes.Axesobject) –bed (pd.DataFrame | str) –
If
bedif a filepath, the file should have no headers.- Here is bed formats:
- column1: chrom
The name of the chromosome (e.g. chr3, chrY, chr2_random) or scaffold (e.g. scaffold10671).
- column2: chromStart
The starting position of the feature in the chromosome or scaffold. The first base in a chromosome is numbered 0.
- column3: chromEnd
The ending position of the feature in the chromosome or scaffold.
- column4: name
Defines the name of the BED line. Either “.” (=no name), or other string
- column5: score
Defines the name of the BED line. if nessasary, can be set as
., if track_type/style is one of bar/line- column6: strand
Defines the strand. Either “.” (=no strand) or “+” or “-“.
if the input data have 4 columns, then default input is bedGraph format: [chrom start end score]
regions (str | str list) –
The genome regions to plot. e.g.
"chr6:1000000-2000000"or["chr6:1000000-2000000", "chr3:5000000-4000000"]The start can be larger than the end (e.g.
"chr6:2000000-1000000"), which means you want to get the reverse regionstyle (str) – bed blocks style, opions in [‘line’, ‘bar’, ‘link’, ‘tri’, ‘rec’]
primary_col (str) – the color of line/tri/rec, if color is color list, the block color will set by regions
secondary_col (str) – the color of line/tri/rec for negative values
cmap (str | matplotlib.colors.Colormap) – the colormap of the plot except style:line
intervals (int) – if style is one of [tri, rec], the row number distribution for triangle or rectangle blocks
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_fontsize (int) – the label text fontsize
label_rotation (int) – the label text rotation
vmin (float) – the minimum range of values used to define the ylim
vmax (float) – the maximum range of values used to define the ylim
tick_fontsize (int) – values range ticks text fontsize
tick_fl (str) – values range ticks retains a few decimal places
score_label_size (int) – score colorbar label fontsize