riverine.printing#

Attributes#

cell_with_border_css_class

html_with_borders_tablefmt

Pass this as the parameter tablefmt in any method that accepts that parameter to have the table

_ALL_TABLEFMTS

_ALL_TABLEFMTS_NAMES

_SUPPORTED_TABLEFMTS_TITLE

_NL

Classes#

MixLine

Class for handling a line of a (processed) mix recipe.

Functions#

emphasize(→ str)

Emphasizes text according to tablefmt, e.g., for Markdown (e.g., tablefmt = 'pipe'),

_format_error_span(out, tablefmt)

_html_row_with_attrs(→ str)

_formatter(→ str)

_format_title(→ str)

_format_errors(→ str)

_format_location(→ str)

gel_table(→ str)

Return Markdown table representing which lanes to put samples into for a gel.

Module Contents#

riverine.printing.emphasize(text: str, tablefmt: str | tabulate.TableFormat, strong: bool = False) str[source]#

Emphasizes text according to tablefmt, e.g., for Markdown (e.g., tablefmt = ‘pipe’), surrounds with pair of *’s; if strong is True, with double *’s. For tablefmt = ‘html’, uses <emph> or <strong>.

Parameters:
  • text – text to emphasize

  • tablefmt – format in which to add emphasis markup

Return type:

emphasized version of text

riverine.printing._format_error_span(out, tablefmt)[source]#
riverine.printing.cell_with_border_css_class = 'cell-with-border'[source]#
riverine.printing._html_row_with_attrs(celltag: str, cell_values: riverine.units.Sequence[str], colwidths: riverine.units.Sequence[int], colaligns: riverine.units.Sequence[str]) str[source]#
riverine.printing.html_with_borders_tablefmt[source]#

Pass this as the parameter tablefmt in any method that accepts that parameter to have the table be an HTML table with borders around each cell.

riverine.printing._ALL_TABLEFMTS[source]#
riverine.printing._ALL_TABLEFMTS_NAMES: list[str][source]#
riverine.printing._SUPPORTED_TABLEFMTS_TITLE[source]#
riverine.printing._NL: dict[riverine.units.Union[str, tabulate.TableFormat], str][source]#
riverine.printing._formatter(x: float | str | list[str] | riverine.units.DecimalQuantity | None, italic: bool = False, tablefmt: str | tabulate.TableFormat = 'pipe', splits: list = []) str[source]#
class riverine.printing.MixLine[source]#

Class for handling a line of a (processed) mix recipe.

Each line should represent a single step, or series of similar steps (same volume per substep) in the mixing process.

Parameters:
  • names – A list of component names. For a single step, use [name].

  • source_conc – The source concentration; may not be provided (will be left blank), or be a descriptive string.

  • dest_conc – The destination/target concentration; may not be provided (will be left blank), or be a descriptive string.

  • total_tx_vol – The total volume added to the mix by the step. If zero, the amount will still be included in tables. If None, the amount will be blank. If provided, and the line is not fake, the value must be correct and interpretable for calculations involving the mix.

  • number – The number of components added / subste

  • each_tx_vol – The volume per component / substep. May be omitted, or a descriptive string.

  • plate – The plate name for the mix, a descriptive string for location / source type (eg, “tube”) or None (omitted). A single MixLine, at present, should not involve multiple plates.

  • wells – A list of wells for the components in a plate. If the components are not in a plate, this must be an empty list. This does not parse strings; wells must be provided as WellPos instances.

  • note – A note to add for the line

  • fake – Denotes that the line is not a real step, eg, for a summary/total information line. The line will be distinguished in some way in tables (eg, italics) and will not be included in calculations.

names: list[str][source]#
source_conc: riverine.units.DecimalQuantity | str | None = None[source]#
dest_conc: riverine.units.DecimalQuantity | str | None = None[source]#
total_tx_vol: riverine.units.DecimalQuantity[source]#
number: int = 1[source]#
each_tx_vol: riverine.units.DecimalQuantity[source]#
plate: str = ''[source]#
wells: list[riverine.locations.WellPos][source]#
note: str | None = None[source]#
fake: bool = False[source]#
__attrs_post_init__()[source]#
_check_wells(_: str, v: Any) None[source]#
_check_names(_: str, v: Any) None[source]#
location(tablefmt: str | tabulate.TableFormat = 'pipe', split: bool = True) tuple[str | list[str], list[int]][source]#

A formatted string (according to tablefmt) for the location of the component/components.

toline(incea: bool, tablefmt: str | tabulate.TableFormat = 'pipe') riverine.units.Sequence[str][source]#
riverine.printing._format_title(raw_title: str, level: int, tablefmt: str | tabulate.TableFormat) str[source]#
riverine.printing._format_errors(errors: list[riverine.units.VolumeError], tablefmt: tabulate.TableFormat | str) str[source]#
riverine.printing._format_location(loc: tuple[str | None, riverine.locations.WellPos | None]) str[source]#
riverine.printing.gel_table(sample_names: Iterable[str], num_lanes: int | None = None, tablefmt: tabulate.TableFormat | str = 'pipe') str[source]#

Return Markdown table representing which lanes to put samples into for a gel.

Parameters:
  • sample_names – names of samples to go into lanes of the gel

  • num_lanes – total number of lanes in the gel; if not specified, assumed to be number of elements in sample_names

  • tablefmt – The output format for the table. (See documentation for table formats in tabulate package.)

Return type:

Markdown table representing which lanes to put samples into for a gel