riverine.abbreviated
====================

.. py:module:: riverine.abbreviated


Attributes
----------

.. autoapisummary::

   riverine.abbreviated.nM
   riverine.abbreviated.uL
   riverine.abbreviated.ureg
   riverine.abbreviated.uM
   riverine.abbreviated.nM
   riverine.abbreviated.ureg
   riverine.abbreviated.ureg
   riverine.abbreviated.uL
   riverine.abbreviated.nM
   riverine.abbreviated.uM
   riverine.abbreviated.FV
   riverine.abbreviated.FC
   riverine.abbreviated.EC
   riverine.abbreviated.TC
   riverine.abbreviated.S
   riverine.abbreviated.C
   riverine.abbreviated.Ref
   riverine.abbreviated.Exp
   riverine.abbreviated.uM
   riverine.abbreviated.nM
   riverine.abbreviated.mM
   riverine.abbreviated.nL
   riverine.abbreviated.uL
   riverine.abbreviated.mL


Classes
-------

.. autoapisummary::

   riverine.abbreviated.Mix


Functions
---------

.. autoapisummary::

   riverine.abbreviated.Q_
   riverine.abbreviated.Q_
   riverine.abbreviated.Q_


Module Contents
---------------

.. py:function:: Q_(qty: int | str | decimal.Decimal | float, unit: str | pint.Unit | pint.facets.plain.PlainUnit | pint.Quantity | None = None) -> DecimalQuantity

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


.. py:data:: nM

.. py:data:: uL

.. py:data:: ureg

.. py:data:: uM

.. py:class:: Mix(*args, **kwargs)

   Bases: :py:obj:`riverine.components.AbstractComponent`


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


   .. py:attribute:: __hash__


   .. py:attribute:: actions
      :type:  riverine.units.Sequence[riverine.actions.AbstractAction]


   .. py:attribute:: name
      :type:  str
      :value: ''


      Name of the component.


   .. py:attribute:: test_tube_name
      :type:  str | None

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


   .. py:attribute:: fixed_concentration
      :type:  str | riverine.units.DecimalQuantity | None


   .. py:attribute:: reference
      :type:  riverine.references.Reference | None
      :value: None



   .. py:attribute:: min_volume
      :type:  riverine.units.DecimalQuantity


   .. py:attribute:: plate
      :type:  str | None


   .. py:attribute:: well
      :type:  riverine.locations.WellPos | None


   .. py:property:: is_mix
      :type: bool



   .. py:property:: fixed_total_volume
      :type: riverine.units.DecimalQuantity



   .. py:property:: buffer_name
      :type: str



   .. py:method:: __eq__(other: object) -> bool


   .. py:method:: __attrs_post_init__() -> None


   .. py:method:: printed_name(tablefmt: str | tabulate.TableFormat) -> str


   .. py:property:: concentration
      :type: 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.


   .. py:method:: _get_concentration(_cache_key=None) -> riverine.units.DecimalQuantity


   .. py:property:: total_volume
      :type: 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.


   .. py:method:: _get_total_volume(_cache_key=None) -> riverine.units.DecimalQuantity


   .. py:property:: buffer_volume
      :type: riverine.units.Quantity


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


   .. py:method:: _get_buffer_volume(_cache_key=None) -> riverine.units.Quantity


   .. py:method:: 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

      Generate a table describing the mix.

      :param tablefmt: The output format for the table.
      :param validate: Ensure volumes make sense.



   .. py:method:: mixlines(tablefmt: str | tabulate.TableFormat = 'pipe', _cache_key=None) -> list[riverine.printing.MixLine]


   .. py:method:: has_fixed_concentration_action() -> bool


   .. py:method:: has_fixed_total_volume() -> bool


   .. py:method:: 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]


   .. py:method:: all_components_polars(_cache_key=None) -> polars.DataFrame


   .. py:method:: all_components() -> pandas.DataFrame

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



   .. py:method:: _repr_markdown_() -> str


   .. py:method:: _repr_html_() -> str


   .. py:method:: infoline(_cache_key=None) -> str


   .. py:method:: __repr__() -> str


   .. py:method:: __str__() -> str


   .. py:method:: with_experiment(experiment: riverine.experiments.Experiment, *, inplace: bool = True) -> Mix


   .. py:method:: with_reference(reference: riverine.references.Reference, *, inplace: bool = True) -> Mix


   .. py:property:: location
      :type: tuple[str, riverine.locations.WellPos | None]



   .. py:method:: vol_to_tube_names(tablefmt: str | tabulate.TableFormat = 'pipe', validate: bool = True) -> dict[riverine.units.DecimalQuantity, list[str]]

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



   .. py:method:: _tube_map_from_mixline(mixline: riverine.printing.MixLine) -> str


   .. py:method:: tubes_markdown(tablefmt: str | tabulate.TableFormat = 'pipe') -> str

      :param tablefmt: table format (see :meth:`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*



   .. py:method:: 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

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

      :param plate_type: 96-well or 384-well plate; default is 96-well.
      :param raise_failed_validation: If validation fails (volumes don't make sense), raise an exception.
      :param 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 :class:`PlateMap`.
      :param 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.
      :param 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).
      :param 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'.
      :param tablefmt: By default set to `'github'` to create a Markdown table. For other options see
                       https://github.com/astanin/python-tabulate#readme
      :param 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: * pipetting instructions in the form of strings combining results of :meth:`Mix.table` and
                * :meth:`Mix.plate_maps`



   .. py:method:: generate_picklist(experiment: riverine.experiments.Experiment | None, _cache_key=None) -> Mix.generate_picklist.PickList | None

      :param experiment: experiment to use for generating picklist

      :rtype: picklist for the mix



   .. py:method:: 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

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

      :param 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 :class:`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
          https://github.com/astanin/python-tabulate#readme

      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: * pipetting instructions in the form of strings combining results of :meth:`Mix.table` and
                * :meth:`Mix.plate_maps`



   .. py:method:: plate_maps(plate_type: riverine.locations.PlateType = PlateType.wells96, validate: bool = True, combine_plate_actions: bool = True) -> list[PlateMap]

      Similar to :meth:`table`, but indicates only the strands to mix from each plate,
      in the form of a :class:`PlateMap`.

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

      By calling :meth:`PlateMap.to_markdown` on each plate map,
      one can create a Markdown representation of each plate map, for example,

      .. code-block::

          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 :meth:`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):

      .. code-block::

          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   |     |     |     |     |     |     |     |     |     |      |      |      |

      :param plate_type: 96-well or 384-well plate; default is 96-well.
      :param validate: Ensure volumes make sense.
      :param 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 :class:`PlateMap`.

      :rtype: A list of all plate maps.



   .. py:method:: _plate_map_from_mixline(mixline: riverine.printing.MixLine, plate_type: riverine.locations.PlateType, existing_plate_map: PlateMap | None) -> PlateMap


   .. py:method:: _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]]

      Given a



   .. py:method:: _unstructure(experiment: riverine.experiments.Experiment | None = None) -> dict[str, Any]


   .. py:method:: _structure(d: dict[str, Any], experiment: riverine.experiments.Experiment | None = None) -> Mix
      :classmethod:



.. py:function:: Q_(qty: int | str | decimal.Decimal | float, unit: str | pint.Unit | pint.facets.plain.PlainUnit | pint.Quantity | None = None) -> DecimalQuantity

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


.. py:data:: nM

.. py:data:: ureg

.. py:data:: ureg

.. py:data:: uL

.. py:data:: nM

.. py:data:: uM

.. py:function:: Q_(qty: int | str | decimal.Decimal | float, unit: str | pint.Unit | pint.facets.plain.PlainUnit | pint.Quantity | None = None) -> DecimalQuantity

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


.. py:data:: FV

.. py:data:: FC

.. py:data:: EC

.. py:data:: TC

.. py:data:: S

.. py:data:: C

.. py:data:: Ref

.. py:data:: Exp

.. py:data:: uM

.. py:data:: nM

.. py:data:: mM

.. py:data:: nL

.. py:data:: uL

.. py:data:: mL

