autoprotocol.container

container.Container

class autoprotocol.container.Container(id, container_type, name=None, storage=None, cover=None)

A reference to a specific physical container (e.g. a tube or 96-well microplate).

Every Container has an associated ContainerType, which defines the well count and arrangement, amongst other properties.

There are several methods on Container which present a convenient interface for defining subsets of wells on which to operate. These methods return a WellGroup.

Containers are usually declared using the Protocol.ref method.

Parameters:
  • name (str) – name of the container/ref being created.
  • id (string) – Alphanumerical identifier for a Container.
  • container_type (ContainerType) – ContainerType associated with a Container.

Container.well()

Container.well(i)

Return a Well object representing the well at the index specified of this Container.

Parameters:i (int, str) – Well reference in the form of an integer (ex: 0) or human-readable string (ex: “A1”).

Container.tube()

Container.tube()

Checks if container is tube and returns a Well respresenting the zeroth well.

Returns:
Return type:Well
Raises:AttributeError : – If container is not tube

Container.wells()

Container.wells(*args)

Return a WellGroup containing references to wells corresponding to the index or indices given.

Parameters:args (str, int, list) – Reference or list of references to a well index either as an integer or a string.

Container.robotize()

Container.robotize(well_ref)

Return the integer representation of the well index given, based on the ContainerType of the Container.

Uses the robotize function from the ContainerType class. Refer to ContainerType.robotize() for more information.

Container.humanize()

Container.humanize(well_ref)

Return the human readable representation of the integer well index given based on the ContainerType of the Container.

Uses the humanize function from the ContainerType class. Refer to ContainerType.humanize() for more information.

Container.decompose()

Container.decompose(well_ref)

Return a tuple representing the column and row number of the well index given based on the ContainerType of the Container.

Uses the decompose function from the ContainerType class. Refer to ContainerType.decompose() for more information.

Container.all_wells()

Container.all_wells(columnwise=False)

Return a WellGroup representing all Wells belonging to this Container.

Parameters:columnwise (bool, optional) – returns the WellGroup columnwise instead of rowwise (ordered by well index).

Container.quadrant()

Container.quadrant(quad)

Return a WellGroup of Wells corresponding to the selected quadrant of this Container.

This is only applicable to 384-well plates.

Parameters:quad (int) – Specifies the quadrant number of the well (ex. 2)

Container.wells_from()

Container.wells_from(start, num, columnwise=False)

Return a WellGroup of Wells belonging to this Container starting from the index indicated (in integer or string form) and including the number of proceeding wells specified. Wells are counted from the starting well rowwise unless columnwise is True.

Parameters:
  • start (Well, int, str) – Starting well specified as a Well object, a human-readable well index or an integer well index.
  • num (int) – Number of wells to include in the Wellgroup.
  • columnwise (bool, optional) – Specifies whether the wells included should be counted columnwise instead of the default rowwise.

Container.inner_wells()

Container.inner_wells(columnwise=False)

Return a WellGroup of all wells on a plate excluding wells in the top and bottom rows and in the first and last columns.

Parameters:columnwise (bool, optional) – returns the WellGroup columnwise instead of rowwise (ordered by well index).

Container.discard()

Container.discard()

Set the storage condition of a container to None and container to be discarded if ref in protocol.

Example

p = Protocol()
container = p.ref("new_container", cont_type="96-pcr",
                  storage="cold_20")
p.incubate(c, "warm_37", "30:minute")
container.discard()

Autoprotocol generated:

.. code-block:: json

   "refs": {
      "new_container": {
        "new": "96-pcr",
        "discard": true
      }
    }

Container.set_storage()

Container.set_storage(storage)

Set the storage condition of a container, will overwrite an existing storage condition, will remove discard True.

Parameters:storage (str) – Storage condition.
Raises:TypeError : – If storage condition not of type str.

container.Well

class autoprotocol.container.Well(container, index)

A Well object describes a single location within a container.

Do not construct a Well directly – retrieve it from the related Container object.

Parameters:
  • container (Container) – The Container this well belongs to.
  • index (integer) – The index of this well within the container.
  • volume (Unit) – Theoretical volume of this well.
  • properties (dict) – Additional properties of this well represented as a dictionary.

Well.set_properties()

Well.set_properties(properties)

Set properties for a Well. Existing property dictionary will be completely overwritten with the new dictionary.

Parameters:properties (dict) – Custom properties for a Well in dictionary form.

Well.add_properties()

Well.add_properties(properties)

Add properties to the properties attribute of a Well. If any key/value pairs are present in both the old and new dictionaries, they will be overwritten by the pairs in the new dictionary.

Parameters:properties (dict) – Dictionary of properties to add to a Well.

Well.set_volume()

Well.set_volume(vol)

Set the theoretical volume of liquid in a Well.

Parameters:vol (str, Unit) – Theoretical volume to indicate for a Well.

Well.set_name()

Well.set_name(name)

Set a name for this well for it to be included in a protocol’s “outs” section

Parameters:name (str) – Well name.

Well.humanize()

Well.humanize()

Return the human readable representation of the integer well index given based on the ContainerType of the Well.

Uses the humanize function from the ContainerType class. Refer to ContainerType.humanize() for more information.

Well.__repr__()

Well.__repr__()

Return a string representation of a Well.

container.WellGroup

class autoprotocol.container.WellGroup(wells)

A logical grouping of Wells.

Wells in a WellGroup do not necessarily need to be in the same container.

Parameters:wells (list) – List of Well objects contained in this WellGroup.

WellGroup.set_properties()

WellGroup.set_properties(properties)

Set the same properties for each Well in a WellGroup.

Parameters:properties (dict) – Dictionary of properties to set on Well(s).

WellGroup.set_volume()

WellGroup.set_volume(vol)

Set the volume of every well in the group to vol.

Parameters:vol (Unit, str) – Theoretical volume of each well in the WellGroup.

WellGroup.set_group_name()

WellGroup.set_group_name(name)

Assigns a name to a WellGroup.

Parameters:name (str) – WellGroup name

WellGroup.wells_with()

WellGroup.wells_with(prop, val=None)

Returns a wellgroup of wells with the specified property and value

Parameters:
  • prop (str) – the property you are searching for
  • val (str) – the value assigned to the property

WellGroup.indices()

WellGroup.indices()

Return the indices of the wells in the group in human-readable form, given that all of the wells belong to the same container.

WellGroup.append()

WellGroup.append(other)

Append another well to this WellGroup.

Parameters:other (Well) – Well to append to this WellGroup.

WellGroup.extend()

WellGroup.extend(other)

Extend this WellGroup with another WellGroup.

Parameters:other (WellGroup or list of Wells) – WellGroup to extend this WellGroup.

WellGroup.pop()

WellGroup.pop(index=-1)

Removes and returns the last well in the wellgroup, unless an index is specified. If index is specified, the well at that index is removed from the wellgroup and returned.

Parameters:index (int) – the index of the well you want to remove and return

WellGroup.insert()

WellGroup.insert(i, well)

Insert a well at a given position.

Parameters:
  • i (int) – index to insert the well at
  • well (Well) – insert this well at the index

WellGroup.__getitem__()

WellGroup.__getitem__(key)

Return a specific Well from a WellGroup.

Parameters:key (int) – Position in a WellGroup in robotized form.

WellGroup.__len__()

WellGroup.__len__()

Return the number of Wells in a WellGroup.

WellGroup.__repr__()

WellGroup.__repr__()

Return a string representation of a WellGroup.

WellGroup.__add__()

WellGroup.__add__(other)

Append a Well or Wells from another WellGroup to this WellGroup.

Parameters:other (Well, WellGroup.) –