plot-io 0.12.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plot_io/__init__.py +73 -0
- plot_io/_methods.py +1691 -0
- plot_io/_native/__init__.py +199 -0
- plot_io/_native/__main__.py +197 -0
- plot_io/_native/_api.py +457 -0
- plot_io/_native/bin/windows-x86_64.dll +0 -0
- plot_io/_native/kernels.py +335 -0
- plot_io/_native/manifest.json +49 -0
- plot_io/axis.py +1347 -0
- plot_io/boxes.py +1156 -0
- plot_io/canvas.py +389 -0
- plot_io/color/__init__.py +3 -0
- plot_io/color/data.py +1646 -0
- plot_io/color/maps.py +922 -0
- plot_io/color/values.py +295 -0
- plot_io/color/variants.py +1246 -0
- plot_io/colorbar.py +1426 -0
- plot_io/columns.py +614 -0
- plot_io/decorations.py +920 -0
- plot_io/defaults.py +809 -0
- plot_io/density.py +113 -0
- plot_io/ext.py +68 -0
- plot_io/facets.py +240 -0
- plot_io/figure.py +788 -0
- plot_io/formatters.py +97 -0
- plot_io/genome/__init__.py +17 -0
- plot_io/genome/adapters.py +356 -0
- plot_io/genome/combine.py +123 -0
- plot_io/genome/contacts.py +508 -0
- plot_io/genome/intervals.py +750 -0
- plot_io/genome/lanes.py +191 -0
- plot_io/genome/layout.py +184 -0
- plot_io/genome/links.py +364 -0
- plot_io/genome/pack.py +27 -0
- plot_io/genome/readers.py +145 -0
- plot_io/genome/regions.py +228 -0
- plot_io/genome/scale.py +349 -0
- plot_io/genome/series.py +344 -0
- plot_io/genome/signal.py +621 -0
- plot_io/genome/sites.py +782 -0
- plot_io/genome/sources.py +459 -0
- plot_io/genome/testing.py +161 -0
- plot_io/geometry.py +289 -0
- plot_io/groups.py +308 -0
- plot_io/guides.py +503 -0
- plot_io/helpers/__init__.py +17 -0
- plot_io/helpers/clustermap.py +202 -0
- plot_io/helpers/dendrogram.py +172 -0
- plot_io/helpers/grids.py +304 -0
- plot_io/helpers/qq.py +334 -0
- plot_io/helpers/raincloud.py +249 -0
- plot_io/helpers/tree.py +214 -0
- plot_io/helpers/volcano.py +505 -0
- plot_io/hints.py +125 -0
- plot_io/kernels.py +740 -0
- plot_io/labels.py +566 -0
- plot_io/layers/__init__.py +100 -0
- plot_io/layers/base.py +630 -0
- plot_io/layers/context.py +87 -0
- plot_io/layers/core.py +446 -0
- plot_io/layers/geoms.py +1362 -0
- plot_io/layers/grammar.py +586 -0
- plot_io/layers/paint.py +614 -0
- plot_io/layers/pipeline.py +170 -0
- plot_io/layers/positions.py +431 -0
- plot_io/layers/stats.py +1088 -0
- plot_io/layout.py +1381 -0
- plot_io/legend.py +605 -0
- plot_io/levels.py +509 -0
- plot_io/limits.py +124 -0
- plot_io/lines.py +42 -0
- plot_io/mapped.py +522 -0
- plot_io/markers.py +110 -0
- plot_io/markup.py +128 -0
- plot_io/numbers.py +354 -0
- plot_io/occupancy.py +295 -0
- plot_io/plot.py +597 -0
- plot_io/presets/__init__.py +51 -0
- plot_io/presets/_util.py +153 -0
- plot_io/presets/area.py +145 -0
- plot_io/presets/bar.py +261 -0
- plot_io/presets/box.py +400 -0
- plot_io/presets/catpoints.py +177 -0
- plot_io/presets/contour.py +353 -0
- plot_io/presets/curves.py +30 -0
- plot_io/presets/dots.py +355 -0
- plot_io/presets/ecdf.py +97 -0
- plot_io/presets/errorbar.py +106 -0
- plot_io/presets/errors.py +296 -0
- plot_io/presets/fill.py +74 -0
- plot_io/presets/heatmap.py +322 -0
- plot_io/presets/hexbin.py +198 -0
- plot_io/presets/hist.py +391 -0
- plot_io/presets/hist2d.py +87 -0
- plot_io/presets/kde.py +162 -0
- plot_io/presets/kde2d.py +147 -0
- plot_io/presets/line.py +143 -0
- plot_io/presets/pie.py +502 -0
- plot_io/presets/regression.py +115 -0
- plot_io/presets/scatter.py +194 -0
- plot_io/presets/stem.py +100 -0
- plot_io/presets/violin.py +323 -0
- plot_io/py.typed +0 -0
- plot_io/registry.py +82 -0
- plot_io/render.py +480 -0
- plot_io/rows.py +491 -0
- plot_io/scales.py +103 -0
- plot_io/seams.py +138 -0
- plot_io/settings.py +807 -0
- plot_io/shapes.py +66 -0
- plot_io/sharing.py +232 -0
- plot_io/sizemaps.py +97 -0
- plot_io/spec.py +240 -0
- plot_io/states.py +216 -0
- plot_io/styles/__init__.py +307 -0
- plot_io/styles/library.py +397 -0
- plot_io/tables.py +138 -0
- plot_io/text.py +412 -0
- plot_io/ticks.py +400 -0
- plot_io/times.py +287 -0
- plot_io/titles.py +225 -0
- plot_io/transform.py +114 -0
- plot_io/types.py +13604 -0
- plot_io/units.py +768 -0
- plot_io/validators.py +1029 -0
- plot_io/values.py +190 -0
- plot_io-0.12.0.dist-info/METADATA +215 -0
- plot_io-0.12.0.dist-info/RECORD +130 -0
- plot_io-0.12.0.dist-info/WHEEL +4 -0
- plot_io-0.12.0.dist-info/licenses/LICENSE +28 -0
plot_io/_methods.py
ADDED
|
@@ -0,0 +1,1691 @@
|
|
|
1
|
+
# Generated by tools/gen_api.py from the SETTINGS declarations: do not edit.
|
|
2
|
+
"""Mixins of the settings classes: ``set`` typed for type checkers, and the
|
|
3
|
+
methods of the built-in plot types on ``Plot``, ``Figure`` and ``PanelSet``.
|
|
4
|
+
Nothing here is imported at run time but ``typing``."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING, Any, Unpack
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from typing import Self
|
|
12
|
+
|
|
13
|
+
from . import types as t
|
|
14
|
+
from .colorbar import Colorbar
|
|
15
|
+
from .decorations import Decoration, Text, _Rule, _Span
|
|
16
|
+
from .facets import LayerSet
|
|
17
|
+
from .figure import FigureTitle
|
|
18
|
+
from .genome.contacts import HiC
|
|
19
|
+
from .genome.intervals import Bed, Genes, Gtf
|
|
20
|
+
from .genome.links import Links
|
|
21
|
+
from .genome.series import GenomeSeries
|
|
22
|
+
from .genome.signal import BigWig
|
|
23
|
+
from .genome.sites import SiteHeatmap, SiteProfile
|
|
24
|
+
from .helpers.dendrogram import Dendrogram
|
|
25
|
+
from .helpers.qq import QQ
|
|
26
|
+
from .helpers.raincloud import Raincloud
|
|
27
|
+
from .helpers.volcano import Ma, Manhattan, Volcano, _Thresholds
|
|
28
|
+
from .layers.base import Series
|
|
29
|
+
from .mapped import _MappedAxis
|
|
30
|
+
from .plot import Legend, Plot
|
|
31
|
+
from .presets.area import Area
|
|
32
|
+
from .presets.bar import Bar
|
|
33
|
+
from .presets.box import Box
|
|
34
|
+
from .presets.catpoints import Strip, Swarm, _CatPoints
|
|
35
|
+
from .presets.contour import Contour
|
|
36
|
+
from .presets.dots import Dots
|
|
37
|
+
from .presets.ecdf import Ecdf
|
|
38
|
+
from .presets.errorbar import Errorbar
|
|
39
|
+
from .presets.errors import Summarized
|
|
40
|
+
from .presets.fill import Fill
|
|
41
|
+
from .presets.heatmap import Heatmap
|
|
42
|
+
from .presets.hexbin import Hexbin
|
|
43
|
+
from .presets.hist import Hist
|
|
44
|
+
from .presets.hist2d import Hist2d
|
|
45
|
+
from .presets.kde import Kde
|
|
46
|
+
from .presets.line import Line
|
|
47
|
+
from .presets.pie import Pie
|
|
48
|
+
from .presets.regression import Regression
|
|
49
|
+
from .presets.scatter import Scatter
|
|
50
|
+
from .presets.stem import Stem
|
|
51
|
+
from .presets.violin import Violin
|
|
52
|
+
from .settings import Settings
|
|
53
|
+
from .titles import TitleBase
|
|
54
|
+
else:
|
|
55
|
+
Bed = object
|
|
56
|
+
Colorbar = object
|
|
57
|
+
Contour = object
|
|
58
|
+
Decoration = object
|
|
59
|
+
FigureTitle = object
|
|
60
|
+
Genes = object
|
|
61
|
+
GenomeSeries = object
|
|
62
|
+
Heatmap = object
|
|
63
|
+
Legend = object
|
|
64
|
+
Plot = object
|
|
65
|
+
Scatter = object
|
|
66
|
+
Series = object
|
|
67
|
+
Settings = object
|
|
68
|
+
Summarized = object
|
|
69
|
+
Text = object
|
|
70
|
+
TitleBase = object
|
|
71
|
+
_CatPoints = object
|
|
72
|
+
_MappedAxis = object
|
|
73
|
+
_Rule = object
|
|
74
|
+
_Span = object
|
|
75
|
+
_Thresholds = object
|
|
76
|
+
|
|
77
|
+
#: The plot types with a method here.
|
|
78
|
+
LAYERS = frozenset(['area', 'bar', 'bed', 'bigwig', 'box', 'contour', 'dendrogram', 'dots',
|
|
79
|
+
'ecdf', 'errorbar', 'fill', 'genes', 'gtf', 'heatmap', 'hexbin', 'hic',
|
|
80
|
+
'hist', 'hist2d', 'kde', 'line', 'links', 'ma', 'manhattan', 'pie', 'qq',
|
|
81
|
+
'raincloud', 'regression', 'scatter', 'site_heatmap', 'site_profile',
|
|
82
|
+
'stem', 'strip', 'swarm', 'violin', 'volcano'])
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _values(values: tuple[Any, ...], required: int) -> tuple[Any, ...]:
|
|
86
|
+
"""The data arguments given: trailing ``None`` past the required ones left out."""
|
|
87
|
+
n = len(values)
|
|
88
|
+
while n > required and values[n - 1] is None:
|
|
89
|
+
n -= 1
|
|
90
|
+
return values[:n]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _named(named: dict[str, Any]) -> dict[str, Any]:
|
|
94
|
+
return {k: v for k, v in named.items() if v is not None}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _plot_layer(plot: Any, name: str, values: tuple[Any, ...], required: int,
|
|
98
|
+
named: dict[str, Any], settings: Any) -> Any:
|
|
99
|
+
from .layers import layer_type
|
|
100
|
+
return layer_type(name)(*_values(values, required), plot=plot, **_named(named),
|
|
101
|
+
**settings)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _figure_layer(figure: Any, name: str, values: tuple[Any, ...], required: int,
|
|
105
|
+
named: dict[str, Any], settings: Any) -> Any:
|
|
106
|
+
from .layers import figure_call, layer_type
|
|
107
|
+
return figure_call(figure, layer_type(name), _values(values, required),
|
|
108
|
+
{**_named(named), **settings})
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _panelset_layer(facets: Any, name: str, values: tuple[Any, ...], required: int,
|
|
112
|
+
named: dict[str, Any], settings: Any) -> Any:
|
|
113
|
+
return facets.call(name, _values(values, required), {**_named(named), **settings})
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class AxisMixin(Settings):
|
|
117
|
+
"""The typed API of ``Axis``."""
|
|
118
|
+
|
|
119
|
+
if TYPE_CHECKING:
|
|
120
|
+
def set(self, **settings: Unpack[t.AxisSettings]) -> Self: # type: ignore[override]
|
|
121
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class FigureColorbarMixin(Colorbar):
|
|
125
|
+
"""The typed API of ``FigureColorbar``."""
|
|
126
|
+
|
|
127
|
+
if TYPE_CHECKING:
|
|
128
|
+
def set(self, **settings: Unpack[t.FigureColorbarSettings]) -> Self: # type: ignore[override]
|
|
129
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class AnnotateMixin(Text):
|
|
133
|
+
"""The typed API of ``Annotate``."""
|
|
134
|
+
|
|
135
|
+
if TYPE_CHECKING:
|
|
136
|
+
def set(self, **settings: Unpack[t.AnnotateSettings]) -> Self: # type: ignore[override]
|
|
137
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class AxLineMixin(Decoration):
|
|
141
|
+
"""The typed API of ``AxLine``."""
|
|
142
|
+
|
|
143
|
+
if TYPE_CHECKING:
|
|
144
|
+
def set(self, **settings: Unpack[t.AxLineSettings]) -> Self: # type: ignore[override]
|
|
145
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class BracketMixin(Decoration):
|
|
149
|
+
"""The typed API of ``Bracket``."""
|
|
150
|
+
|
|
151
|
+
if TYPE_CHECKING:
|
|
152
|
+
def set(self, **settings: Unpack[t.BracketSettings]) -> Self: # type: ignore[override]
|
|
153
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class HLineMixin(_Rule):
|
|
157
|
+
"""The typed API of ``HLine``."""
|
|
158
|
+
|
|
159
|
+
if TYPE_CHECKING:
|
|
160
|
+
def set(self, **settings: Unpack[t.HLineSettings]) -> Self: # type: ignore[override]
|
|
161
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class HSpanMixin(_Span):
|
|
165
|
+
"""The typed API of ``HSpan``."""
|
|
166
|
+
|
|
167
|
+
if TYPE_CHECKING:
|
|
168
|
+
def set(self, **settings: Unpack[t.HSpanSettings]) -> Self: # type: ignore[override]
|
|
169
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class TextMixin(Decoration):
|
|
173
|
+
"""The typed API of ``Text``."""
|
|
174
|
+
|
|
175
|
+
if TYPE_CHECKING:
|
|
176
|
+
def set(self, **settings: Unpack[t.TextSettings]) -> Self: # type: ignore[override]
|
|
177
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class VLineMixin(_Rule):
|
|
181
|
+
"""The typed API of ``VLine``."""
|
|
182
|
+
|
|
183
|
+
if TYPE_CHECKING:
|
|
184
|
+
def set(self, **settings: Unpack[t.VLineSettings]) -> Self: # type: ignore[override]
|
|
185
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class VSpanMixin(_Span):
|
|
189
|
+
"""The typed API of ``VSpan``."""
|
|
190
|
+
|
|
191
|
+
if TYPE_CHECKING:
|
|
192
|
+
def set(self, **settings: Unpack[t.VSpanSettings]) -> Self: # type: ignore[override]
|
|
193
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class FigureMixin(Settings):
|
|
197
|
+
"""The typed API of ``Figure``."""
|
|
198
|
+
|
|
199
|
+
def scatter(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
200
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
201
|
+
**settings: Unpack[t.ScatterFigureSettings]) -> Scatter:
|
|
202
|
+
"""A new plot holding: Markers at points ``(x, y)``."""
|
|
203
|
+
return _figure_layer(self, "scatter", (x, y), 2, {"data": data, "group": group,
|
|
204
|
+
"group_order": group_order,
|
|
205
|
+
"group_missing": group_missing,
|
|
206
|
+
"group_colors": group_colors}, settings)
|
|
207
|
+
|
|
208
|
+
def line(self, x: Any, y: Any = None, *, data: Any = None, group: Any = None,
|
|
209
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
210
|
+
**settings: Unpack[t.LineFigureSettings]) -> Line:
|
|
211
|
+
"""A new plot holding: A line through ``(x, y)``; ``y`` may hold several columns (one
|
|
212
|
+
line each, sharing ``x``: a 2-D buffer's columns, a data frame, a list of arrays),
|
|
213
|
+
and ``x`` may be omitted (``0, 1, 2, …``). ``orientation="horizontal"`` draws ``x``
|
|
214
|
+
on the y axis (a profile along y). Numbers per point (or ``"density"``) in
|
|
215
|
+
``marker_color``/``marker_edge_color`` map through the series' color axis.
|
|
216
|
+
"""
|
|
217
|
+
return _figure_layer(self, "line", (x, y), 1, {"data": data, "group": group,
|
|
218
|
+
"group_order": group_order,
|
|
219
|
+
"group_missing": group_missing,
|
|
220
|
+
"group_colors": group_colors}, settings)
|
|
221
|
+
|
|
222
|
+
def fill(self, x: Any, y1: Any, y2: Any = 0.0, *, data: Any = None, group: Any = None,
|
|
223
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
224
|
+
**settings: Unpack[t.FillFigureSettings]) -> Fill:
|
|
225
|
+
"""A new plot holding: The area between ``y1`` and ``y2`` (a sequence or a constant)
|
|
226
|
+
along ``x``; ``orientation="horizontal"`` fills between x curves along y (``fill(y,
|
|
227
|
+
x1, x2)``).
|
|
228
|
+
"""
|
|
229
|
+
return _figure_layer(self, "fill", (x, y1, y2), 2, {"data": data, "group": group,
|
|
230
|
+
"group_order": group_order,
|
|
231
|
+
"group_missing": group_missing,
|
|
232
|
+
"group_colors": group_colors}, settings)
|
|
233
|
+
|
|
234
|
+
def box(self, values: Any, positions: Any = None, *, data: Any = None, group: Any = None,
|
|
235
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
236
|
+
**settings: Unpack[t.BoxFigureSettings]) -> Box:
|
|
237
|
+
"""A new plot holding: Box plots of ``values``: a dict ``{category: values}``, a list
|
|
238
|
+
of arrays (categories ``0, 1, …`` or ``categories=``), or one array.
|
|
239
|
+
"""
|
|
240
|
+
return _figure_layer(self, "box", (values, positions), 1, {"data": data, "group": group,
|
|
241
|
+
"group_order": group_order,
|
|
242
|
+
"group_missing": group_missing,
|
|
243
|
+
"group_colors": group_colors}, settings)
|
|
244
|
+
|
|
245
|
+
def heatmap(self, values: Any, x: Any = None, y: Any = None, *, data: Any = None,
|
|
246
|
+
group: Any = None, group_order: Any = None, group_missing: Any = None,
|
|
247
|
+
group_colors: Any = None,
|
|
248
|
+
**settings: Unpack[t.HeatmapFigureSettings]) -> Heatmap:
|
|
249
|
+
"""A new plot holding: A grid of values (rows first) as colored cells; ``x``/``y`` give
|
|
250
|
+
cell labels, centres or edges.
|
|
251
|
+
"""
|
|
252
|
+
return _figure_layer(self, "heatmap", (values, x, y), 1, {"data": data, "group": group,
|
|
253
|
+
"group_order": group_order,
|
|
254
|
+
"group_missing": group_missing,
|
|
255
|
+
"group_colors": group_colors}, settings)
|
|
256
|
+
|
|
257
|
+
def bar(self, x: Any, y: Any = None, *, data: Any = None, group: Any = None,
|
|
258
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
259
|
+
**settings: Unpack[t.BarFigureSettings]) -> Bar:
|
|
260
|
+
"""A new plot holding: Bars of height ``y`` at ``x`` (categories or numbers), or of a
|
|
261
|
+
dict ``{category: height}``, or of heights alone (at 0, 1, …).
|
|
262
|
+
"""
|
|
263
|
+
return _figure_layer(self, "bar", (x, y), 1, {"data": data, "group": group,
|
|
264
|
+
"group_order": group_order,
|
|
265
|
+
"group_missing": group_missing,
|
|
266
|
+
"group_colors": group_colors}, settings)
|
|
267
|
+
|
|
268
|
+
def hist(self, values: Any, *, data: Any = None, group: Any = None, group_order: Any = None,
|
|
269
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
270
|
+
**settings: Unpack[t.HistFigureSettings]) -> Hist:
|
|
271
|
+
"""A new plot holding: A histogram of ``values``: one array, or several (a dict or a
|
|
272
|
+
list of arrays) that share the same bins.
|
|
273
|
+
"""
|
|
274
|
+
return _figure_layer(self, "hist", (values,), 1, {"data": data, "group": group,
|
|
275
|
+
"group_order": group_order,
|
|
276
|
+
"group_missing": group_missing,
|
|
277
|
+
"group_colors": group_colors}, settings)
|
|
278
|
+
|
|
279
|
+
def kde(self, values: Any, y: Any = None, *, data: Any = None, group: Any = None,
|
|
280
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
281
|
+
**settings: Unpack[t.KdeFigureSettings]) -> Kde:
|
|
282
|
+
"""A new plot holding: A Gaussian kernel density estimate of ``values`` (one array, or
|
|
283
|
+
several as a dict or a list of arrays, on a common grid).
|
|
284
|
+
"""
|
|
285
|
+
return _figure_layer(self, "kde", (values, y), 1, {"data": data, "group": group,
|
|
286
|
+
"group_order": group_order,
|
|
287
|
+
"group_missing": group_missing,
|
|
288
|
+
"group_colors": group_colors}, settings)
|
|
289
|
+
|
|
290
|
+
def ecdf(self, values: Any, *, data: Any = None, group: Any = None, group_order: Any = None,
|
|
291
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
292
|
+
**settings: Unpack[t.EcdfFigureSettings]) -> Ecdf:
|
|
293
|
+
"""A new plot holding: The empirical cumulative distribution of ``values`` (one array,
|
|
294
|
+
or several as a dict or a list of arrays).
|
|
295
|
+
"""
|
|
296
|
+
return _figure_layer(self, "ecdf", (values,), 1, {"data": data, "group": group,
|
|
297
|
+
"group_order": group_order,
|
|
298
|
+
"group_missing": group_missing,
|
|
299
|
+
"group_colors": group_colors}, settings)
|
|
300
|
+
|
|
301
|
+
def violin(self, values: Any, positions: Any = None, *, data: Any = None, group: Any = None,
|
|
302
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
303
|
+
**settings: Unpack[t.ViolinFigureSettings]) -> Violin:
|
|
304
|
+
"""A new plot holding: Violins of ``values``: a dict ``{category: values}``, a list of
|
|
305
|
+
arrays (categories ``0, 1, …`` or ``categories=``), or one array.
|
|
306
|
+
"""
|
|
307
|
+
return _figure_layer(self, "violin", (values, positions), 1, {"data": data,
|
|
308
|
+
"group": group,
|
|
309
|
+
"group_order": group_order,
|
|
310
|
+
"group_missing": group_missing,
|
|
311
|
+
"group_colors": group_colors}, settings)
|
|
312
|
+
|
|
313
|
+
def strip(self, values: Any, positions: Any = None, *, data: Any = None, group: Any = None,
|
|
314
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
315
|
+
**settings: Unpack[t.StripFigureSettings]) -> Strip:
|
|
316
|
+
"""A new plot holding: Points of each category's values, spread across the slot by
|
|
317
|
+
random jitter (from a fixed seed, so output is reproducible).
|
|
318
|
+
"""
|
|
319
|
+
return _figure_layer(self, "strip", (values, positions), 1, {"data": data,
|
|
320
|
+
"group": group,
|
|
321
|
+
"group_order": group_order,
|
|
322
|
+
"group_missing": group_missing,
|
|
323
|
+
"group_colors": group_colors}, settings)
|
|
324
|
+
|
|
325
|
+
def swarm(self, values: Any, positions: Any = None, *, data: Any = None, group: Any = None,
|
|
326
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
327
|
+
**settings: Unpack[t.SwarmFigureSettings]) -> Swarm:
|
|
328
|
+
"""A new plot holding: Points of each category's values, side by side so that they do
|
|
329
|
+
not overlap (points that do not fit go to the slot's edge, with a warning; above
|
|
330
|
+
100,000 points, jittered across the width as a strip, with a warning).
|
|
331
|
+
"""
|
|
332
|
+
return _figure_layer(self, "swarm", (values, positions), 1, {"data": data,
|
|
333
|
+
"group": group,
|
|
334
|
+
"group_order": group_order,
|
|
335
|
+
"group_missing": group_missing,
|
|
336
|
+
"group_colors": group_colors}, settings)
|
|
337
|
+
|
|
338
|
+
def area(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
339
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
340
|
+
**settings: Unpack[t.AreaFigureSettings]) -> Area:
|
|
341
|
+
"""A new plot holding: Areas of the layers ``y`` (one column, or several: a dict
|
|
342
|
+
``{name: values}``, a data frame, a 2-D buffer's columns, a list of arrays) along
|
|
343
|
+
``x``, stacked on ``baseline``; ``orientation="horizontal"`` runs them along y.
|
|
344
|
+
"""
|
|
345
|
+
return _figure_layer(self, "area", (x, y), 2, {"data": data, "group": group,
|
|
346
|
+
"group_order": group_order,
|
|
347
|
+
"group_missing": group_missing,
|
|
348
|
+
"group_colors": group_colors}, settings)
|
|
349
|
+
|
|
350
|
+
def errorbar(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
351
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
352
|
+
**settings: Unpack[t.ErrorbarFigureSettings]) -> Errorbar:
|
|
353
|
+
"""A new plot holding: Error bars at ``(x, y)``: ``y_error``/``x_error`` as a value, a
|
|
354
|
+
sequence, ``(low, high)`` or ``Errors``; ``marker`` adds markers at the points
|
|
355
|
+
(numbers per point in ``marker_color`` map through the series' color axis).
|
|
356
|
+
"""
|
|
357
|
+
return _figure_layer(self, "errorbar", (x, y), 2, {"data": data, "group": group,
|
|
358
|
+
"group_order": group_order,
|
|
359
|
+
"group_missing": group_missing,
|
|
360
|
+
"group_colors": group_colors}, settings)
|
|
361
|
+
|
|
362
|
+
def stem(self, x: Any, y: Any = None, *, data: Any = None, group: Any = None,
|
|
363
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
364
|
+
**settings: Unpack[t.StemFigureSettings]) -> Stem:
|
|
365
|
+
"""A new plot holding: Stems from ``baseline`` to ``y`` at ``x`` (or at 0, 1, … when
|
|
366
|
+
``y`` is omitted); numbers per point in ``marker_color`` map through the series'
|
|
367
|
+
color axis.
|
|
368
|
+
"""
|
|
369
|
+
return _figure_layer(self, "stem", (x, y), 1, {"data": data, "group": group,
|
|
370
|
+
"group_order": group_order,
|
|
371
|
+
"group_missing": group_missing,
|
|
372
|
+
"group_colors": group_colors}, settings)
|
|
373
|
+
|
|
374
|
+
def regression(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
375
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
376
|
+
**settings: Unpack[t.RegressionFigureSettings]) -> Regression:
|
|
377
|
+
"""A new plot holding: A regression of ``y`` on ``x``: a polynomial of ``order`` (least
|
|
378
|
+
squares) with a confidence band of the mean, or a LOWESS curve; ``scatter`` also
|
|
379
|
+
draws the points (numbers per point in ``marker_color`` map through the series'
|
|
380
|
+
color axis).
|
|
381
|
+
"""
|
|
382
|
+
return _figure_layer(self, "regression", (x, y), 2, {"data": data, "group": group,
|
|
383
|
+
"group_order": group_order,
|
|
384
|
+
"group_missing": group_missing,
|
|
385
|
+
"group_colors": group_colors}, settings)
|
|
386
|
+
|
|
387
|
+
def hist2d(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
388
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
389
|
+
**settings: Unpack[t.Hist2dFigureSettings]) -> Hist2d:
|
|
390
|
+
"""A new plot holding: A 2-D histogram of points ``(x, y)``: counts in bins (even on
|
|
391
|
+
the axis scales), drawn as a heatmap; bins with fewer than ``min_count`` points are
|
|
392
|
+
left empty.
|
|
393
|
+
"""
|
|
394
|
+
return _figure_layer(self, "hist2d", (x, y), 2, {"data": data, "group": group,
|
|
395
|
+
"group_order": group_order,
|
|
396
|
+
"group_missing": group_missing,
|
|
397
|
+
"group_colors": group_colors}, settings)
|
|
398
|
+
|
|
399
|
+
def hexbin(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
400
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
401
|
+
**settings: Unpack[t.HexbinFigureSettings]) -> Hexbin:
|
|
402
|
+
"""A new plot holding: A hexagonal 2-D histogram of points ``(x, y)``: ``bins`` regular
|
|
403
|
+
hexagons across the axes width. The lattice is laid out in page units for the axes
|
|
404
|
+
the layout placed (its domain is the data's, its bins the axes'), so the hexagons
|
|
405
|
+
are regular and tile exactly whatever the axes' aspect.
|
|
406
|
+
"""
|
|
407
|
+
return _figure_layer(self, "hexbin", (x, y), 2, {"data": data, "group": group,
|
|
408
|
+
"group_order": group_order,
|
|
409
|
+
"group_missing": group_missing,
|
|
410
|
+
"group_colors": group_colors}, settings)
|
|
411
|
+
|
|
412
|
+
def contour(self, values: Any, x: Any = None, y: Any = None, *, data: Any = None,
|
|
413
|
+
group: Any = None, group_order: Any = None, group_missing: Any = None,
|
|
414
|
+
group_colors: Any = None,
|
|
415
|
+
**settings: Unpack[t.ContourFigureSettings]) -> Contour:
|
|
416
|
+
"""A new plot holding: Contour lines and/or filled bands of ``values`` (rows first) at
|
|
417
|
+
nodes ``x``/``y`` (centres; edges are reduced to their midpoints).
|
|
418
|
+
"""
|
|
419
|
+
return _figure_layer(self, "contour", (values, x, y), 1, {"data": data, "group": group,
|
|
420
|
+
"group_order": group_order,
|
|
421
|
+
"group_missing": group_missing,
|
|
422
|
+
"group_colors": group_colors}, settings)
|
|
423
|
+
|
|
424
|
+
def pie(self, values: Any, *, data: Any = None, group: Any = None, group_order: Any = None,
|
|
425
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
426
|
+
**settings: Unpack[t.PieFigureSettings]) -> Pie:
|
|
427
|
+
"""A new plot holding: A pie (or donut, with ``hole``) of ``values``: a sequence, or a
|
|
428
|
+
dict ``{label: value}``; the plot is drawn without axes.
|
|
429
|
+
"""
|
|
430
|
+
return _figure_layer(self, "pie", (values,), 1, {"data": data, "group": group,
|
|
431
|
+
"group_order": group_order,
|
|
432
|
+
"group_missing": group_missing,
|
|
433
|
+
"group_colors": group_colors}, settings)
|
|
434
|
+
|
|
435
|
+
def dots(self, color: Any = None, size: Any = None, x: Any = None, y: Any = None, *,
|
|
436
|
+
data: Any = None, group: Any = None, group_order: Any = None,
|
|
437
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
438
|
+
**settings: Unpack[t.DotsFigureSettings]) -> Dots:
|
|
439
|
+
"""A new plot holding: One marker per cell of a grid: ``color`` and ``size`` are grids
|
|
440
|
+
of values (row 0 first) of one shape, or one value; ``x``/``y`` label the columns
|
|
441
|
+
and rows, as ``heatmap``'s. With long data (``x``, ``y`` and values per cell), the
|
|
442
|
+
cells come from the rows; cells without a row get no dot.
|
|
443
|
+
"""
|
|
444
|
+
return _figure_layer(self, "dots", (color, size, x, y), 0, {"data": data,
|
|
445
|
+
"group": group,
|
|
446
|
+
"group_order": group_order,
|
|
447
|
+
"group_missing": group_missing,
|
|
448
|
+
"group_colors": group_colors}, settings)
|
|
449
|
+
|
|
450
|
+
def bigwig(self, reader: Any = None, *, x: Any = None, y: Any = None,
|
|
451
|
+
**settings: Unpack[t.BigWigFigureSettings]) -> BigWig:
|
|
452
|
+
"""A new plot holding: A binned signal over the region: a step line along the bins,
|
|
453
|
+
filled to a baseline. ``reader`` is a signal reader (bigWig; bigBed, BED and peaks
|
|
454
|
+
give their coverage; :func:`~plot_io.genome.combine.combine` of two), a path (opened
|
|
455
|
+
with gwseq_io), ``chr``, ``start``, ``end``, ``value`` records (columns, a DataFrame
|
|
456
|
+
or rows; binned by plot_io), a function ``f(chr, start, end, bins)`` giving values,
|
|
457
|
+
or ``None`` with ``y`` (values over the region) and optionally ``x`` (bin centres,
|
|
458
|
+
or n + 1 edges, in bp).
|
|
459
|
+
"""
|
|
460
|
+
return _figure_layer(self, "bigwig", (reader,), 0, {"x": x, "y": y}, settings)
|
|
461
|
+
|
|
462
|
+
def bed(self, reader: Any, **settings: Unpack[t.BedFigureSettings]) -> Bed:
|
|
463
|
+
"""A new plot holding: Intervals over the region: boxes or gene models, on one row or
|
|
464
|
+
packed onto rows. ``reader`` is an interval reader (bigBed, BED, peaks), a path
|
|
465
|
+
(opened with gwseq_io) or plain data: a dict of columns, a DataFrame, or rows
|
|
466
|
+
(``start``, ``end`` and optionally ``name``, ``score``, ``strand``, ``thickStart``,
|
|
467
|
+
``thickEnd``, ``itemRgb``, ``blockCount``, ``blockSizes``, ``blockStarts``).
|
|
468
|
+
"""
|
|
469
|
+
return _figure_layer(self, "bed", (reader,), 1, {}, settings)
|
|
470
|
+
|
|
471
|
+
def genes(self, reader: Any, **settings: Unpack[t.GenesFigureSettings]) -> Genes:
|
|
472
|
+
"""A new plot holding: Gene models (BED12): ``Bed`` with ``kind="genes"``, rows
|
|
473
|
+
expanded and names on.
|
|
474
|
+
"""
|
|
475
|
+
return _figure_layer(self, "genes", (reader,), 1, {}, settings)
|
|
476
|
+
|
|
477
|
+
def gtf(self, reader: Any, **settings: Unpack[t.GtfFigureSettings]) -> Gtf:
|
|
478
|
+
"""A new plot holding: Gene models of a GTF or GFF3 reader (``read_entries(model=)``)
|
|
479
|
+
or path: ``Genes``, one model per gene (its transcripts' exons merged) or per
|
|
480
|
+
transcript, or plain BED12 data as ``Genes`` takes it.
|
|
481
|
+
"""
|
|
482
|
+
return _figure_layer(self, "gtf", (reader,), 1, {}, settings)
|
|
483
|
+
|
|
484
|
+
def hic(self, reader: Any, **settings: Unpack[t.HiCFigureSettings]) -> HiC:
|
|
485
|
+
"""A new plot holding: The upper triangle of a contact matrix, the diagonal along the x
|
|
486
|
+
axis (each cell a diamond), or with ``shape="square"`` the whole matrix of
|
|
487
|
+
``region`` (x) against ``region2`` (y, its start at the top). ``reader`` is a Hi-C
|
|
488
|
+
reader, a path (opened with gwseq_io), or a square matrix over the region (bins of
|
|
489
|
+
``span / n``).
|
|
490
|
+
"""
|
|
491
|
+
return _figure_layer(self, "hic", (reader,), 1, {}, settings)
|
|
492
|
+
|
|
493
|
+
def links(self, pairs: Any, **settings: Unpack[t.LinksFigureSettings]) -> Links:
|
|
494
|
+
"""A new plot holding: Links between pairs of places (BEDPE): an arc from anchor centre
|
|
495
|
+
to anchor centre in a lane of its own, or, ``lane="over"`` a Hi-C triangle or
|
|
496
|
+
square, a mark at each pair's contact cell (on a square, and at its mirror).
|
|
497
|
+
``pairs`` is a reader whose ``read_entries`` gives the BEDPE columns, a path
|
|
498
|
+
gwseq_io reads them from, or plain data (the pairs with an anchor in view are read):
|
|
499
|
+
a dict of columns, a DataFrame, or rows in BEDPE order (``chr1``, ``start1``,
|
|
500
|
+
``end1``, ``chr2``, ``start2``, ``end2``, then optionally ``name``, ``score``).
|
|
501
|
+
"""
|
|
502
|
+
return _figure_layer(self, "links", (pairs,), 1, {}, settings)
|
|
503
|
+
|
|
504
|
+
def site_heatmap(self, signal: Any, sites: Any, *, group: Any = None,
|
|
505
|
+
**settings: Unpack[t.SiteHeatmapFigureSettings]) -> SiteHeatmap:
|
|
506
|
+
"""A new plot holding: A signal around sites, one row per site (a table with ``chr``,
|
|
507
|
+
``start``, ``end`` and optional ``strand``, ``summit`` columns, or an interval
|
|
508
|
+
reader), x the distance from the anchor in bp; ``group`` (a column of the sites, or
|
|
509
|
+
a label per site) makes a block of rows per group.
|
|
510
|
+
"""
|
|
511
|
+
return _figure_layer(self, "site_heatmap", (signal, sites), 2, {"group": group}, settings)
|
|
512
|
+
|
|
513
|
+
def site_profile(self, signal: Any, sites: Any, *, group: Any = None,
|
|
514
|
+
**settings: Unpack[t.SiteProfileFigureSettings]) -> SiteProfile:
|
|
515
|
+
"""A new plot holding: The column mean (or median) of a signal around sites (see
|
|
516
|
+
:class:`SiteHeatmap`): one line per group, x the distance from the anchor in bp, an
|
|
517
|
+
optional band.
|
|
518
|
+
"""
|
|
519
|
+
return _figure_layer(self, "site_profile", (signal, sites), 2, {"group": group}, settings)
|
|
520
|
+
|
|
521
|
+
def dendrogram(self, tree: Any, labels: Any = None,
|
|
522
|
+
**settings: Unpack[t.DendrogramFigureSettings]) -> Dendrogram:
|
|
523
|
+
"""A new plot holding: The merges of ``tree`` (a :class:`Tree`, or a scipy ``Z``) as
|
|
524
|
+
U-shaped links: the leaves at slots 0, 1, … in ``tree.leaves`` order on the leaf
|
|
525
|
+
axis, the heights on the value axis, the root at the top
|
|
526
|
+
(``orientation="horizontal"``: at the left, heights along x, the x axis inverted
|
|
527
|
+
unless set). ``labels`` (default: the tree's) make the leaf axis categorical, in
|
|
528
|
+
leaf order, so a heatmap with the same categories shares it; without labels each
|
|
529
|
+
leaf is ticked with its observation's index. Every leaf is labelled: turned 90° when
|
|
530
|
+
the labels do not fit flat, then smaller, down to the axis' ``label_min_size`` (6
|
|
531
|
+
pt), and every k-th only below it.
|
|
532
|
+
"""
|
|
533
|
+
return _figure_layer(self, "dendrogram", (tree, labels), 1, {}, settings)
|
|
534
|
+
|
|
535
|
+
def qq(self, values: Any, y: Any = None, **settings: Unpack[t.QQFigureSettings]) -> QQ:
|
|
536
|
+
"""A new plot holding: The sorted ``values`` against the quantiles of ``dist`` at R's
|
|
537
|
+
``ppoints`` (``(i − a) / (n + 1 − 2a)``, a = 3/8 for n ≤ 10, else 1/2), or against
|
|
538
|
+
the sorted ``y`` (two samples: the longer interpolated to the shorter's size, as R's
|
|
539
|
+
``qqplot``; ``values`` on x). ``pvalues=True``: ``values`` are p-values, drawn as
|
|
540
|
+
−log10 of the sorted p-values (y) against −log10 of the expected uniform quantiles
|
|
541
|
+
(x). Points as `Scatter`'s; the reference ``line`` and the pointwise ``band`` of
|
|
542
|
+
order statistics in the series color. The points and the default line are R's
|
|
543
|
+
(``qqnorm``, ``qqline``), not scipy's ``probplot`` (Filliben's medians, a least-
|
|
544
|
+
squares line).
|
|
545
|
+
"""
|
|
546
|
+
return _figure_layer(self, "qq", (values, y), 1, {}, settings)
|
|
547
|
+
|
|
548
|
+
def raincloud(self, values: Any, positions: Any = None,
|
|
549
|
+
**settings: Unpack[t.RaincloudFigureSettings]) -> Raincloud:
|
|
550
|
+
"""A new plot holding: Rainclouds of ``values`` (a dict ``{category: values}``, a list
|
|
551
|
+
of arrays, or one array; long data with ``x=`` categories): per category a half
|
|
552
|
+
violin on the high side (stat ``violin``), a narrow box at the centre (stat ``box``)
|
|
553
|
+
and the values as jittered points on the low side. ``parts`` keeps some of the
|
|
554
|
+
three. Widths and offsets are `%` of the slot.
|
|
555
|
+
"""
|
|
556
|
+
return _figure_layer(self, "raincloud", (values, positions), 1, {}, settings)
|
|
557
|
+
|
|
558
|
+
def volcano(self, fold_change: Any, p: Any,
|
|
559
|
+
**settings: Unpack[t.VolcanoFigureSettings]) -> Volcano:
|
|
560
|
+
"""A new plot holding: Differential results: log2 ``fold_change`` (x) against −log10
|
|
561
|
+
``p`` (y; p = 0 at the smallest positive p, NaN left out). Points are ``up``,
|
|
562
|
+
``down`` or ``n.s.``: up or down when ``p < p_threshold`` and |fold change| ≥
|
|
563
|
+
``fold_change_threshold``, coloured by ``colors`` as a level axis on ``color`` (the
|
|
564
|
+
legend counts them), dashed rules at the thresholds. ``labels`` gives a text per
|
|
565
|
+
point, ``label`` which are drawn (placed as Scatter's). The classification settings
|
|
566
|
+
are read at the call.
|
|
567
|
+
"""
|
|
568
|
+
return _figure_layer(self, "volcano", (fold_change, p), 2, {}, settings)
|
|
569
|
+
|
|
570
|
+
def ma(self, mean: Any, fold_change: Any, p: Any = None,
|
|
571
|
+
**settings: Unpack[t.MaFigureSettings]) -> Ma:
|
|
572
|
+
"""A new plot holding: An MA plot: mean expression ``mean`` (x, on a log10 axis unless
|
|
573
|
+
the axis has a scale) against log2 ``fold_change`` (y), a rule at 0 and dashed ones
|
|
574
|
+
at ± ``fold_change_threshold``. Classes, colors and labels as `Volcano`'s (by fold
|
|
575
|
+
change alone without ``p``; ``label="top"``: the largest |fold change| among the
|
|
576
|
+
significant).
|
|
577
|
+
"""
|
|
578
|
+
return _figure_layer(self, "ma", (mean, fold_change, p), 2, {}, settings)
|
|
579
|
+
|
|
580
|
+
def manhattan(self, chromosomes: Any, positions: Any, p: Any,
|
|
581
|
+
**settings: Unpack[t.ManhattanFigureSettings]) -> Manhattan:
|
|
582
|
+
"""A new plot holding: Genome-wide association results: −log10 ``p`` (y) at
|
|
583
|
+
``positions`` (bp) of ``chromosomes`` laid end to end (x) in natural order (chr1 …
|
|
584
|
+
chr22, X, Y, M), each ``chr_sizes`` long (unset: to its last position), its points
|
|
585
|
+
in the next of the two ``colors``, its name as the tick at its middle (left to
|
|
586
|
+
right, a name that would overlap the last one shown is left out), the x axis from
|
|
587
|
+
the first chromosome's start to the last one's end; a dashed rule at ``threshold``
|
|
588
|
+
(genome-wide significance). ``labels``/``label``/``label_count`` as `Volcano`'s
|
|
589
|
+
(``top``: the most significant beyond ``threshold``).
|
|
590
|
+
"""
|
|
591
|
+
return _figure_layer(self, "manhattan", (chromosomes, positions, p), 3, {}, settings)
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
class FigureTitleMixin(TitleBase):
|
|
595
|
+
"""The typed API of ``FigureTitle``."""
|
|
596
|
+
|
|
597
|
+
if TYPE_CHECKING:
|
|
598
|
+
def set(self, **settings: Unpack[t.FigureTitleSettings]) -> Self: # type: ignore[override]
|
|
599
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
class MainTitleMixin(FigureTitle):
|
|
603
|
+
"""The typed API of ``MainTitle``."""
|
|
604
|
+
|
|
605
|
+
if TYPE_CHECKING:
|
|
606
|
+
def set(self, **settings: Unpack[t.MainTitleSettings]) -> Self: # type: ignore[override]
|
|
607
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
class BedMixin(GenomeSeries):
|
|
611
|
+
"""The typed API of ``Bed``."""
|
|
612
|
+
|
|
613
|
+
if TYPE_CHECKING:
|
|
614
|
+
def set(self, **settings: Unpack[t.BedSettings]) -> Self: # type: ignore[override]
|
|
615
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
class GenesMixin(Bed):
|
|
619
|
+
"""The typed API of ``Genes``."""
|
|
620
|
+
|
|
621
|
+
if TYPE_CHECKING:
|
|
622
|
+
def set(self, **settings: Unpack[t.GenesSettings]) -> Self: # type: ignore[override]
|
|
623
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
class GtfMixin(Genes):
|
|
627
|
+
"""The typed API of ``Gtf``."""
|
|
628
|
+
|
|
629
|
+
if TYPE_CHECKING:
|
|
630
|
+
def set(self, **settings: Unpack[t.GtfSettings]) -> Self: # type: ignore[override]
|
|
631
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
class TrackMixin(Plot):
|
|
635
|
+
"""The typed API of ``Track``."""
|
|
636
|
+
|
|
637
|
+
if TYPE_CHECKING:
|
|
638
|
+
def set(self, **settings: Unpack[t.TrackSettings]) -> Self: # type: ignore[override]
|
|
639
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
class LinksMixin(GenomeSeries):
|
|
643
|
+
"""The typed API of ``Links``."""
|
|
644
|
+
|
|
645
|
+
if TYPE_CHECKING:
|
|
646
|
+
def set(self, **settings: Unpack[t.LinksSettings]) -> Self: # type: ignore[override]
|
|
647
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
class DendrogramMixin(Series):
|
|
651
|
+
"""The typed API of ``Dendrogram``."""
|
|
652
|
+
|
|
653
|
+
if TYPE_CHECKING:
|
|
654
|
+
def set(self, **settings: Unpack[t.DendrogramSettings]) -> Self: # type: ignore[override]
|
|
655
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
class QQMixin(Scatter):
|
|
659
|
+
"""The typed API of ``QQ``."""
|
|
660
|
+
|
|
661
|
+
if TYPE_CHECKING:
|
|
662
|
+
def set(self, **settings: Unpack[t.QQSettings]) -> Self: # type: ignore[override]
|
|
663
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
class RaincloudMixin(Series):
|
|
667
|
+
"""The typed API of ``Raincloud``."""
|
|
668
|
+
|
|
669
|
+
if TYPE_CHECKING:
|
|
670
|
+
def set(self, **settings: Unpack[t.RaincloudSettings]) -> Self: # type: ignore[override]
|
|
671
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
class MaMixin(_Thresholds):
|
|
675
|
+
"""The typed API of ``Ma``."""
|
|
676
|
+
|
|
677
|
+
if TYPE_CHECKING:
|
|
678
|
+
def set(self, **settings: Unpack[t.MaSettings]) -> Self: # type: ignore[override]
|
|
679
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
class ManhattanMixin(Scatter):
|
|
683
|
+
"""The typed API of ``Manhattan``."""
|
|
684
|
+
|
|
685
|
+
if TYPE_CHECKING:
|
|
686
|
+
def set(self, **settings: Unpack[t.ManhattanSettings]) -> Self: # type: ignore[override]
|
|
687
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
class VolcanoMixin(_Thresholds):
|
|
691
|
+
"""The typed API of ``Volcano``."""
|
|
692
|
+
|
|
693
|
+
if TYPE_CHECKING:
|
|
694
|
+
def set(self, **settings: Unpack[t.VolcanoSettings]) -> Self: # type: ignore[override]
|
|
695
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
class SizeLegendMixin(Settings):
|
|
699
|
+
"""The typed API of ``SizeLegend``."""
|
|
700
|
+
|
|
701
|
+
if TYPE_CHECKING:
|
|
702
|
+
def set(self, **settings: Unpack[t.SizeLegendSettings]) -> Self: # type: ignore[override]
|
|
703
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
class ColorAxisMixin(_MappedAxis):
|
|
707
|
+
"""The typed API of ``ColorAxis``."""
|
|
708
|
+
|
|
709
|
+
if TYPE_CHECKING:
|
|
710
|
+
def set(self, **settings: Unpack[t.ColorAxisSettings]) -> Self: # type: ignore[override]
|
|
711
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
class SizeAxisMixin(_MappedAxis):
|
|
715
|
+
"""The typed API of ``SizeAxis``."""
|
|
716
|
+
|
|
717
|
+
if TYPE_CHECKING:
|
|
718
|
+
def set(self, **settings: Unpack[t.SizeAxisSettings]) -> Self: # type: ignore[override]
|
|
719
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
class FigureLegendMixin(Legend):
|
|
723
|
+
"""The typed API of ``FigureLegend``."""
|
|
724
|
+
|
|
725
|
+
if TYPE_CHECKING:
|
|
726
|
+
def set(self, **settings: Unpack[t.FigureLegendSettings]) -> Self: # type: ignore[override]
|
|
727
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
class PlotMixin(Settings):
|
|
731
|
+
"""The typed API of ``Plot``."""
|
|
732
|
+
|
|
733
|
+
def scatter(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
734
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
735
|
+
**settings: Unpack[t.ScatterCallSettings]) -> Scatter:
|
|
736
|
+
"""Markers at points ``(x, y)``."""
|
|
737
|
+
return _plot_layer(self, "scatter", (x, y), 2, {"data": data, "group": group,
|
|
738
|
+
"group_order": group_order,
|
|
739
|
+
"group_missing": group_missing,
|
|
740
|
+
"group_colors": group_colors}, settings)
|
|
741
|
+
|
|
742
|
+
def line(self, x: Any, y: Any = None, *, data: Any = None, group: Any = None,
|
|
743
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
744
|
+
**settings: Unpack[t.LineCallSettings]) -> Line:
|
|
745
|
+
"""A line through ``(x, y)``; ``y`` may hold several columns (one line each, sharing
|
|
746
|
+
``x``: a 2-D buffer's columns, a data frame, a list of arrays), and ``x`` may be
|
|
747
|
+
omitted (``0, 1, 2, …``). ``orientation="horizontal"`` draws ``x`` on the y axis (a
|
|
748
|
+
profile along y). Numbers per point (or ``"density"``) in
|
|
749
|
+
``marker_color``/``marker_edge_color`` map through the series' color axis.
|
|
750
|
+
"""
|
|
751
|
+
return _plot_layer(self, "line", (x, y), 1, {"data": data, "group": group,
|
|
752
|
+
"group_order": group_order,
|
|
753
|
+
"group_missing": group_missing,
|
|
754
|
+
"group_colors": group_colors}, settings)
|
|
755
|
+
|
|
756
|
+
def fill(self, x: Any, y1: Any, y2: Any = 0.0, *, data: Any = None, group: Any = None,
|
|
757
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
758
|
+
**settings: Unpack[t.FillCallSettings]) -> Fill:
|
|
759
|
+
"""The area between ``y1`` and ``y2`` (a sequence or a constant) along ``x``;
|
|
760
|
+
``orientation="horizontal"`` fills between x curves along y (``fill(y, x1, x2)``).
|
|
761
|
+
"""
|
|
762
|
+
return _plot_layer(self, "fill", (x, y1, y2), 2, {"data": data, "group": group,
|
|
763
|
+
"group_order": group_order,
|
|
764
|
+
"group_missing": group_missing,
|
|
765
|
+
"group_colors": group_colors}, settings)
|
|
766
|
+
|
|
767
|
+
def box(self, values: Any, positions: Any = None, *, data: Any = None, group: Any = None,
|
|
768
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
769
|
+
**settings: Unpack[t.BoxCallSettings]) -> Box:
|
|
770
|
+
"""Box plots of ``values``: a dict ``{category: values}``, a list of arrays (categories
|
|
771
|
+
``0, 1, …`` or ``categories=``), or one array.
|
|
772
|
+
"""
|
|
773
|
+
return _plot_layer(self, "box", (values, positions), 1, {"data": data, "group": group,
|
|
774
|
+
"group_order": group_order,
|
|
775
|
+
"group_missing": group_missing,
|
|
776
|
+
"group_colors": group_colors}, settings)
|
|
777
|
+
|
|
778
|
+
def heatmap(self, values: Any, x: Any = None, y: Any = None, *, data: Any = None,
|
|
779
|
+
group: Any = None, group_order: Any = None, group_missing: Any = None,
|
|
780
|
+
group_colors: Any = None, **settings: Unpack[t.HeatmapCallSettings]) -> Heatmap:
|
|
781
|
+
"""A grid of values (rows first) as colored cells; ``x``/``y`` give cell labels,
|
|
782
|
+
centres or edges.
|
|
783
|
+
"""
|
|
784
|
+
return _plot_layer(self, "heatmap", (values, x, y), 1, {"data": data, "group": group,
|
|
785
|
+
"group_order": group_order,
|
|
786
|
+
"group_missing": group_missing,
|
|
787
|
+
"group_colors": group_colors}, settings)
|
|
788
|
+
|
|
789
|
+
def bar(self, x: Any, y: Any = None, *, data: Any = None, group: Any = None,
|
|
790
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
791
|
+
**settings: Unpack[t.BarCallSettings]) -> Bar:
|
|
792
|
+
"""Bars of height ``y`` at ``x`` (categories or numbers), or of a dict ``{category:
|
|
793
|
+
height}``, or of heights alone (at 0, 1, …).
|
|
794
|
+
"""
|
|
795
|
+
return _plot_layer(self, "bar", (x, y), 1, {"data": data, "group": group,
|
|
796
|
+
"group_order": group_order,
|
|
797
|
+
"group_missing": group_missing,
|
|
798
|
+
"group_colors": group_colors}, settings)
|
|
799
|
+
|
|
800
|
+
def hist(self, values: Any, *, data: Any = None, group: Any = None, group_order: Any = None,
|
|
801
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
802
|
+
**settings: Unpack[t.HistCallSettings]) -> Hist:
|
|
803
|
+
"""A histogram of ``values``: one array, or several (a dict or a list of arrays) that
|
|
804
|
+
share the same bins.
|
|
805
|
+
"""
|
|
806
|
+
return _plot_layer(self, "hist", (values,), 1, {"data": data, "group": group,
|
|
807
|
+
"group_order": group_order,
|
|
808
|
+
"group_missing": group_missing,
|
|
809
|
+
"group_colors": group_colors}, settings)
|
|
810
|
+
|
|
811
|
+
def kde(self, values: Any, y: Any = None, *, data: Any = None, group: Any = None,
|
|
812
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
813
|
+
**settings: Unpack[t.KdeCallSettings]) -> Kde:
|
|
814
|
+
"""A Gaussian kernel density estimate of ``values`` (one array, or several as a dict or
|
|
815
|
+
a list of arrays, on a common grid).
|
|
816
|
+
"""
|
|
817
|
+
return _plot_layer(self, "kde", (values, y), 1, {"data": data, "group": group,
|
|
818
|
+
"group_order": group_order,
|
|
819
|
+
"group_missing": group_missing,
|
|
820
|
+
"group_colors": group_colors}, settings)
|
|
821
|
+
|
|
822
|
+
def ecdf(self, values: Any, *, data: Any = None, group: Any = None, group_order: Any = None,
|
|
823
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
824
|
+
**settings: Unpack[t.EcdfCallSettings]) -> Ecdf:
|
|
825
|
+
"""The empirical cumulative distribution of ``values`` (one array, or several as a dict
|
|
826
|
+
or a list of arrays).
|
|
827
|
+
"""
|
|
828
|
+
return _plot_layer(self, "ecdf", (values,), 1, {"data": data, "group": group,
|
|
829
|
+
"group_order": group_order,
|
|
830
|
+
"group_missing": group_missing,
|
|
831
|
+
"group_colors": group_colors}, settings)
|
|
832
|
+
|
|
833
|
+
def violin(self, values: Any, positions: Any = None, *, data: Any = None, group: Any = None,
|
|
834
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
835
|
+
**settings: Unpack[t.ViolinCallSettings]) -> Violin:
|
|
836
|
+
"""Violins of ``values``: a dict ``{category: values}``, a list of arrays (categories
|
|
837
|
+
``0, 1, …`` or ``categories=``), or one array.
|
|
838
|
+
"""
|
|
839
|
+
return _plot_layer(self, "violin", (values, positions), 1, {"data": data,
|
|
840
|
+
"group": group,
|
|
841
|
+
"group_order": group_order,
|
|
842
|
+
"group_missing": group_missing,
|
|
843
|
+
"group_colors": group_colors}, settings)
|
|
844
|
+
|
|
845
|
+
def strip(self, values: Any, positions: Any = None, *, data: Any = None, group: Any = None,
|
|
846
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
847
|
+
**settings: Unpack[t.StripCallSettings]) -> Strip:
|
|
848
|
+
"""Points of each category's values, spread across the slot by random jitter (from a
|
|
849
|
+
fixed seed, so output is reproducible).
|
|
850
|
+
"""
|
|
851
|
+
return _plot_layer(self, "strip", (values, positions), 1, {"data": data, "group": group,
|
|
852
|
+
"group_order": group_order,
|
|
853
|
+
"group_missing": group_missing,
|
|
854
|
+
"group_colors": group_colors}, settings)
|
|
855
|
+
|
|
856
|
+
def swarm(self, values: Any, positions: Any = None, *, data: Any = None, group: Any = None,
|
|
857
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
858
|
+
**settings: Unpack[t.SwarmCallSettings]) -> Swarm:
|
|
859
|
+
"""Points of each category's values, side by side so that they do not overlap (points
|
|
860
|
+
that do not fit go to the slot's edge, with a warning; above 100,000 points,
|
|
861
|
+
jittered across the width as a strip, with a warning).
|
|
862
|
+
"""
|
|
863
|
+
return _plot_layer(self, "swarm", (values, positions), 1, {"data": data, "group": group,
|
|
864
|
+
"group_order": group_order,
|
|
865
|
+
"group_missing": group_missing,
|
|
866
|
+
"group_colors": group_colors}, settings)
|
|
867
|
+
|
|
868
|
+
def area(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
869
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
870
|
+
**settings: Unpack[t.AreaCallSettings]) -> Area:
|
|
871
|
+
"""Areas of the layers ``y`` (one column, or several: a dict ``{name: values}``, a data
|
|
872
|
+
frame, a 2-D buffer's columns, a list of arrays) along ``x``, stacked on
|
|
873
|
+
``baseline``; ``orientation="horizontal"`` runs them along y.
|
|
874
|
+
"""
|
|
875
|
+
return _plot_layer(self, "area", (x, y), 2, {"data": data, "group": group,
|
|
876
|
+
"group_order": group_order,
|
|
877
|
+
"group_missing": group_missing,
|
|
878
|
+
"group_colors": group_colors}, settings)
|
|
879
|
+
|
|
880
|
+
def errorbar(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
881
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
882
|
+
**settings: Unpack[t.ErrorbarCallSettings]) -> Errorbar:
|
|
883
|
+
"""Error bars at ``(x, y)``: ``y_error``/``x_error`` as a value, a sequence, ``(low,
|
|
884
|
+
high)`` or ``Errors``; ``marker`` adds markers at the points (numbers per point in
|
|
885
|
+
``marker_color`` map through the series' color axis).
|
|
886
|
+
"""
|
|
887
|
+
return _plot_layer(self, "errorbar", (x, y), 2, {"data": data, "group": group,
|
|
888
|
+
"group_order": group_order,
|
|
889
|
+
"group_missing": group_missing,
|
|
890
|
+
"group_colors": group_colors}, settings)
|
|
891
|
+
|
|
892
|
+
def stem(self, x: Any, y: Any = None, *, data: Any = None, group: Any = None,
|
|
893
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
894
|
+
**settings: Unpack[t.StemCallSettings]) -> Stem:
|
|
895
|
+
"""Stems from ``baseline`` to ``y`` at ``x`` (or at 0, 1, … when ``y`` is omitted);
|
|
896
|
+
numbers per point in ``marker_color`` map through the series' color axis.
|
|
897
|
+
"""
|
|
898
|
+
return _plot_layer(self, "stem", (x, y), 1, {"data": data, "group": group,
|
|
899
|
+
"group_order": group_order,
|
|
900
|
+
"group_missing": group_missing,
|
|
901
|
+
"group_colors": group_colors}, settings)
|
|
902
|
+
|
|
903
|
+
def regression(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
904
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
905
|
+
**settings: Unpack[t.RegressionCallSettings]) -> Regression:
|
|
906
|
+
"""A regression of ``y`` on ``x``: a polynomial of ``order`` (least squares) with a
|
|
907
|
+
confidence band of the mean, or a LOWESS curve; ``scatter`` also draws the points
|
|
908
|
+
(numbers per point in ``marker_color`` map through the series' color axis).
|
|
909
|
+
"""
|
|
910
|
+
return _plot_layer(self, "regression", (x, y), 2, {"data": data, "group": group,
|
|
911
|
+
"group_order": group_order,
|
|
912
|
+
"group_missing": group_missing,
|
|
913
|
+
"group_colors": group_colors}, settings)
|
|
914
|
+
|
|
915
|
+
def hist2d(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
916
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
917
|
+
**settings: Unpack[t.Hist2dCallSettings]) -> Hist2d:
|
|
918
|
+
"""A 2-D histogram of points ``(x, y)``: counts in bins (even on the axis scales),
|
|
919
|
+
drawn as a heatmap; bins with fewer than ``min_count`` points are left empty.
|
|
920
|
+
"""
|
|
921
|
+
return _plot_layer(self, "hist2d", (x, y), 2, {"data": data, "group": group,
|
|
922
|
+
"group_order": group_order,
|
|
923
|
+
"group_missing": group_missing,
|
|
924
|
+
"group_colors": group_colors}, settings)
|
|
925
|
+
|
|
926
|
+
def hexbin(self, x: Any, y: Any, *, data: Any = None, group: Any = None,
|
|
927
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
928
|
+
**settings: Unpack[t.HexbinCallSettings]) -> Hexbin:
|
|
929
|
+
"""A hexagonal 2-D histogram of points ``(x, y)``: ``bins`` regular hexagons across the
|
|
930
|
+
axes width. The lattice is laid out in page units for the axes the layout placed
|
|
931
|
+
(its domain is the data's, its bins the axes'), so the hexagons are regular and tile
|
|
932
|
+
exactly whatever the axes' aspect.
|
|
933
|
+
"""
|
|
934
|
+
return _plot_layer(self, "hexbin", (x, y), 2, {"data": data, "group": group,
|
|
935
|
+
"group_order": group_order,
|
|
936
|
+
"group_missing": group_missing,
|
|
937
|
+
"group_colors": group_colors}, settings)
|
|
938
|
+
|
|
939
|
+
def contour(self, values: Any, x: Any = None, y: Any = None, *, data: Any = None,
|
|
940
|
+
group: Any = None, group_order: Any = None, group_missing: Any = None,
|
|
941
|
+
group_colors: Any = None, **settings: Unpack[t.ContourCallSettings]) -> Contour:
|
|
942
|
+
"""Contour lines and/or filled bands of ``values`` (rows first) at nodes ``x``/``y``
|
|
943
|
+
(centres; edges are reduced to their midpoints).
|
|
944
|
+
"""
|
|
945
|
+
return _plot_layer(self, "contour", (values, x, y), 1, {"data": data, "group": group,
|
|
946
|
+
"group_order": group_order,
|
|
947
|
+
"group_missing": group_missing,
|
|
948
|
+
"group_colors": group_colors}, settings)
|
|
949
|
+
|
|
950
|
+
def pie(self, values: Any, *, data: Any = None, group: Any = None, group_order: Any = None,
|
|
951
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
952
|
+
**settings: Unpack[t.PieCallSettings]) -> Pie:
|
|
953
|
+
"""A pie (or donut, with ``hole``) of ``values``: a sequence, or a dict ``{label:
|
|
954
|
+
value}``; the plot is drawn without axes.
|
|
955
|
+
"""
|
|
956
|
+
return _plot_layer(self, "pie", (values,), 1, {"data": data, "group": group,
|
|
957
|
+
"group_order": group_order,
|
|
958
|
+
"group_missing": group_missing,
|
|
959
|
+
"group_colors": group_colors}, settings)
|
|
960
|
+
|
|
961
|
+
def dots(self, color: Any = None, size: Any = None, x: Any = None, y: Any = None, *,
|
|
962
|
+
data: Any = None, group: Any = None, group_order: Any = None,
|
|
963
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
964
|
+
**settings: Unpack[t.DotsCallSettings]) -> Dots:
|
|
965
|
+
"""One marker per cell of a grid: ``color`` and ``size`` are grids of values (row 0
|
|
966
|
+
first) of one shape, or one value; ``x``/``y`` label the columns and rows, as
|
|
967
|
+
``heatmap``'s. With long data (``x``, ``y`` and values per cell), the cells come
|
|
968
|
+
from the rows; cells without a row get no dot.
|
|
969
|
+
"""
|
|
970
|
+
return _plot_layer(self, "dots", (color, size, x, y), 0, {"data": data, "group": group,
|
|
971
|
+
"group_order": group_order,
|
|
972
|
+
"group_missing": group_missing,
|
|
973
|
+
"group_colors": group_colors}, settings)
|
|
974
|
+
|
|
975
|
+
def bigwig(self, reader: Any = None, *, x: Any = None, y: Any = None,
|
|
976
|
+
**settings: Unpack[t.BigWigSettings]) -> BigWig:
|
|
977
|
+
"""A binned signal over the region: a step line along the bins, filled to a baseline.
|
|
978
|
+
``reader`` is a signal reader (bigWig; bigBed, BED and peaks give their coverage;
|
|
979
|
+
:func:`~plot_io.genome.combine.combine` of two), a path (opened with gwseq_io),
|
|
980
|
+
``chr``, ``start``, ``end``, ``value`` records (columns, a DataFrame or rows; binned
|
|
981
|
+
by plot_io), a function ``f(chr, start, end, bins)`` giving values, or ``None`` with
|
|
982
|
+
``y`` (values over the region) and optionally ``x`` (bin centres, or n + 1 edges, in
|
|
983
|
+
bp).
|
|
984
|
+
"""
|
|
985
|
+
return _plot_layer(self, "bigwig", (reader,), 0, {"x": x, "y": y}, settings)
|
|
986
|
+
|
|
987
|
+
def bed(self, reader: Any, **settings: Unpack[t.BedSettings]) -> Bed:
|
|
988
|
+
"""Intervals over the region: boxes or gene models, on one row or packed onto rows.
|
|
989
|
+
``reader`` is an interval reader (bigBed, BED, peaks), a path (opened with gwseq_io)
|
|
990
|
+
or plain data: a dict of columns, a DataFrame, or rows (``start``, ``end`` and
|
|
991
|
+
optionally ``name``, ``score``, ``strand``, ``thickStart``, ``thickEnd``,
|
|
992
|
+
``itemRgb``, ``blockCount``, ``blockSizes``, ``blockStarts``).
|
|
993
|
+
"""
|
|
994
|
+
return _plot_layer(self, "bed", (reader,), 1, {}, settings)
|
|
995
|
+
|
|
996
|
+
def genes(self, reader: Any, **settings: Unpack[t.GenesSettings]) -> Genes:
|
|
997
|
+
"""Gene models (BED12): ``Bed`` with ``kind="genes"``, rows expanded and names on."""
|
|
998
|
+
return _plot_layer(self, "genes", (reader,), 1, {}, settings)
|
|
999
|
+
|
|
1000
|
+
def gtf(self, reader: Any, **settings: Unpack[t.GtfSettings]) -> Gtf:
|
|
1001
|
+
"""Gene models of a GTF or GFF3 reader (``read_entries(model=)``) or path: ``Genes``,
|
|
1002
|
+
one model per gene (its transcripts' exons merged) or per transcript, or plain BED12
|
|
1003
|
+
data as ``Genes`` takes it.
|
|
1004
|
+
"""
|
|
1005
|
+
return _plot_layer(self, "gtf", (reader,), 1, {}, settings)
|
|
1006
|
+
|
|
1007
|
+
def hic(self, reader: Any, **settings: Unpack[t.HiCSettings]) -> HiC:
|
|
1008
|
+
"""The upper triangle of a contact matrix, the diagonal along the x axis (each cell a
|
|
1009
|
+
diamond), or with ``shape="square"`` the whole matrix of ``region`` (x) against
|
|
1010
|
+
``region2`` (y, its start at the top). ``reader`` is a Hi-C reader, a path (opened
|
|
1011
|
+
with gwseq_io), or a square matrix over the region (bins of ``span / n``).
|
|
1012
|
+
"""
|
|
1013
|
+
return _plot_layer(self, "hic", (reader,), 1, {}, settings)
|
|
1014
|
+
|
|
1015
|
+
def links(self, pairs: Any, **settings: Unpack[t.LinksSettings]) -> Links:
|
|
1016
|
+
"""Links between pairs of places (BEDPE): an arc from anchor centre to anchor centre in
|
|
1017
|
+
a lane of its own, or, ``lane="over"`` a Hi-C triangle or square, a mark at each
|
|
1018
|
+
pair's contact cell (on a square, and at its mirror). ``pairs`` is a reader whose
|
|
1019
|
+
``read_entries`` gives the BEDPE columns, a path gwseq_io reads them from, or plain
|
|
1020
|
+
data (the pairs with an anchor in view are read): a dict of columns, a DataFrame, or
|
|
1021
|
+
rows in BEDPE order (``chr1``, ``start1``, ``end1``, ``chr2``, ``start2``, ``end2``,
|
|
1022
|
+
then optionally ``name``, ``score``).
|
|
1023
|
+
"""
|
|
1024
|
+
return _plot_layer(self, "links", (pairs,), 1, {}, settings)
|
|
1025
|
+
|
|
1026
|
+
def site_heatmap(self, signal: Any, sites: Any, *, group: Any = None,
|
|
1027
|
+
**settings: Unpack[t.SiteHeatmapSettings]) -> SiteHeatmap:
|
|
1028
|
+
"""A signal around sites, one row per site (a table with ``chr``, ``start``, ``end``
|
|
1029
|
+
and optional ``strand``, ``summit`` columns, or an interval reader), x the distance
|
|
1030
|
+
from the anchor in bp; ``group`` (a column of the sites, or a label per site) makes
|
|
1031
|
+
a block of rows per group.
|
|
1032
|
+
"""
|
|
1033
|
+
return _plot_layer(self, "site_heatmap", (signal, sites), 2, {"group": group}, settings)
|
|
1034
|
+
|
|
1035
|
+
def site_profile(self, signal: Any, sites: Any, *, group: Any = None,
|
|
1036
|
+
**settings: Unpack[t.SiteProfileSettings]) -> SiteProfile:
|
|
1037
|
+
"""The column mean (or median) of a signal around sites (see :class:`SiteHeatmap`): one
|
|
1038
|
+
line per group, x the distance from the anchor in bp, an optional band.
|
|
1039
|
+
"""
|
|
1040
|
+
return _plot_layer(self, "site_profile", (signal, sites), 2, {"group": group}, settings)
|
|
1041
|
+
|
|
1042
|
+
def dendrogram(self, tree: Any, labels: Any = None,
|
|
1043
|
+
**settings: Unpack[t.DendrogramSettings]) -> Dendrogram:
|
|
1044
|
+
"""The merges of ``tree`` (a :class:`Tree`, or a scipy ``Z``) as U-shaped links: the
|
|
1045
|
+
leaves at slots 0, 1, … in ``tree.leaves`` order on the leaf axis, the heights on
|
|
1046
|
+
the value axis, the root at the top (``orientation="horizontal"``: at the left,
|
|
1047
|
+
heights along x, the x axis inverted unless set). ``labels`` (default: the tree's)
|
|
1048
|
+
make the leaf axis categorical, in leaf order, so a heatmap with the same categories
|
|
1049
|
+
shares it; without labels each leaf is ticked with its observation's index. Every
|
|
1050
|
+
leaf is labelled: turned 90° when the labels do not fit flat, then smaller, down to
|
|
1051
|
+
the axis' ``label_min_size`` (6 pt), and every k-th only below it.
|
|
1052
|
+
"""
|
|
1053
|
+
return _plot_layer(self, "dendrogram", (tree, labels), 1, {}, settings)
|
|
1054
|
+
|
|
1055
|
+
def qq(self, values: Any, y: Any = None, **settings: Unpack[t.QQSettings]) -> QQ:
|
|
1056
|
+
"""The sorted ``values`` against the quantiles of ``dist`` at R's ``ppoints`` (``(i −
|
|
1057
|
+
a) / (n + 1 − 2a)``, a = 3/8 for n ≤ 10, else 1/2), or against the sorted ``y`` (two
|
|
1058
|
+
samples: the longer interpolated to the shorter's size, as R's ``qqplot``;
|
|
1059
|
+
``values`` on x). ``pvalues=True``: ``values`` are p-values, drawn as −log10 of the
|
|
1060
|
+
sorted p-values (y) against −log10 of the expected uniform quantiles (x). Points as
|
|
1061
|
+
`Scatter`'s; the reference ``line`` and the pointwise ``band`` of order statistics
|
|
1062
|
+
in the series color. The points and the default line are R's (``qqnorm``,
|
|
1063
|
+
``qqline``), not scipy's ``probplot`` (Filliben's medians, a least-squares line).
|
|
1064
|
+
"""
|
|
1065
|
+
return _plot_layer(self, "qq", (values, y), 1, {}, settings)
|
|
1066
|
+
|
|
1067
|
+
def raincloud(self, values: Any, positions: Any = None,
|
|
1068
|
+
**settings: Unpack[t.RaincloudSettings]) -> Raincloud:
|
|
1069
|
+
"""Rainclouds of ``values`` (a dict ``{category: values}``, a list of arrays, or one
|
|
1070
|
+
array; long data with ``x=`` categories): per category a half violin on the high
|
|
1071
|
+
side (stat ``violin``), a narrow box at the centre (stat ``box``) and the values as
|
|
1072
|
+
jittered points on the low side. ``parts`` keeps some of the three. Widths and
|
|
1073
|
+
offsets are `%` of the slot.
|
|
1074
|
+
"""
|
|
1075
|
+
return _plot_layer(self, "raincloud", (values, positions), 1, {}, settings)
|
|
1076
|
+
|
|
1077
|
+
def volcano(self, fold_change: Any, p: Any,
|
|
1078
|
+
**settings: Unpack[t.VolcanoSettings]) -> Volcano:
|
|
1079
|
+
"""Differential results: log2 ``fold_change`` (x) against −log10 ``p`` (y; p = 0 at the
|
|
1080
|
+
smallest positive p, NaN left out). Points are ``up``, ``down`` or ``n.s.``: up or
|
|
1081
|
+
down when ``p < p_threshold`` and |fold change| ≥ ``fold_change_threshold``,
|
|
1082
|
+
coloured by ``colors`` as a level axis on ``color`` (the legend counts them), dashed
|
|
1083
|
+
rules at the thresholds. ``labels`` gives a text per point, ``label`` which are
|
|
1084
|
+
drawn (placed as Scatter's). The classification settings are read at the call.
|
|
1085
|
+
"""
|
|
1086
|
+
return _plot_layer(self, "volcano", (fold_change, p), 2, {}, settings)
|
|
1087
|
+
|
|
1088
|
+
def ma(self, mean: Any, fold_change: Any, p: Any = None,
|
|
1089
|
+
**settings: Unpack[t.MaSettings]) -> Ma:
|
|
1090
|
+
"""An MA plot: mean expression ``mean`` (x, on a log10 axis unless the axis has a
|
|
1091
|
+
scale) against log2 ``fold_change`` (y), a rule at 0 and dashed ones at ±
|
|
1092
|
+
``fold_change_threshold``. Classes, colors and labels as `Volcano`'s (by fold change
|
|
1093
|
+
alone without ``p``; ``label="top"``: the largest |fold change| among the
|
|
1094
|
+
significant).
|
|
1095
|
+
"""
|
|
1096
|
+
return _plot_layer(self, "ma", (mean, fold_change, p), 2, {}, settings)
|
|
1097
|
+
|
|
1098
|
+
def manhattan(self, chromosomes: Any, positions: Any, p: Any,
|
|
1099
|
+
**settings: Unpack[t.ManhattanSettings]) -> Manhattan:
|
|
1100
|
+
"""Genome-wide association results: −log10 ``p`` (y) at ``positions`` (bp) of
|
|
1101
|
+
``chromosomes`` laid end to end (x) in natural order (chr1 … chr22, X, Y, M), each
|
|
1102
|
+
``chr_sizes`` long (unset: to its last position), its points in the next of the two
|
|
1103
|
+
``colors``, its name as the tick at its middle (left to right, a name that would
|
|
1104
|
+
overlap the last one shown is left out), the x axis from the first chromosome's
|
|
1105
|
+
start to the last one's end; a dashed rule at ``threshold`` (genome-wide
|
|
1106
|
+
significance). ``labels``/``label``/``label_count`` as `Volcano`'s (``top``: the
|
|
1107
|
+
most significant beyond ``threshold``).
|
|
1108
|
+
"""
|
|
1109
|
+
return _plot_layer(self, "manhattan", (chromosomes, positions, p), 3, {}, settings)
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
class TitleMixin(TitleBase):
|
|
1113
|
+
"""The typed API of ``Title``."""
|
|
1114
|
+
|
|
1115
|
+
if TYPE_CHECKING:
|
|
1116
|
+
def set(self, **settings: Unpack[t.TitleSettings]) -> Self: # type: ignore[override]
|
|
1117
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
class AreaMixin(Series):
|
|
1121
|
+
"""The typed API of ``Area``."""
|
|
1122
|
+
|
|
1123
|
+
if TYPE_CHECKING:
|
|
1124
|
+
def set(self, **settings: Unpack[t.AreaSettings]) -> Self: # type: ignore[override]
|
|
1125
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
class BarMixin(Summarized):
|
|
1129
|
+
"""The typed API of ``Bar``."""
|
|
1130
|
+
|
|
1131
|
+
if TYPE_CHECKING:
|
|
1132
|
+
def set(self, **settings: Unpack[t.BarSettings]) -> Self: # type: ignore[override]
|
|
1133
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
class BoxMixin(Series):
|
|
1137
|
+
"""The typed API of ``Box``."""
|
|
1138
|
+
|
|
1139
|
+
if TYPE_CHECKING:
|
|
1140
|
+
def set(self, **settings: Unpack[t.BoxSettings]) -> Self: # type: ignore[override]
|
|
1141
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
class StripMixin(_CatPoints):
|
|
1145
|
+
"""The typed API of ``Strip``."""
|
|
1146
|
+
|
|
1147
|
+
if TYPE_CHECKING:
|
|
1148
|
+
def set(self, **settings: Unpack[t.StripSettings]) -> Self: # type: ignore[override]
|
|
1149
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
class SwarmMixin(_CatPoints):
|
|
1153
|
+
"""The typed API of ``Swarm``."""
|
|
1154
|
+
|
|
1155
|
+
if TYPE_CHECKING:
|
|
1156
|
+
def set(self, **settings: Unpack[t.SwarmSettings]) -> Self: # type: ignore[override]
|
|
1157
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
class ContourMixin(Series):
|
|
1161
|
+
"""The typed API of ``Contour``."""
|
|
1162
|
+
|
|
1163
|
+
if TYPE_CHECKING:
|
|
1164
|
+
def set(self, **settings: Unpack[t.ContourSettings]) -> Self: # type: ignore[override]
|
|
1165
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
class EcdfMixin(Series):
|
|
1169
|
+
"""The typed API of ``Ecdf``."""
|
|
1170
|
+
|
|
1171
|
+
if TYPE_CHECKING:
|
|
1172
|
+
def set(self, **settings: Unpack[t.EcdfSettings]) -> Self: # type: ignore[override]
|
|
1173
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
class ErrorbarMixin(Summarized):
|
|
1177
|
+
"""The typed API of ``Errorbar``."""
|
|
1178
|
+
|
|
1179
|
+
if TYPE_CHECKING:
|
|
1180
|
+
def set(self, **settings: Unpack[t.ErrorbarSettings]) -> Self: # type: ignore[override]
|
|
1181
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
class FillMixin(Series):
|
|
1185
|
+
"""The typed API of ``Fill``."""
|
|
1186
|
+
|
|
1187
|
+
if TYPE_CHECKING:
|
|
1188
|
+
def set(self, **settings: Unpack[t.FillSettings]) -> Self: # type: ignore[override]
|
|
1189
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
class HeatmapMixin(Series):
|
|
1193
|
+
"""The typed API of ``Heatmap``."""
|
|
1194
|
+
|
|
1195
|
+
if TYPE_CHECKING:
|
|
1196
|
+
def set(self, **settings: Unpack[t.HeatmapSettings]) -> Self: # type: ignore[override]
|
|
1197
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
class HexbinMixin(Series):
|
|
1201
|
+
"""The typed API of ``Hexbin``."""
|
|
1202
|
+
|
|
1203
|
+
if TYPE_CHECKING:
|
|
1204
|
+
def set(self, **settings: Unpack[t.HexbinSettings]) -> Self: # type: ignore[override]
|
|
1205
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
class HistMixin(Series):
|
|
1209
|
+
"""The typed API of ``Hist``."""
|
|
1210
|
+
|
|
1211
|
+
if TYPE_CHECKING:
|
|
1212
|
+
def set(self, **settings: Unpack[t.HistSettings]) -> Self: # type: ignore[override]
|
|
1213
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
class Hist2dMixin(Heatmap):
|
|
1217
|
+
"""The typed API of ``Hist2d``."""
|
|
1218
|
+
|
|
1219
|
+
if TYPE_CHECKING:
|
|
1220
|
+
def set(self, **settings: Unpack[t.Hist2dSettings]) -> Self: # type: ignore[override]
|
|
1221
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
class KdeMixin(Series):
|
|
1225
|
+
"""The typed API of ``Kde``."""
|
|
1226
|
+
|
|
1227
|
+
if TYPE_CHECKING:
|
|
1228
|
+
def set(self, **settings: Unpack[t.KdeSettings]) -> Self: # type: ignore[override]
|
|
1229
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
class Kde2dMixin(Contour):
|
|
1233
|
+
"""The typed API of ``Kde2d``."""
|
|
1234
|
+
|
|
1235
|
+
if TYPE_CHECKING:
|
|
1236
|
+
def set(self, **settings: Unpack[t.Kde2dSettings]) -> Self: # type: ignore[override]
|
|
1237
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
class PieMixin(Series):
|
|
1241
|
+
"""The typed API of ``Pie``."""
|
|
1242
|
+
|
|
1243
|
+
if TYPE_CHECKING:
|
|
1244
|
+
def set(self, **settings: Unpack[t.PieSettings]) -> Self: # type: ignore[override]
|
|
1245
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
class RegressionMixin(Series):
|
|
1249
|
+
"""The typed API of ``Regression``."""
|
|
1250
|
+
|
|
1251
|
+
if TYPE_CHECKING:
|
|
1252
|
+
def set(self, **settings: Unpack[t.RegressionSettings]) -> Self: # type: ignore[override]
|
|
1253
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
class ScatterMixin(Summarized):
|
|
1257
|
+
"""The typed API of ``Scatter``."""
|
|
1258
|
+
|
|
1259
|
+
if TYPE_CHECKING:
|
|
1260
|
+
def set(self, **settings: Unpack[t.ScatterSettings]) -> Self: # type: ignore[override]
|
|
1261
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
class StemMixin(Summarized):
|
|
1265
|
+
"""The typed API of ``Stem``."""
|
|
1266
|
+
|
|
1267
|
+
if TYPE_CHECKING:
|
|
1268
|
+
def set(self, **settings: Unpack[t.StemSettings]) -> Self: # type: ignore[override]
|
|
1269
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
class ViolinMixin(Series):
|
|
1273
|
+
"""The typed API of ``Violin``."""
|
|
1274
|
+
|
|
1275
|
+
if TYPE_CHECKING:
|
|
1276
|
+
def set(self, **settings: Unpack[t.ViolinSettings]) -> Self: # type: ignore[override]
|
|
1277
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
class FigureGroupMixin(Settings):
|
|
1281
|
+
"""The typed API of ``FigureGroup``."""
|
|
1282
|
+
|
|
1283
|
+
if TYPE_CHECKING:
|
|
1284
|
+
def set(self, **settings: Unpack[t.FigureGroupSettings]) -> Self: # type: ignore[override]
|
|
1285
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
class FigureVLineMixin(Settings):
|
|
1289
|
+
"""The typed API of ``FigureVLine``."""
|
|
1290
|
+
|
|
1291
|
+
if TYPE_CHECKING:
|
|
1292
|
+
def set(self, **settings: Unpack[t.FigureVLineSettings]) -> Self: # type: ignore[override]
|
|
1293
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
class FigureVSpanMixin(Settings):
|
|
1297
|
+
"""The typed API of ``FigureVSpan``."""
|
|
1298
|
+
|
|
1299
|
+
if TYPE_CHECKING:
|
|
1300
|
+
def set(self, **settings: Unpack[t.FigureVSpanSettings]) -> Self: # type: ignore[override]
|
|
1301
|
+
"""Set settings; ``None`` goes back to the inherited or default value."""
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
class PanelSetMixin(object):
|
|
1305
|
+
"""The typed API of ``PanelSet``."""
|
|
1306
|
+
|
|
1307
|
+
def scatter(self, x: Any, y: Any, *, group: Any = None, group_order: Any = None,
|
|
1308
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1309
|
+
**settings: Unpack[t.ScatterCallSettings]) -> LayerSet:
|
|
1310
|
+
"""One per panel: Markers at points ``(x, y)``."""
|
|
1311
|
+
return _panelset_layer(self, "scatter", (x, y), 2, {"group": group,
|
|
1312
|
+
"group_order": group_order,
|
|
1313
|
+
"group_missing": group_missing,
|
|
1314
|
+
"group_colors": group_colors}, settings)
|
|
1315
|
+
|
|
1316
|
+
def line(self, x: Any, y: Any = None, *, group: Any = None, group_order: Any = None,
|
|
1317
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1318
|
+
**settings: Unpack[t.LineCallSettings]) -> LayerSet:
|
|
1319
|
+
"""One per panel: A line through ``(x, y)``; ``y`` may hold several columns (one line
|
|
1320
|
+
each, sharing ``x``: a 2-D buffer's columns, a data frame, a list of arrays), and
|
|
1321
|
+
``x`` may be omitted (``0, 1, 2, …``). ``orientation="horizontal"`` draws ``x`` on
|
|
1322
|
+
the y axis (a profile along y). Numbers per point (or ``"density"``) in
|
|
1323
|
+
``marker_color``/``marker_edge_color`` map through the series' color axis.
|
|
1324
|
+
"""
|
|
1325
|
+
return _panelset_layer(self, "line", (x, y), 1, {"group": group,
|
|
1326
|
+
"group_order": group_order,
|
|
1327
|
+
"group_missing": group_missing,
|
|
1328
|
+
"group_colors": group_colors}, settings)
|
|
1329
|
+
|
|
1330
|
+
def fill(self, x: Any, y1: Any, y2: Any = 0.0, *, group: Any = None,
|
|
1331
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
1332
|
+
**settings: Unpack[t.FillCallSettings]) -> LayerSet:
|
|
1333
|
+
"""One per panel: The area between ``y1`` and ``y2`` (a sequence or a constant) along
|
|
1334
|
+
``x``; ``orientation="horizontal"`` fills between x curves along y (``fill(y, x1,
|
|
1335
|
+
x2)``).
|
|
1336
|
+
"""
|
|
1337
|
+
return _panelset_layer(self, "fill", (x, y1, y2), 2, {"group": group,
|
|
1338
|
+
"group_order": group_order,
|
|
1339
|
+
"group_missing": group_missing,
|
|
1340
|
+
"group_colors": group_colors}, settings)
|
|
1341
|
+
|
|
1342
|
+
def box(self, values: Any, positions: Any = None, *, group: Any = None,
|
|
1343
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
1344
|
+
**settings: Unpack[t.BoxCallSettings]) -> LayerSet:
|
|
1345
|
+
"""One per panel: Box plots of ``values``: a dict ``{category: values}``, a list of
|
|
1346
|
+
arrays (categories ``0, 1, …`` or ``categories=``), or one array.
|
|
1347
|
+
"""
|
|
1348
|
+
return _panelset_layer(self, "box", (values, positions), 1, {"group": group,
|
|
1349
|
+
"group_order": group_order,
|
|
1350
|
+
"group_missing": group_missing,
|
|
1351
|
+
"group_colors": group_colors}, settings)
|
|
1352
|
+
|
|
1353
|
+
def heatmap(self, values: Any, x: Any = None, y: Any = None, *, group: Any = None,
|
|
1354
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
1355
|
+
**settings: Unpack[t.HeatmapCallSettings]) -> LayerSet:
|
|
1356
|
+
"""One per panel: A grid of values (rows first) as colored cells; ``x``/``y`` give cell
|
|
1357
|
+
labels, centres or edges.
|
|
1358
|
+
"""
|
|
1359
|
+
return _panelset_layer(self, "heatmap", (values, x, y), 1, {"group": group,
|
|
1360
|
+
"group_order": group_order,
|
|
1361
|
+
"group_missing": group_missing,
|
|
1362
|
+
"group_colors": group_colors}, settings)
|
|
1363
|
+
|
|
1364
|
+
def bar(self, x: Any, y: Any = None, *, group: Any = None, group_order: Any = None,
|
|
1365
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1366
|
+
**settings: Unpack[t.BarCallSettings]) -> LayerSet:
|
|
1367
|
+
"""One per panel: Bars of height ``y`` at ``x`` (categories or numbers), or of a dict
|
|
1368
|
+
``{category: height}``, or of heights alone (at 0, 1, …).
|
|
1369
|
+
"""
|
|
1370
|
+
return _panelset_layer(self, "bar", (x, y), 1, {"group": group,
|
|
1371
|
+
"group_order": group_order,
|
|
1372
|
+
"group_missing": group_missing,
|
|
1373
|
+
"group_colors": group_colors}, settings)
|
|
1374
|
+
|
|
1375
|
+
def hist(self, values: Any, *, group: Any = None, group_order: Any = None,
|
|
1376
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1377
|
+
**settings: Unpack[t.HistCallSettings]) -> LayerSet:
|
|
1378
|
+
"""One per panel: A histogram of ``values``: one array, or several (a dict or a list of
|
|
1379
|
+
arrays) that share the same bins.
|
|
1380
|
+
"""
|
|
1381
|
+
return _panelset_layer(self, "hist", (values,), 1, {"group": group,
|
|
1382
|
+
"group_order": group_order,
|
|
1383
|
+
"group_missing": group_missing,
|
|
1384
|
+
"group_colors": group_colors}, settings)
|
|
1385
|
+
|
|
1386
|
+
def kde(self, values: Any, y: Any = None, *, group: Any = None, group_order: Any = None,
|
|
1387
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1388
|
+
**settings: Unpack[t.KdeCallSettings]) -> LayerSet:
|
|
1389
|
+
"""One per panel: A Gaussian kernel density estimate of ``values`` (one array, or
|
|
1390
|
+
several as a dict or a list of arrays, on a common grid).
|
|
1391
|
+
"""
|
|
1392
|
+
return _panelset_layer(self, "kde", (values, y), 1, {"group": group,
|
|
1393
|
+
"group_order": group_order,
|
|
1394
|
+
"group_missing": group_missing,
|
|
1395
|
+
"group_colors": group_colors}, settings)
|
|
1396
|
+
|
|
1397
|
+
def ecdf(self, values: Any, *, group: Any = None, group_order: Any = None,
|
|
1398
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1399
|
+
**settings: Unpack[t.EcdfCallSettings]) -> LayerSet:
|
|
1400
|
+
"""One per panel: The empirical cumulative distribution of ``values`` (one array, or
|
|
1401
|
+
several as a dict or a list of arrays).
|
|
1402
|
+
"""
|
|
1403
|
+
return _panelset_layer(self, "ecdf", (values,), 1, {"group": group,
|
|
1404
|
+
"group_order": group_order,
|
|
1405
|
+
"group_missing": group_missing,
|
|
1406
|
+
"group_colors": group_colors}, settings)
|
|
1407
|
+
|
|
1408
|
+
def violin(self, values: Any, positions: Any = None, *, group: Any = None,
|
|
1409
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
1410
|
+
**settings: Unpack[t.ViolinCallSettings]) -> LayerSet:
|
|
1411
|
+
"""One per panel: Violins of ``values``: a dict ``{category: values}``, a list of
|
|
1412
|
+
arrays (categories ``0, 1, …`` or ``categories=``), or one array.
|
|
1413
|
+
"""
|
|
1414
|
+
return _panelset_layer(self, "violin", (values, positions), 1, {"group": group,
|
|
1415
|
+
"group_order": group_order,
|
|
1416
|
+
"group_missing": group_missing,
|
|
1417
|
+
"group_colors": group_colors}, settings)
|
|
1418
|
+
|
|
1419
|
+
def strip(self, values: Any, positions: Any = None, *, group: Any = None,
|
|
1420
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
1421
|
+
**settings: Unpack[t.StripCallSettings]) -> LayerSet:
|
|
1422
|
+
"""One per panel: Points of each category's values, spread across the slot by random
|
|
1423
|
+
jitter (from a fixed seed, so output is reproducible).
|
|
1424
|
+
"""
|
|
1425
|
+
return _panelset_layer(self, "strip", (values, positions), 1, {"group": group,
|
|
1426
|
+
"group_order": group_order,
|
|
1427
|
+
"group_missing": group_missing,
|
|
1428
|
+
"group_colors": group_colors}, settings)
|
|
1429
|
+
|
|
1430
|
+
def swarm(self, values: Any, positions: Any = None, *, group: Any = None,
|
|
1431
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
1432
|
+
**settings: Unpack[t.SwarmCallSettings]) -> LayerSet:
|
|
1433
|
+
"""One per panel: Points of each category's values, side by side so that they do not
|
|
1434
|
+
overlap (points that do not fit go to the slot's edge, with a warning; above 100,000
|
|
1435
|
+
points, jittered across the width as a strip, with a warning).
|
|
1436
|
+
"""
|
|
1437
|
+
return _panelset_layer(self, "swarm", (values, positions), 1, {"group": group,
|
|
1438
|
+
"group_order": group_order,
|
|
1439
|
+
"group_missing": group_missing,
|
|
1440
|
+
"group_colors": group_colors}, settings)
|
|
1441
|
+
|
|
1442
|
+
def area(self, x: Any, y: Any, *, group: Any = None, group_order: Any = None,
|
|
1443
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1444
|
+
**settings: Unpack[t.AreaCallSettings]) -> LayerSet:
|
|
1445
|
+
"""One per panel: Areas of the layers ``y`` (one column, or several: a dict ``{name:
|
|
1446
|
+
values}``, a data frame, a 2-D buffer's columns, a list of arrays) along ``x``,
|
|
1447
|
+
stacked on ``baseline``; ``orientation="horizontal"`` runs them along y.
|
|
1448
|
+
"""
|
|
1449
|
+
return _panelset_layer(self, "area", (x, y), 2, {"group": group,
|
|
1450
|
+
"group_order": group_order,
|
|
1451
|
+
"group_missing": group_missing,
|
|
1452
|
+
"group_colors": group_colors}, settings)
|
|
1453
|
+
|
|
1454
|
+
def errorbar(self, x: Any, y: Any, *, group: Any = None, group_order: Any = None,
|
|
1455
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1456
|
+
**settings: Unpack[t.ErrorbarCallSettings]) -> LayerSet:
|
|
1457
|
+
"""One per panel: Error bars at ``(x, y)``: ``y_error``/``x_error`` as a value, a
|
|
1458
|
+
sequence, ``(low, high)`` or ``Errors``; ``marker`` adds markers at the points
|
|
1459
|
+
(numbers per point in ``marker_color`` map through the series' color axis).
|
|
1460
|
+
"""
|
|
1461
|
+
return _panelset_layer(self, "errorbar", (x, y), 2, {"group": group,
|
|
1462
|
+
"group_order": group_order,
|
|
1463
|
+
"group_missing": group_missing,
|
|
1464
|
+
"group_colors": group_colors}, settings)
|
|
1465
|
+
|
|
1466
|
+
def stem(self, x: Any, y: Any = None, *, group: Any = None, group_order: Any = None,
|
|
1467
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1468
|
+
**settings: Unpack[t.StemCallSettings]) -> LayerSet:
|
|
1469
|
+
"""One per panel: Stems from ``baseline`` to ``y`` at ``x`` (or at 0, 1, … when ``y``
|
|
1470
|
+
is omitted); numbers per point in ``marker_color`` map through the series' color
|
|
1471
|
+
axis.
|
|
1472
|
+
"""
|
|
1473
|
+
return _panelset_layer(self, "stem", (x, y), 1, {"group": group,
|
|
1474
|
+
"group_order": group_order,
|
|
1475
|
+
"group_missing": group_missing,
|
|
1476
|
+
"group_colors": group_colors}, settings)
|
|
1477
|
+
|
|
1478
|
+
def regression(self, x: Any, y: Any, *, group: Any = None, group_order: Any = None,
|
|
1479
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1480
|
+
**settings: Unpack[t.RegressionCallSettings]) -> LayerSet:
|
|
1481
|
+
"""One per panel: A regression of ``y`` on ``x``: a polynomial of ``order`` (least
|
|
1482
|
+
squares) with a confidence band of the mean, or a LOWESS curve; ``scatter`` also
|
|
1483
|
+
draws the points (numbers per point in ``marker_color`` map through the series'
|
|
1484
|
+
color axis).
|
|
1485
|
+
"""
|
|
1486
|
+
return _panelset_layer(self, "regression", (x, y), 2, {"group": group,
|
|
1487
|
+
"group_order": group_order,
|
|
1488
|
+
"group_missing": group_missing,
|
|
1489
|
+
"group_colors": group_colors}, settings)
|
|
1490
|
+
|
|
1491
|
+
def hist2d(self, x: Any, y: Any, *, group: Any = None, group_order: Any = None,
|
|
1492
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1493
|
+
**settings: Unpack[t.Hist2dCallSettings]) -> LayerSet:
|
|
1494
|
+
"""One per panel: A 2-D histogram of points ``(x, y)``: counts in bins (even on the
|
|
1495
|
+
axis scales), drawn as a heatmap; bins with fewer than ``min_count`` points are left
|
|
1496
|
+
empty.
|
|
1497
|
+
"""
|
|
1498
|
+
return _panelset_layer(self, "hist2d", (x, y), 2, {"group": group,
|
|
1499
|
+
"group_order": group_order,
|
|
1500
|
+
"group_missing": group_missing,
|
|
1501
|
+
"group_colors": group_colors}, settings)
|
|
1502
|
+
|
|
1503
|
+
def hexbin(self, x: Any, y: Any, *, group: Any = None, group_order: Any = None,
|
|
1504
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1505
|
+
**settings: Unpack[t.HexbinCallSettings]) -> LayerSet:
|
|
1506
|
+
"""One per panel: A hexagonal 2-D histogram of points ``(x, y)``: ``bins`` regular
|
|
1507
|
+
hexagons across the axes width. The lattice is laid out in page units for the axes
|
|
1508
|
+
the layout placed (its domain is the data's, its bins the axes'), so the hexagons
|
|
1509
|
+
are regular and tile exactly whatever the axes' aspect.
|
|
1510
|
+
"""
|
|
1511
|
+
return _panelset_layer(self, "hexbin", (x, y), 2, {"group": group,
|
|
1512
|
+
"group_order": group_order,
|
|
1513
|
+
"group_missing": group_missing,
|
|
1514
|
+
"group_colors": group_colors}, settings)
|
|
1515
|
+
|
|
1516
|
+
def contour(self, values: Any, x: Any = None, y: Any = None, *, group: Any = None,
|
|
1517
|
+
group_order: Any = None, group_missing: Any = None, group_colors: Any = None,
|
|
1518
|
+
**settings: Unpack[t.ContourCallSettings]) -> LayerSet:
|
|
1519
|
+
"""One per panel: Contour lines and/or filled bands of ``values`` (rows first) at nodes
|
|
1520
|
+
``x``/``y`` (centres; edges are reduced to their midpoints).
|
|
1521
|
+
"""
|
|
1522
|
+
return _panelset_layer(self, "contour", (values, x, y), 1, {"group": group,
|
|
1523
|
+
"group_order": group_order,
|
|
1524
|
+
"group_missing": group_missing,
|
|
1525
|
+
"group_colors": group_colors}, settings)
|
|
1526
|
+
|
|
1527
|
+
def pie(self, values: Any, *, group: Any = None, group_order: Any = None,
|
|
1528
|
+
group_missing: Any = None, group_colors: Any = None,
|
|
1529
|
+
**settings: Unpack[t.PieCallSettings]) -> LayerSet:
|
|
1530
|
+
"""One per panel: A pie (or donut, with ``hole``) of ``values``: a sequence, or a dict
|
|
1531
|
+
``{label: value}``; the plot is drawn without axes.
|
|
1532
|
+
"""
|
|
1533
|
+
return _panelset_layer(self, "pie", (values,), 1, {"group": group,
|
|
1534
|
+
"group_order": group_order,
|
|
1535
|
+
"group_missing": group_missing,
|
|
1536
|
+
"group_colors": group_colors}, settings)
|
|
1537
|
+
|
|
1538
|
+
def dots(self, color: Any = None, size: Any = None, x: Any = None, y: Any = None, *,
|
|
1539
|
+
group: Any = None, group_order: Any = None, group_missing: Any = None,
|
|
1540
|
+
group_colors: Any = None, **settings: Unpack[t.DotsCallSettings]) -> LayerSet:
|
|
1541
|
+
"""One per panel: One marker per cell of a grid: ``color`` and ``size`` are grids of
|
|
1542
|
+
values (row 0 first) of one shape, or one value; ``x``/``y`` label the columns and
|
|
1543
|
+
rows, as ``heatmap``'s. With long data (``x``, ``y`` and values per cell), the cells
|
|
1544
|
+
come from the rows; cells without a row get no dot.
|
|
1545
|
+
"""
|
|
1546
|
+
return _panelset_layer(self, "dots", (color, size, x, y), 0, {"group": group,
|
|
1547
|
+
"group_order": group_order,
|
|
1548
|
+
"group_missing": group_missing,
|
|
1549
|
+
"group_colors": group_colors}, settings)
|
|
1550
|
+
|
|
1551
|
+
def bigwig(self, reader: Any = None, *, x: Any = None, y: Any = None,
|
|
1552
|
+
**settings: Unpack[t.BigWigSettings]) -> LayerSet:
|
|
1553
|
+
"""One per panel: A binned signal over the region: a step line along the bins, filled
|
|
1554
|
+
to a baseline. ``reader`` is a signal reader (bigWig; bigBed, BED and peaks give
|
|
1555
|
+
their coverage; :func:`~plot_io.genome.combine.combine` of two), a path (opened with
|
|
1556
|
+
gwseq_io), ``chr``, ``start``, ``end``, ``value`` records (columns, a DataFrame or
|
|
1557
|
+
rows; binned by plot_io), a function ``f(chr, start, end, bins)`` giving values, or
|
|
1558
|
+
``None`` with ``y`` (values over the region) and optionally ``x`` (bin centres, or n
|
|
1559
|
+
+ 1 edges, in bp).
|
|
1560
|
+
"""
|
|
1561
|
+
return _panelset_layer(self, "bigwig", (reader,), 0, {"x": x, "y": y}, settings)
|
|
1562
|
+
|
|
1563
|
+
def bed(self, reader: Any, **settings: Unpack[t.BedSettings]) -> LayerSet:
|
|
1564
|
+
"""One per panel: Intervals over the region: boxes or gene models, on one row or packed
|
|
1565
|
+
onto rows. ``reader`` is an interval reader (bigBed, BED, peaks), a path (opened
|
|
1566
|
+
with gwseq_io) or plain data: a dict of columns, a DataFrame, or rows (``start``,
|
|
1567
|
+
``end`` and optionally ``name``, ``score``, ``strand``, ``thickStart``,
|
|
1568
|
+
``thickEnd``, ``itemRgb``, ``blockCount``, ``blockSizes``, ``blockStarts``).
|
|
1569
|
+
"""
|
|
1570
|
+
return _panelset_layer(self, "bed", (reader,), 1, {}, settings)
|
|
1571
|
+
|
|
1572
|
+
def genes(self, reader: Any, **settings: Unpack[t.GenesSettings]) -> LayerSet:
|
|
1573
|
+
"""One per panel: Gene models (BED12): ``Bed`` with ``kind="genes"``, rows expanded and
|
|
1574
|
+
names on.
|
|
1575
|
+
"""
|
|
1576
|
+
return _panelset_layer(self, "genes", (reader,), 1, {}, settings)
|
|
1577
|
+
|
|
1578
|
+
def gtf(self, reader: Any, **settings: Unpack[t.GtfSettings]) -> LayerSet:
|
|
1579
|
+
"""One per panel: Gene models of a GTF or GFF3 reader (``read_entries(model=)``) or
|
|
1580
|
+
path: ``Genes``, one model per gene (its transcripts' exons merged) or per
|
|
1581
|
+
transcript, or plain BED12 data as ``Genes`` takes it.
|
|
1582
|
+
"""
|
|
1583
|
+
return _panelset_layer(self, "gtf", (reader,), 1, {}, settings)
|
|
1584
|
+
|
|
1585
|
+
def hic(self, reader: Any, **settings: Unpack[t.HiCSettings]) -> LayerSet:
|
|
1586
|
+
"""One per panel: The upper triangle of a contact matrix, the diagonal along the x axis
|
|
1587
|
+
(each cell a diamond), or with ``shape="square"`` the whole matrix of ``region`` (x)
|
|
1588
|
+
against ``region2`` (y, its start at the top). ``reader`` is a Hi-C reader, a path
|
|
1589
|
+
(opened with gwseq_io), or a square matrix over the region (bins of ``span / n``).
|
|
1590
|
+
"""
|
|
1591
|
+
return _panelset_layer(self, "hic", (reader,), 1, {}, settings)
|
|
1592
|
+
|
|
1593
|
+
def links(self, pairs: Any, **settings: Unpack[t.LinksSettings]) -> LayerSet:
|
|
1594
|
+
"""One per panel: Links between pairs of places (BEDPE): an arc from anchor centre to
|
|
1595
|
+
anchor centre in a lane of its own, or, ``lane="over"`` a Hi-C triangle or square, a
|
|
1596
|
+
mark at each pair's contact cell (on a square, and at its mirror). ``pairs`` is a
|
|
1597
|
+
reader whose ``read_entries`` gives the BEDPE columns, a path gwseq_io reads them
|
|
1598
|
+
from, or plain data (the pairs with an anchor in view are read): a dict of columns,
|
|
1599
|
+
a DataFrame, or rows in BEDPE order (``chr1``, ``start1``, ``end1``, ``chr2``,
|
|
1600
|
+
``start2``, ``end2``, then optionally ``name``, ``score``).
|
|
1601
|
+
"""
|
|
1602
|
+
return _panelset_layer(self, "links", (pairs,), 1, {}, settings)
|
|
1603
|
+
|
|
1604
|
+
def site_heatmap(self, signal: Any, sites: Any, *, group: Any = None,
|
|
1605
|
+
**settings: Unpack[t.SiteHeatmapSettings]) -> LayerSet:
|
|
1606
|
+
"""One per panel: A signal around sites, one row per site (a table with ``chr``,
|
|
1607
|
+
``start``, ``end`` and optional ``strand``, ``summit`` columns, or an interval
|
|
1608
|
+
reader), x the distance from the anchor in bp; ``group`` (a column of the sites, or
|
|
1609
|
+
a label per site) makes a block of rows per group.
|
|
1610
|
+
"""
|
|
1611
|
+
return _panelset_layer(self, "site_heatmap", (signal, sites), 2, {"group": group}, settings)
|
|
1612
|
+
|
|
1613
|
+
def site_profile(self, signal: Any, sites: Any, *, group: Any = None,
|
|
1614
|
+
**settings: Unpack[t.SiteProfileSettings]) -> LayerSet:
|
|
1615
|
+
"""One per panel: The column mean (or median) of a signal around sites (see
|
|
1616
|
+
:class:`SiteHeatmap`): one line per group, x the distance from the anchor in bp, an
|
|
1617
|
+
optional band.
|
|
1618
|
+
"""
|
|
1619
|
+
return _panelset_layer(self, "site_profile", (signal, sites), 2, {"group": group}, settings)
|
|
1620
|
+
|
|
1621
|
+
def dendrogram(self, tree: Any, labels: Any = None,
|
|
1622
|
+
**settings: Unpack[t.DendrogramSettings]) -> LayerSet:
|
|
1623
|
+
"""One per panel: The merges of ``tree`` (a :class:`Tree`, or a scipy ``Z``) as
|
|
1624
|
+
U-shaped links: the leaves at slots 0, 1, … in ``tree.leaves`` order on the leaf
|
|
1625
|
+
axis, the heights on the value axis, the root at the top
|
|
1626
|
+
(``orientation="horizontal"``: at the left, heights along x, the x axis inverted
|
|
1627
|
+
unless set). ``labels`` (default: the tree's) make the leaf axis categorical, in
|
|
1628
|
+
leaf order, so a heatmap with the same categories shares it; without labels each
|
|
1629
|
+
leaf is ticked with its observation's index. Every leaf is labelled: turned 90° when
|
|
1630
|
+
the labels do not fit flat, then smaller, down to the axis' ``label_min_size`` (6
|
|
1631
|
+
pt), and every k-th only below it.
|
|
1632
|
+
"""
|
|
1633
|
+
return _panelset_layer(self, "dendrogram", (tree, labels), 1, {}, settings)
|
|
1634
|
+
|
|
1635
|
+
def qq(self, values: Any, y: Any = None, **settings: Unpack[t.QQSettings]) -> LayerSet:
|
|
1636
|
+
"""One per panel: The sorted ``values`` against the quantiles of ``dist`` at R's
|
|
1637
|
+
``ppoints`` (``(i − a) / (n + 1 − 2a)``, a = 3/8 for n ≤ 10, else 1/2), or against
|
|
1638
|
+
the sorted ``y`` (two samples: the longer interpolated to the shorter's size, as R's
|
|
1639
|
+
``qqplot``; ``values`` on x). ``pvalues=True``: ``values`` are p-values, drawn as
|
|
1640
|
+
−log10 of the sorted p-values (y) against −log10 of the expected uniform quantiles
|
|
1641
|
+
(x). Points as `Scatter`'s; the reference ``line`` and the pointwise ``band`` of
|
|
1642
|
+
order statistics in the series color. The points and the default line are R's
|
|
1643
|
+
(``qqnorm``, ``qqline``), not scipy's ``probplot`` (Filliben's medians, a least-
|
|
1644
|
+
squares line).
|
|
1645
|
+
"""
|
|
1646
|
+
return _panelset_layer(self, "qq", (values, y), 1, {}, settings)
|
|
1647
|
+
|
|
1648
|
+
def raincloud(self, values: Any, positions: Any = None,
|
|
1649
|
+
**settings: Unpack[t.RaincloudSettings]) -> LayerSet:
|
|
1650
|
+
"""One per panel: Rainclouds of ``values`` (a dict ``{category: values}``, a list of
|
|
1651
|
+
arrays, or one array; long data with ``x=`` categories): per category a half violin
|
|
1652
|
+
on the high side (stat ``violin``), a narrow box at the centre (stat ``box``) and
|
|
1653
|
+
the values as jittered points on the low side. ``parts`` keeps some of the three.
|
|
1654
|
+
Widths and offsets are `%` of the slot.
|
|
1655
|
+
"""
|
|
1656
|
+
return _panelset_layer(self, "raincloud", (values, positions), 1, {}, settings)
|
|
1657
|
+
|
|
1658
|
+
def volcano(self, fold_change: Any, p: Any,
|
|
1659
|
+
**settings: Unpack[t.VolcanoSettings]) -> LayerSet:
|
|
1660
|
+
"""One per panel: Differential results: log2 ``fold_change`` (x) against −log10 ``p``
|
|
1661
|
+
(y; p = 0 at the smallest positive p, NaN left out). Points are ``up``, ``down`` or
|
|
1662
|
+
``n.s.``: up or down when ``p < p_threshold`` and |fold change| ≥
|
|
1663
|
+
``fold_change_threshold``, coloured by ``colors`` as a level axis on ``color`` (the
|
|
1664
|
+
legend counts them), dashed rules at the thresholds. ``labels`` gives a text per
|
|
1665
|
+
point, ``label`` which are drawn (placed as Scatter's). The classification settings
|
|
1666
|
+
are read at the call.
|
|
1667
|
+
"""
|
|
1668
|
+
return _panelset_layer(self, "volcano", (fold_change, p), 2, {}, settings)
|
|
1669
|
+
|
|
1670
|
+
def ma(self, mean: Any, fold_change: Any, p: Any = None,
|
|
1671
|
+
**settings: Unpack[t.MaSettings]) -> LayerSet:
|
|
1672
|
+
"""One per panel: An MA plot: mean expression ``mean`` (x, on a log10 axis unless the
|
|
1673
|
+
axis has a scale) against log2 ``fold_change`` (y), a rule at 0 and dashed ones at ±
|
|
1674
|
+
``fold_change_threshold``. Classes, colors and labels as `Volcano`'s (by fold change
|
|
1675
|
+
alone without ``p``; ``label="top"``: the largest |fold change| among the
|
|
1676
|
+
significant).
|
|
1677
|
+
"""
|
|
1678
|
+
return _panelset_layer(self, "ma", (mean, fold_change, p), 2, {}, settings)
|
|
1679
|
+
|
|
1680
|
+
def manhattan(self, chromosomes: Any, positions: Any, p: Any,
|
|
1681
|
+
**settings: Unpack[t.ManhattanSettings]) -> LayerSet:
|
|
1682
|
+
"""One per panel: Genome-wide association results: −log10 ``p`` (y) at ``positions``
|
|
1683
|
+
(bp) of ``chromosomes`` laid end to end (x) in natural order (chr1 … chr22, X, Y,
|
|
1684
|
+
M), each ``chr_sizes`` long (unset: to its last position), its points in the next of
|
|
1685
|
+
the two ``colors``, its name as the tick at its middle (left to right, a name that
|
|
1686
|
+
would overlap the last one shown is left out), the x axis from the first
|
|
1687
|
+
chromosome's start to the last one's end; a dashed rule at ``threshold`` (genome-
|
|
1688
|
+
wide significance). ``labels``/``label``/``label_count`` as `Volcano`'s (``top``:
|
|
1689
|
+
the most significant beyond ``threshold``).
|
|
1690
|
+
"""
|
|
1691
|
+
return _panelset_layer(self, "manhattan", (chromosomes, positions, p), 3, {}, settings)
|