Track Class
Track
Circos Track Class
PARAMETER | DESCRIPTION |
---|---|
name |
Track name
TYPE:
|
r_lim |
Track radius limit region
TYPE:
|
r_pad_ratio |
Track padding ratio for plot data
TYPE:
|
parent_sector |
Parent sector of track
TYPE:
|
r_plot_lim
property
Track radius limit for plot data (r_lim
with padding)
x_to_rad
Convert x coordinate to radian in track start-end range
PARAMETER | DESCRIPTION |
---|---|
x |
X coordinate
TYPE:
|
ignore_range_error |
Ignore x coordinate range error
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
rad
|
Radian coordinate
TYPE:
|
axis
Plot axis
By default, simple black axis params(fc="none", ec="black", lw=0.5
) are set.
PARAMETER | DESCRIPTION |
---|---|
**kwargs |
Patch properties (e.g.
TYPE:
|
text
text(
text: str,
x: float | None = None,
r: float | None = None,
*,
adjust_rotation: bool = True,
orientation: str = "horizontal",
ignore_range_error: bool = False,
**kwargs
) -> None
Plot text
PARAMETER | DESCRIPTION |
---|---|
text |
Text content
TYPE:
|
x |
X position. If None, track center x position is set.
TYPE:
|
r |
Radius position. If None, track center radius position is set.
TYPE:
|
adjust_rotation |
If True, text rotation is auto set based on
TYPE:
|
orientation |
Text orientation (
TYPE:
|
ignore_range_error |
If True, ignore x position range error
(ErrorCase:
TYPE:
|
**kwargs |
Text properties (e.g.
TYPE:
|
rect
rect(
start: float,
end: float,
*,
r_lim: tuple[float, float] | None = None,
ignore_pad: bool = False,
**kwargs
) -> None
Plot rectangle
PARAMETER | DESCRIPTION |
---|---|
start |
Start position (x coordinate)
TYPE:
|
end |
End position (x coordinate)
TYPE:
|
r_lim |
Radius limit range.
If None,
TYPE:
|
ignore_pad |
If True, ignore track padding setting.
If
TYPE:
|
**kwargs |
Patch properties (e.g.
TYPE:
|
arrow
arrow(
start: float,
end: float,
*,
r_lim: tuple[float, float] | None = None,
head_length: float = 2,
shaft_ratio: float = 0.5,
**kwargs
) -> None
Plot arrow
PARAMETER | DESCRIPTION |
---|---|
start |
Start position (x coordinate)
TYPE:
|
end |
End position (x coordinate)
TYPE:
|
r_lim |
Radius limit range. If None,
TYPE:
|
head_length |
Arrow head length (Degree unit)
TYPE:
|
shaft_ratio |
Arrow shaft ratio (0 - 1.0)
TYPE:
|
**kwargs |
Patch properties (e.g.
TYPE:
|
xticks
xticks(
x: list[int] | list[float] | np.ndarray,
labels: list[str] | None = None,
*,
tick_length: float = 2,
outer: bool = True,
show_bottom_line: bool = False,
label_size: float = 8,
label_margin: float = 0.5,
label_orientation: str = "horizontal",
line_kws: dict[str, Any] | None = None,
text_kws: dict[str, Any] | None = None
) -> None
Plot xticks & labels on user-specified position
If you want to plot xticks and their position labels at regular intervals,
it is recommended to use track.xticks_by_interval()
instead.
PARAMETER | DESCRIPTION |
---|---|
x |
X coordinates
TYPE:
|
labels |
Labels on xticks. If None, only plot ticks line.
TYPE:
|
tick_length |
Tick length (Radius unit)
TYPE:
|
outer |
If True, show ticks on outer. If False, show ticks on inner.
TYPE:
|
show_bottom_line |
If True, show bottom line.
TYPE:
|
label_size |
Label size
TYPE:
|
label_margin |
Label margin size
TYPE:
|
label_orientation |
Label orientation (
TYPE:
|
line_kws |
Patch properties (e.g.
TYPE:
|
text_kws |
Text properties (e.g.
TYPE:
|
xticks_by_interval
xticks_by_interval(
interval: int | float,
*,
tick_length: float = 2,
outer: bool = True,
show_bottom_line: bool = False,
show_label: bool = True,
show_endlabel: bool = True,
label_size: float = 8,
label_margin: float = 0.5,
label_orientation: str = "horizontal",
label_formatter: Callable[[float], str] | None = None,
line_kws: dict[str, Any] | None = None,
text_kws: dict[str, Any] | None = None
) -> None
Plot xticks & position labels by user-specified interval
track.xticks_by_interval()
is high-level API function of track.xticks()
.
If you want to plot xticks and their labels in any position you like,
use track.xticks()
instead.
PARAMETER | DESCRIPTION |
---|---|
interval |
Xticks interval
TYPE:
|
tick_length |
Tick length (Radius unit)
TYPE:
|
outer |
If True, show ticks on outer. If False, show ticks on inner.
TYPE:
|
show_bottom_line |
If True, show bottom line.
TYPE:
|
show_label |
If True, show label of xticks interval position.
TYPE:
|
show_endlabel |
If False, no display end xtick label. Used to prevent overlap of start-end xtick labels.
TYPE:
|
label_size |
Label size
TYPE:
|
label_margin |
Label margin size
TYPE:
|
label_orientation |
Label orientation (
TYPE:
|
label_formatter |
User-defined function for label format. (e.g.
TYPE:
|
line_kws |
Patch properties (e.g.
TYPE:
|
text_kws |
Text properties (e.g.
TYPE:
|
yticks
yticks(
y: list[int] | list[float] | np.ndarray,
labels: list[str] | None = None,
*,
vmin: float = 0,
vmax: float | None = None,
side: str = "right",
tick_length: float = 1,
label_size: float = 8,
label_margin: float = 0.5,
line_kws: dict[str, Any] | None = None,
text_kws: dict[str, Any] | None = None
) -> None
Plot yticks & labels on user-specified position
PARAMETER | DESCRIPTION |
---|---|
y |
Y coordinates
TYPE:
|
labels |
Labels on yticks. If None, only plot ticks line.
TYPE:
|
vmin |
Y min value
TYPE:
|
vmax |
Y max value. If None,
TYPE:
|
side |
Ticks side position (
TYPE:
|
tick_length |
Tick length (Degree unit)
TYPE:
|
label_size |
Label size
TYPE:
|
label_margin |
Label margin size
TYPE:
|
line_kws |
Patch properties (e.g.
TYPE:
|
text_kws |
Text properties (e.g.
TYPE:
|
grid
Plot grid
By default, color="grey", alpha=0.5, zorder=0
line params are set.
PARAMETER | DESCRIPTION |
---|---|
y_grid_num |
Y-axis grid line number. If None, y-axis grid line is not shown.
TYPE:
|
x_grid_interval |
X-axis grid line interval. If None, x-axis grid line is not shown.
TYPE:
|
**kwargs |
Axes.plot properties (e.g.
TYPE:
|
line
line(
x: list[float] | np.ndarray,
y: list[float] | np.ndarray,
*,
vmin: float = 0,
vmax: float | None = None,
arc: bool = True,
**kwargs
) -> None
Plot line
PARAMETER | DESCRIPTION |
---|---|
x |
X coordinates
TYPE:
|
y |
Y coordinates
TYPE:
|
vmin |
Y min value
TYPE:
|
vmax |
Y max value. If None,
TYPE:
|
arc |
If True, plot arc style line for polar projection. If False, simply plot linear style line.
TYPE:
|
**kwargs |
Axes.plot properties (e.g.
TYPE:
|
scatter
scatter(
x: list[float] | np.ndarray,
y: list[float] | np.ndarray,
*,
vmin: float = 0,
vmax: float | None = None,
**kwargs
) -> None
Plot scatter
PARAMETER | DESCRIPTION |
---|---|
x |
X position list
TYPE:
|
y |
Y position list
TYPE:
|
vmin |
Y min value
TYPE:
|
vmax |
Y max value. If None,
TYPE:
|
**kwargs |
Axes.scatter properties (e.g.
TYPE:
|
bar
bar(
x: list[float] | np.ndarray,
height: list[float] | np.ndarray,
width: float = 0.8,
bottom: float | list[float] | np.ndarray = 0,
align: str = "center",
*,
vmin: float = 0,
vmax: float | None = None,
**kwargs
) -> None
Plot bar
PARAMETER | DESCRIPTION |
---|---|
x |
Bar x coordinates
TYPE:
|
height |
Bar heights
TYPE:
|
width |
Bar width
TYPE:
|
bottom |
Bar bottom(s)
TYPE:
|
align |
Bar alignment type (
TYPE:
|
vmin |
Y min value
TYPE:
|
vmax |
Y max value. If None,
TYPE:
|
**kwargs |
Axes.bar properties (e.g.
TYPE:
|
stacked_bar
stacked_bar(
table_data: str | Path | pd.DataFrame | StackedBarTable,
*,
delimiter: str = "\t",
width: float = 0.6,
cmap: str | dict[str, str] = "tab10",
vmax: float | None = None,
show_label: bool = True,
label_pos: str = "bottom",
label_margin: float = 2,
bar_kws: dict[str, Any] | None = None,
label_kws: dict[str, Any] | None = None
) -> StackedBarTable
Plot stacked bar from table data
PARAMETER | DESCRIPTION |
---|---|
table_data |
Table file or Table DataFrame or StackedBarTable
TYPE:
|
delimiter |
Table file delimiter
TYPE:
|
width |
Bar width ratio (0.0 - 1.0)
TYPE:
|
cmap |
Colormap assigned to each stacked bar.
User can set matplotlib's colormap (e.g.
TYPE:
|
vmax |
Stacked bar max value. If None, max value in each row values sum is set.
TYPE:
|
show_label |
Show table row names as labels
TYPE:
|
label_pos |
Label position (
TYPE:
|
label_margin |
Label margin size
TYPE:
|
bar_kws |
Axes.bar properties (e.g.
TYPE:
|
label_kws |
Text properties (e.g.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
sb_table
|
Stacked bar table
TYPE:
|
stacked_barh
stacked_barh(
table_data: str | Path | pd.DataFrame | StackedBarTable,
*,
delimiter: str = "\t",
width: float = 0.6,
cmap: str | dict[str, str] = "tab10",
bar_kws: dict[str, Any] | None = None
) -> StackedBarTable
Plot horizontal stacked bar from table data
PARAMETER | DESCRIPTION |
---|---|
table_data |
Table file or Table DataFrame or StackedBarTable
TYPE:
|
delimiter |
Table file delimiter
TYPE:
|
width |
Bar width ratio (0.0 - 1.0)
TYPE:
|
cmap |
Colormap assigned to each stacked bar.
User can set matplotlib's colormap (e.g.
TYPE:
|
bar_kws |
Patch properties for bar plot (e.g.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
sb_table
|
Stacked bar table
TYPE:
|
fill_between
fill_between(
x: list[float] | np.ndarray,
y1: list[float] | np.ndarray,
y2: float | list[float] | np.ndarray = 0,
*,
vmin: float = 0,
vmax: float | None = None,
arc: bool = True,
**kwargs
) -> None
Fill the area between two horizontal(y1, y2) curves
PARAMETER | DESCRIPTION |
---|---|
x |
X coordinates
TYPE:
|
y1 |
Y coordinates (first curve definition)
TYPE:
|
y2 |
Y coordinate[s] (second curve definition)
TYPE:
|
vmin |
Y min value
TYPE:
|
vmax |
Y max value. If None,
TYPE:
|
arc |
If True, plot arc style line for polar projection. If False, simply plot linear style line.
TYPE:
|
**kwargs |
Axes.fill_between properties (e.g.
TYPE:
|
heatmap
heatmap(
data: list | np.ndarray,
*,
vmin: float | None = None,
vmax: float | None = None,
start: float | None = None,
end: float | None = None,
width: float | None = None,
cmap: str | Colormap = "bwr",
show_value: bool = False,
rect_kws: dict[str, Any] | None = None,
text_kws: dict[str, Any] | None = None
) -> None
Plot heatmap
PARAMETER | DESCRIPTION |
---|---|
data |
Numerical list, numpy 1d or 2d array
TYPE:
|
vmin |
Min value for heatmap plot. If None,
TYPE:
|
vmax |
Max value for heatmap plot. If None,
TYPE:
|
start |
Start position for heatmap plot (x coordinate).
If None,
TYPE:
|
end |
End position for heatmap plot (x coordinate).
If None,
TYPE:
|
width |
Heatmap rectangle x width size.
Normally heatmap plots squares of equal width. In some cases,
it is necessary to reduce the width of only the last column data square.
At that time, width can be set under the following conditions.
TYPE:
|
cmap |
Colormap (e.g.
TYPE:
|
show_value |
If True, show data value on heatmap rectangle
TYPE:
|
rect_kws |
Patch properties (e.g.
TYPE:
|
text_kws |
Text properties (e.g.
TYPE:
|
tree
tree(
tree_data: str | Path | Tree,
*,
format: str = "newick",
outer: bool = True,
align_leaf_label: bool = True,
ignore_branch_length: bool = False,
leaf_label_size: float = 12,
leaf_label_rmargin: float = 2.0,
reverse: bool = False,
ladderize: bool = False,
line_kws: dict[str, Any] | None = None,
align_line_kws: dict[str, Any] | None = None,
label_formatter: Callable[[str], str] | None = None
) -> TreeViz
Plot tree
It is recommended that the track(sector) size be the same as the number of
leaf nodes in the tree, to make it easier to combine with bar
and heatmap
.
PARAMETER | DESCRIPTION |
---|---|
tree_data |
Tree data (
TYPE:
|
format |
Tree format (
TYPE:
|
outer |
If True, plot tree on outer side. If False, plot tree on inner side.
TYPE:
|
align_leaf_label |
If True, align leaf label.
TYPE:
|
ignore_branch_length |
If True, ignore branch length for plotting tree.
TYPE:
|
leaf_label_size |
Leaf label size
TYPE:
|
leaf_label_rmargin |
Leaf label radius margin
TYPE:
|
reverse |
If True, reverse tree
TYPE:
|
ladderize |
If True, ladderize tree
TYPE:
|
line_kws |
Patch properties (e.g.
TYPE:
|
align_line_kws |
Patch properties (e.g.
TYPE:
|
label_formatter |
User-defined label text format function to change plot label text content.
For example, if you want to change underscore of the label to space,
set
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tv
|
TreeViz instance
TYPE:
|
genomic_features
genomic_features(
features: SeqFeature | list[SeqFeature],
*,
plotstyle: str = "box",
r_lim: tuple[float, float] | None = None,
facecolor_handler: Callable[[SeqFeature], str] | None = None,
**kwargs
) -> None
Plot genomic features
PARAMETER | DESCRIPTION |
---|---|
features |
Biopython's SeqFeature or SeqFeature list
TYPE:
|
plotstyle |
Plot style (
TYPE:
|
r_lim |
Radius limit range. If None,
TYPE:
|
facecolor_handler |
User-defined function to handle facecolor
TYPE:
|
**kwargs |
Patch properties (e.g.
TYPE:
|