riverine.abbreviated#

Attributes#

Classes#

Mix

Class denoting a Mix, a collection of source components mixed to

Functions#

Q_(→ DecimalQuantity)

Convenient constructor for units, eg, Q_(5.0, 'nM'). Ensures that the quantity is a Decimal.

Q_(→ DecimalQuantity)

Convenient constructor for units, eg, Q_(5.0, 'nM'). Ensures that the quantity is a Decimal.

Q_(→ DecimalQuantity)

Convenient constructor for units, eg, Q_(5.0, 'nM'). Ensures that the quantity is a Decimal.

Module Contents#

riverine.abbreviated.Q_(qty: int | str | decimal.Decimal | float, unit: str | pint.Unit | pint.facets.plain.PlainUnit | pint.Quantity | None = None) DecimalQuantity[source]#

Convenient constructor for units, eg, Q_(5.0, 'nM'). Ensures that the quantity is a Decimal.

riverine.abbreviated.nM[source]#
riverine.abbreviated.uL[source]#
riverine.abbreviated.ureg[source]#
riverine.abbreviated.uM[source]#
class riverine.abbreviated.Mix(*args, **kwargs)[source]#

Bases: riverine.components.AbstractComponent

Class denoting a Mix, a collection of source components mixed to some volume or concentration.

__hash__#
actions: riverine.units.Sequence[riverine.actions.AbstractAction]#
name: str = ''#

Name of the component.

test_tube_name: str | None#

A short name, eg, for labelling a test tube.

fixed_concentration: str | riverine.units.DecimalQuantity | None#
reference: riverine.references.Reference | None = None#
min_volume: riverine.units.DecimalQuantity#
plate: str | None#
well: riverine.locations.WellPos | None#
property is_mix: bool#
property fixed_total_volume: riverine.units.DecimalQuantity#
property buffer_name: str#
__eq__(other: object) bool[source]#
__attrs_post_init__() None[source]#
printed_name(tablefmt: str | tabulate.TableFormat) str[source]#
property concentration: riverine.units.DecimalQuantity#

Effective concentration of the mix. Calculated in order:

  1. If the mix has a fixed concentration, then that concentration.

  2. If fixed_concentration is a string, then the final concentration of the component with that name.

  3. If fixed_concentration is none, then the final concentration of the first mix component.

_get_concentration(_cache_key=None) riverine.units.DecimalQuantity[source]#
property total_volume: riverine.units.DecimalQuantity#

Total volume of the mix. If the mix has a fixed total volume, then that, otherwise, the sum of the transfer volumes of each component.

_get_total_volume(_cache_key=None) riverine.units.DecimalQuantity[source]#
property buffer_volume: riverine.units.Quantity#

The volume of buffer to be added to the mix, in addition to the components.

_get_buffer_volume(_cache_key=None) riverine.units.Quantity[source]#
table(tablefmt: tabulate.TableFormat | str = 'pipe', raise_failed_validation: bool = False, stralign='default', missingval='', showindex='default', disable_numparse=False, colalign=None, _cache_key=None) str[source]#

Generate a table describing the mix.

Parameters:
  • tablefmt – The output format for the table.

  • validate – Ensure volumes make sense.

mixlines(tablefmt: str | tabulate.TableFormat = 'pipe', _cache_key=None) list[riverine.printing.MixLine][source]#
has_fixed_concentration_action() bool[source]#
has_fixed_total_volume() bool[source]#
validate(tablefmt: str | tabulate.TableFormat | None = None, mixlines: riverine.units.Sequence[riverine.printing.MixLine] | None = None, raise_errors: bool = False, _cache_key=None) list[riverine.units.VolumeError][source]#
all_components_polars(_cache_key=None) polars.DataFrame[source]#
all_components() pandas.DataFrame[source]#

Return a Series of all component names, and their concentrations (as pint nM).

_repr_markdown_() str[source]#
_repr_html_() str[source]#
infoline(_cache_key=None) str[source]#
__repr__() str[source]#
__str__() str[source]#
with_experiment(experiment: riverine.experiments.Experiment, *, inplace: bool = True) Mix[source]#
with_reference(reference: riverine.references.Reference, *, inplace: bool = True) Mix[source]#
property location: tuple[str, riverine.locations.WellPos | None]#
vol_to_tube_names(tablefmt: str | tabulate.TableFormat = 'pipe', validate: bool = True) dict[riverine.units.DecimalQuantity, list[str]][source]#
Returns:

dict mapping a volume vol to a list of names of strands in this mix that should be pipetted with volume vol

_tube_map_from_mixline(mixline: riverine.printing.MixLine) str[source]#
tubes_markdown(tablefmt: str | tabulate.TableFormat = 'pipe') str[source]#
Parameters:

tablefmt – table format (see PlateMap.to_table() for description)

Returns:

  • a Markdown (or other format according to tablefmt)

  • string indicating which strands in test tubes to pipette, grouped by the volume

  • of each

display_instructions(plate_type: riverine.locations.PlateType = PlateType.wells96, raise_failed_validation: bool = False, combine_plate_actions: bool = True, well_marker: None | str | Callable[[str], str] = None, title_level: Literal[1, 2, 3, 4, 5, 6] = 3, warn_unsupported_title_format: bool = True, tablefmt: str | tabulate.TableFormat = 'unsafehtml', include_plate_maps: bool = True) None[source]#

Displays in a Jupyter notebook the result of calling Mix.instructions().

Parameters:
  • plate_type – 96-well or 384-well plate; default is 96-well.

  • raise_failed_validation – If validation fails (volumes don’t make sense), raise an exception.

  • combine_plate_actions – If True, then if multiple actions in the Mix take the same volume from the same plate, they will be combined into a single PlateMap.

  • well_marker – By default the strand’s name is put in the relevant plate entry. If well_marker is specified and is a string, then that string is put into every well with a strand in the plate map instead. This is useful for printing plate maps that just put, for instance, an ‘X’ in the well to pipette (e.g., specify well_marker='X'), e.g., for experimental mixes that use only some strands in the plate. To enable the string to depend on the well position (instead of being the same string in every well), well_marker can also be a function that takes as input a string representing the well (such as "B3" or "E11"), and outputs a string. For example, giving the identity function mix.to_table(well_marker=lambda x: x) puts the well address itself in the well.

  • title_level – The “title” is the first line of the returned string, which contains the plate’s name and volume to pipette. The title_level controls the size, with 1 being the largest size, (header level 1, e.g., # title in Markdown or <h1>title</h1> in HTML).

  • warn_unsupported_title_format – If True, prints a warning if tablefmt is a currently unsupported option for the title. The currently supported formats for the title are ‘github’, ‘html’, ‘unsafehtml’, ‘rst’, ‘latex’, ‘latex_raw’, ‘latex_booktabs’, “latex_longtable”. If tablefmt is another valid option, then the title will be the Markdown format, i.e., same as for tablefmt = ‘github’.

  • tablefmt – By default set to ‘github’ to create a Markdown table. For other options see astanin/python-tabulate

  • include_plate_maps – If True, include plate maps as part of displayed instructions, otherwise only include the more compact mixing table (which is always displayed regardless of this parameter).

Returns:

generate_picklist(experiment: riverine.experiments.Experiment | None, _cache_key=None) Mix.generate_picklist.PickList | None[source]#
Parameters:

experiment – experiment to use for generating picklist

Return type:

picklist for the mix

instructions(*, plate_type: riverine.locations.PlateType = PlateType.wells96, raise_failed_validation: bool = False, combine_plate_actions: bool = True, well_marker: None | str | Callable[[str], str] = None, title_level: Literal[1, 2, 3, 4, 5, 6] = 3, warn_unsupported_title_format: bool = True, tablefmt: str | tabulate.TableFormat = 'pipe', include_plate_maps: bool = True) str[source]#

Returns string combiniing the string results of calling Mix.table() and Mix.plate_maps() (then calling PlateMap.to_table() on each PlateMap).

Parameters:

plate_type – 96-well or 384-well plate; default is 96-well.

raise_failed_validation:

If validation fails (volumes don’t make sense), raise an exception.

combine_plate_actions:

If True, then if multiple actions in the Mix take the same volume from the same plate, they will be combined into a single PlateMap.

well_marker:

By default the strand’s name is put in the relevant plate entry. If well_marker is specified and is a string, then that string is put into every well with a strand in the plate map instead. This is useful for printing plate maps that just put, for instance, an ‘X’ in the well to pipette (e.g., specify well_marker='X'), e.g., for experimental mixes that use only some strands in the plate. To enable the string to depend on the well position (instead of being the same string in every well), well_marker can also be a function that takes as input a string representing the well (such as "B3" or "E11"), and outputs a string. For example, giving the identity function mix.to_table(well_marker=lambda x: x) puts the well address itself in the well.

title_level:

The “title” is the first line of the returned string, which contains the plate’s name and volume to pipette. The title_level controls the size, with 1 being the largest size, (header level 1, e.g., # title in Markdown or <h1>title</h1> in HTML).

warn_unsupported_title_format:

If True, prints a warning if tablefmt is a currently unsupported option for the title. The currently supported formats for the title are ‘github’, ‘html’, ‘unsafehtml’, ‘rst’, ‘latex’, ‘latex_raw’, ‘latex_booktabs’, “latex_longtable”. If tablefmt is another valid option, then the title will be the Markdown format, i.e., same as for tablefmt = ‘github’.

tablefmt:

By default set to ‘github’ to create a Markdown table. For other options see astanin/python-tabulate

include_plate_maps:

If True, include plate maps as part of displayed instructions, otherwise only include the more compact mixing table (which is always displayed regardless of this parameter).

Returns:

plate_maps(plate_type: riverine.locations.PlateType = PlateType.wells96, validate: bool = True, combine_plate_actions: bool = True) list[PlateMap][source]#

Similar to table(), but indicates only the strands to mix from each plate, in the form of a PlateMap.

NOTE: this ignores any strands in the Mix that are in test tubes. To get a list of strand names in test tubes, call Mix.vol_to_tube_names() or Mix.tubes_markdown().

By calling PlateMap.to_markdown() on each plate map, one can create a Markdown representation of each plate map, for example,

plate 1, 5 uL each
|     | 1    | 2      | 3      | 4    | 5        | 6   | 7   | 8   | 9   | 10   | 11   | 12   |
|-----|------|--------|--------|------|----------|-----|-----|-----|-----|------|------|------|
| A   | mon0 | mon0_F |        | adp0 |          |     |     |     |     |      |      |      |
| B   | mon1 | mon1_Q | mon1_F | adp1 | adp_sst1 |     |     |     |     |      |      |      |
| C   | mon2 | mon2_F | mon2_Q | adp2 | adp_sst2 |     |     |     |     |      |      |      |
| D   | mon3 | mon3_Q | mon3_F | adp3 | adp_sst3 |     |     |     |     |      |      |      |
| E   | mon4 |        | mon4_Q | adp4 | adp_sst4 |     |     |     |     |      |      |      |
| F   |      |        |        | adp5 |          |     |     |     |     |      |      |      |
| G   |      |        |        |      |          |     |     |     |     |      |      |      |
| H   |      |        |        |      |          |     |     |     |     |      |      |      |

or, with the well_marker parameter of PlateMap.to_markdown() set to 'X', for instance (in case you don’t need to see the strand names and just want to see which wells are marked):

plate 1, 5 uL each
|     | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | 10   | 11   | 12   |
|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|------|------|
| A   | *   | *   |     | *   |     |     |     |     |     |      |      |      |
| B   | *   | *   | *   | *   | *   |     |     |     |     |      |      |      |
| C   | *   | *   | *   | *   | *   |     |     |     |     |      |      |      |
| D   | *   | *   | *   | *   | *   |     |     |     |     |      |      |      |
| E   | *   |     | *   | *   | *   |     |     |     |     |      |      |      |
| F   |     |     |     | *   |     |     |     |     |     |      |      |      |
| G   |     |     |     |     |     |     |     |     |     |      |      |      |
| H   |     |     |     |     |     |     |     |     |     |      |      |      |
Parameters:
  • plate_type – 96-well or 384-well plate; default is 96-well.

  • validate – Ensure volumes make sense.

  • combine_plate_actions – If True, then if multiple actions in the Mix take the same volume from the same plate, they will be combined into a single PlateMap.

Return type:

A list of all plate maps.

_plate_map_from_mixline(mixline: riverine.printing.MixLine, plate_type: riverine.locations.PlateType, existing_plate_map: PlateMap | None) PlateMap[source]#
_update_volumes(consumed_volumes: dict[str, riverine.units.Quantity] | None = None, made_volumes: dict[str, riverine.units.Quantity] | None = None, _cache_key=None) Tuple[dict[str, riverine.units.Quantity], dict[str, riverine.units.Quantity]][source]#

Given a

_unstructure(experiment: riverine.experiments.Experiment | None = None) dict[str, Any][source]#
classmethod _structure(d: dict[str, Any], experiment: riverine.experiments.Experiment | None = None) Mix[source]#
riverine.abbreviated.Q_(qty: int | str | decimal.Decimal | float, unit: str | pint.Unit | pint.facets.plain.PlainUnit | pint.Quantity | None = None) DecimalQuantity[source]#

Convenient constructor for units, eg, Q_(5.0, 'nM'). Ensures that the quantity is a Decimal.

riverine.abbreviated.nM[source]#
riverine.abbreviated.ureg[source]#
riverine.abbreviated.ureg[source]#
riverine.abbreviated.uL[source]#
riverine.abbreviated.nM[source]#
riverine.abbreviated.uM[source]#
riverine.abbreviated.Q_(qty: int | str | decimal.Decimal | float, unit: str | pint.Unit | pint.facets.plain.PlainUnit | pint.Quantity | None = None) DecimalQuantity[source]#

Convenient constructor for units, eg, Q_(5.0, 'nM'). Ensures that the quantity is a Decimal.

riverine.abbreviated.FV[source]#
riverine.abbreviated.FC[source]#
riverine.abbreviated.EC[source]#
riverine.abbreviated.TC[source]#
riverine.abbreviated.S[source]#
riverine.abbreviated.C[source]#
riverine.abbreviated.Ref[source]#
riverine.abbreviated.Exp[source]#
riverine.abbreviated.uM[source]#
riverine.abbreviated.nM[source]#
riverine.abbreviated.mM[source]#
riverine.abbreviated.nL[source]#
riverine.abbreviated.uL[source]#
riverine.abbreviated.mL[source]#