autoprotocol support¶
autoprotocol.unit¶
unit.Unit¶
- class autoprotocol.unit.Unit(value, units=None)[source]¶
A representation of a measure of physical quantities such as length, mass, time and volume. Uses Pint’s Quantity as a base class for implementing units and inherits functionalities such as conversions and proper unit arithmetic. Note that the magnitude is stored as a double-precision float, so there are inherent issues when dealing with extremely large/small numbers as well as numerical rounding for non-base 2 numbers.
Example
vol_1 = Unit(10, 'microliter') vol_2 = Unit(10, 'liter') print(vol_1 + vol_2) time_1 = Unit(1, 'second') speed_1 = vol_1/time_1 print (speed_1) print (speed_1.to('liter/hour'))
- Returns
unit object
10000010.0:microliter 10.0:microliter / second 0.036:liter / hour
- Return type
- units: Optional[str] = None¶
- __str__(ndigits=12)[source]¶
- Parameters
ndigits (int, optional) – Number of decimal places to round to, useful for numerical precision reasons
- Returns
This rounds the string presentation to 12 decimal places by default to account for the majority of numerical precision issues
- Return type
str
- property magnitude¶
Quantity’s magnitude. Long form for m
- ceil()[source]¶
Equivalent of math.ceil(Unit) for python 2 compatibility
- Returns
ceil of Unit
- Return type
autoprotocol.util¶
util.is_valid_well()¶
util.parse_unit()¶
- autoprotocol.util.parse_unit(unit, accepted_unit=None)[source]¶
Parses and checks unit provided and ensures its of valid type and dimensionality.
Note that this also checks against the dimensionality of the accepted_unit. I.e. parse_unit(“1:s”, “minute”) will return True.
Raises type errors if the Unit provided is invalid.
- Parameters
Examples
parse_unit("1:ul", "1:ml") parse_unit("1:ul", "ml") parse_unit("1:ul", ["ml", "kg"])
- Returns
Parsed and checked unit
- Return type
- Raises
TypeError – Error when input does not match expected type or dimensionality
autoprotocol.harness¶
harness.run()¶
- autoprotocol.harness.run(fn, protocol_name=None, seal_after_run=True, protocol_class=None)[source]¶
Run the protocol specified by the function.
If protocol_name is passed, use preview parameters from the protocol with the matching “name” value in the manifest.json file to run the given function. Otherwise, take configuration JSON file from the command line and run the given function.
- Parameters
fn (function) – Function that generates Autoprotocol
protocol_name (str, optional) – str matching the “name” value in the manifest.json file
seal_after_run (bool, optional) – Implicitly add a seal/cover to all stored refs within the protocol using seal_on_store()
protocol_class (Protocol, optional) – References the base protocol class to be used for instantiation. If not provided, defaults to using Autoprotocol Python’s default Protocol implementation
- Raises
TypeError – If protocol_class provided is not a subclass of Protocol
harness.seal_on_store()¶
- autoprotocol.harness.seal_on_store(protocol)[source]¶
Implicitly adds seal/cover instructions to the end of a run for containers that do not have a cover. Cover type applied defaults first to “seal” if its within the capabilities of the container type, otherwise to “cover”.
Example Usage:
def example_method(protocol, params): cont = params['container'] p.transfer(cont.well("A1"), cont.well("A2"), "10:microliter") p.seal(cont) p.unseal(cont) p.cover(cont) p.uncover(cont)
Autoprotocol Output:
{ "refs": { "plate": { "new": "96-pcr", "store": { "where": "ambient" } } }, "instructions": [ { "groups": [ { "transfer": [ { "volume": "10.0:microliter", "to": "plate/1", "from": "plate/0" } ] } ], "op": "pipette" }, { "object": "plate", "type": "ultra-clear", "op": "seal" }, { "object": "plate", "op": "unseal" }, { "lid": "universal", "object": "plate", "op": "cover" }, { "object": "plate", "op": "uncover" }, { "type": "ultra-clear", "object": "plate", "op": "seal" } ] }
harness.Manifest¶
- class autoprotocol.harness.Manifest(json_dict)[source]¶
Object representation of a manifest.json file
- Parameters
object (JSON object) –
A manifest.json file with the following format:
{ "format": "python", "license": "MIT", "description": "This is a protocol.", "protocols": [ { "name": "SampleProtocol", "version": 1.0.0, "command_string": "python sample_protocol.py", "preview": { "refs":{}, "parameters": {}, "inputs": {}, "dependencies": [] } } ] }