ensembl.vep.render package#
Presentation. Domain-free: nothing here imports the rest of the package.
Subpackages#
Submodules#
ensembl.vep.render.chart module#
Charts as inline SVG.
Replaces the Google Charts the old VEP summary loaded from a CDN, so a report opens offline. The
legend matches ensembl-client’s legend component: a 10px square marker, 12px from its label.
- class ensembl.vep.render.chart.Slice(*, label, value, colour=None)[source]#
Bases:
objectOne labelled quantity in a chart.
- Variables:
label (str) – What the quantity counts.
value (float) – How much.
colour (Colour | None) – The colour to draw it in, or None to take one from the default palette by position.
- label: str#
- value: float#
- ensembl.vep.render.chart.render_bars(slices, title='')[source]#
Return a horizontal bar chart, one labelled bar per slice.
- Return type:
str
- ensembl.vep.render.chart.render_legend(slices)[source]#
Return a legend listing each slice with its marker.
- Return type:
str
ensembl.vep.render.page module#
A self-contained HTML page.
Mirrors the information architecture of VEP’s summary page – a masthead, a fixed side menu of anchors, then one section per topic – with the Ensembl skin and no external requests. Everything the page needs is inlined, so it opens from a filesystem with no network.
- class ensembl.vep.render.page.Section(*, identifier, title, blocks=(), group='')[source]#
Bases:
objectOne anchored block of the page.
- Variables:
identifier (str) – The anchor, and what the side menu links to.
title (str) – The heading, and the menu entry.
blocks (tuple[str, ...]) – Ready-made HTML fragments – a table, a chart, a graph – laid out side by side.
group (str) – Optional heading grouping consecutive entries in the side menu.
- blocks: tuple[str, ...]#
- group: str#
- identifier: str#
- title: str#
- ensembl.vep.render.page.render_page(title, sections, subtitle='')[source]#
Return a complete HTML document.
- Parameters:
title (
str) – The document title and masthead heading.sections (
Sequence[Section]) – The blocks to show, in order.subtitle (
str, default:'') – Optional line under the heading, e.g. the run that produced the page.
- Returns:
A standalone document that makes no external requests.
- Return type:
str
ensembl.vep.render.report module#
A report: titled sections of tables and charts, rendered to one of three formats.
The one place a run summary, a fact profile, or any later report becomes HTML, text or JSON. A producer describes what it has – headings, rows, labelled quantities – and never how it should look, which is what lets it live outside this package without a renderer of its own.
- class ensembl.vep.render.report.ChartKind(*values)[source]#
Bases:
EnumHow a section’s quantities are drawn, if at all.
- BARS = 'bars'#
- NONE = 'none'#
- PIE = 'pie'#
- class ensembl.vep.render.report.ReportFormat(*values)[source]#
Bases:
EnumThe formats a report can be rendered in.
- HTML = 'html'#
- JSON = 'json'#
- TEXT = 'text'#
- class ensembl.vep.render.report.ReportSection(*, identifier, title, headers=(), rows=(), slices=(), chart=ChartKind.NONE)[source]#
Bases:
objectOne block of a report: a table, a chart, or both.
- Variables:
identifier (str) – The anchor, and what a page’s side menu links to.
title (str) – The heading.
headers (tuple[str, ...]) – Column headings of the table, if any.
rows (tuple[tuple[object, ...], ...]) – The table’s rows.
slices (tuple[Slice, ...]) – Labelled quantities, drawn as
chartand, in the text formats, listed as a two-column table.chart (ChartKind) – How the slices are drawn in HTML.
- headers: tuple[str, ...]#
- identifier: str#
- rows: tuple[tuple[object, ...], ...]#
- title: str#
- ensembl.vep.render.report.render_report(title, subtitle, sections, report_format)[source]#
Render a report in one of the published formats.
- Parameters:
title (
str) – The document title.subtitle (
str) – One line under it.sections (
Sequence[ReportSection]) – The blocks, in order.report_format (
str|ReportFormat) – Which format to render.
- Returns:
The rendered report.
- Return type:
str
ensembl.vep.render.table module#
Rendering a table in the formats this project publishes to.
- class ensembl.vep.render.table.TableFormat(*values)[source]#
Bases:
EnumThe formats a table can be rendered in.
- CONFLUENCE = 'confluence'#
- HTML = 'html'#
- MARKDOWN = 'markdown'#
- TEXT = 'text'#
- ensembl.vep.render.table.render_table(headers, rows, table_format=TableFormat.MARKDOWN)[source]#
Return a table in one of the published formats.
- Parameters:
headers (
Sequence[str]) – The column headings.rows (
Sequence[Sequence[object]]) – One sequence of values per row, each the same length asheaders.table_format (
TableFormat, default:TableFormat.MARKDOWN) – Which format to render.
- Returns:
The rendered table.
- Return type:
str- Raises:
ValueError – If a row has a different number of values than there are headers.
ensembl.vep.render.theme module#
Ensembl’s design tokens.
Transcribed from the frontend source of truth, Ensembl/ensembl-client
(src/styles/design-tokens.css), so refreshing the theme is a diff against one upstream file.
The design system is light-only: there is no prefers-color-scheme block, no data-theme and
no dark token set anywhere upstream, so emitting one would invent a theme Ensembl does not have.
- class ensembl.vep.render.theme.Colour(*values)[source]#
Bases:
EnumThe Ensembl palette, by its upstream token name.
- BLACK = '#1b2c39'#
- BLUE = '#0099ff'#
- DARK_GREY = '#6f8190'#
- DARK_PINK = '#eb768a'#
- DARK_YELLOW = '#f8c041'#
- DUCKEGG_BLUE = '#96d0c9'#
- GREEN = '#47d147'#
- GREY = '#b7c0c8'#
- ICE_BLUE = '#e5f5ff'#
- LIGHT_BLUE = '#33adff'#
- LIGHT_GREY = '#f1f2f4'#
- LIME = '#84fa3a'#
- MEDIUM_DARK_GREY = '#9aa7b1'#
- MEDIUM_LIGHT_GREY = '#d4d9de'#
- MUSTARD = '#cc9933'#
- NEON_BLUE = '#8ef4f8'#
- OFF_WHITE = '#fefefe'#
- ORANGE = '#ff9900'#
- PURPLE = '#ca81ff'#
- RED = '#d90000'#
- SOFT_BLACK = '#374148'#
- TEAL = '#327c89'#
- WHITE = '#fff'#
- property token: str#
Return the CSS custom property this colour is published as.
- property var: str#
Return a
var()reference to this colour, for use in a stylesheet.
- class ensembl.vep.render.theme.Font(*values)[source]#
Bases:
EnumThe two font stacks, with their upstream fallbacks.
- BODY = "Lato, 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"#
- MONOSPACE = "'IBM Plex Mono', 'Liberation Mono', Courier, monospace"#
- property token: str#
Return the CSS custom property this stack is published as.
- property var: str#
Return a
var()reference to this stack, for use in a stylesheet.
- class ensembl.vep.render.theme.Metric(*values)[source]#
Bases:
EnumSpacing and type metrics, by their upstream token name.
- BODY_FONT_SIZE = '13px'#
- BODY_LINE_HEIGHT = '1.5'#
- FONT_WEIGHT_BOLD = '700'#
- FONT_WEIGHT_LIGHT = '300'#
- FONT_WEIGHT_NORMAL = '400'#
- STANDARD_GUTTER = '30px'#
- property token: str#
Return the CSS custom property this metric is published as.
- property var: str#
Return a
var()reference to this metric, for use in a stylesheet.
- ensembl.vep.render.theme.stylesheet()[source]#
Return the theme as CSS, for inlining into a self-contained page.
Emits the tokens as custom properties on
:rootfollowed by the handful of element rulesensembl-client’sbase.csssets, so a report matches the site without linking to it. Fonts are stacks only, with no@font-face: the site self-hosts its woff2 files, and linking them would stop the page opening offline.- Return type:
str