BMS.well_range() Function¶
This function allows a well range to be converted into a list of wells, based on a set of arguments defined by the user.
Usage - Without BMS.Labware_Layout¶
First, the BMS generic tools module is imported as BMS
import BiomationScripter as BMS
BMS.well_range takes a well range as a string in the format "First_Well:Last_Well"
Well_Range = "A5:C6"
Aside from the well range argument, there are three other arguments which are used to tell the BMS.well_range function how to determine which wells are in the well range specified. The first of these which will be covered in the Box argument. When Box is set to True, the well range is determined to be in the shape of a box.
BMS.well_range(
Wells = Well_Range,
Box = True
)
['A5', 'A6', 'B5', 'B6', 'C5', 'C6']
The above well range is defined as a boxed well range as if the wells were highlighted on the labware, it would form a box shape. See the BMS.well_range documentation for more information on this.
The second argument to be covered here is the Direction argument. This determines whether wells are added to the well range horizontally (i.e. selecting wells in the same row before moving to the next row) or vertically (i.e. selecting wells in the same column before moving to the next column). Direction must be either "Horizontal" or "Vertical". By default, it is "Horizontal". Below, the same well range as above is defined, but this time the Direction is set to "Vertical".
BMS.well_range(
Wells = Well_Range,
Box = True,
Direction = "Vertical"
)
['A5', 'B5', 'C5', 'A6', 'B6', 'C6']
By default, the Box argument is set to False. However, in the cases shown above, this will cause an error to occur
BMS.well_range(
Wells = Well_Range
)
--------------------------------------------------------------------------- LabwareError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_24848/171347137.py in <module> ----> 1 BMS.well_range( 2 Wells = Well_Range 3 ) ~\anaconda3\lib\site-packages\BiomationScripter\__init__.py in well_range(Wells, Labware_Format, Direction, Box) 671 672 if not Labware_Format and not Box: --> 673 raise LabwareError("`Box` can only be `False` when `Labware_Format` is specified") 674 675 if not Labware_Format or Box: LabwareError: `Box` can only be `False` when `Labware_Format` is specified
This is because for a non-boxed well range to be returned, number of rows and columns in the labware must be specified to define the labware boundaries. This is defined using the Labware_Format argument, and can take the form of a list, where the number of rows is specified first, followed by the number of columns.
Format_For_96_Well_Plate = [8, 12]
BMS.well_range(
Wells = Well_Range,
Labware_Format = Format_For_96_Well_Plate
)
['A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'A11', 'A12', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'B10', 'B11', 'B12', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6']
Once again, the Direction can be changed to determine the order of the wells in the well range
Format_For_96_Well_Plate = [8, 12]
BMS.well_range(
Wells = Well_Range,
Labware_Format = Format_For_96_Well_Plate,
Direction = "Vertical"
)
['A5', 'B5', 'C5', 'D5', 'E5', 'F5', 'G5', 'H5', 'A6', 'B6', 'C6']
The Box argument can also be set to True
Format_For_96_Well_Plate = [8, 12]
BMS.well_range(
Wells = Well_Range,
Labware_Format = Format_For_96_Well_Plate,
Box = True
)
['A5', 'A6', 'B5', 'B6', 'C5', 'C6']
Usage - With BMS.Labware_Layout¶
It is also possible to use a BMS.Labware_Layout object to define the format of the labware.
Example_Plate_Layout = BMS.Labware_Layout(
Name = "Example Plate",
Type = "96 Well Plate"
)
Example_Plate_Layout.define_format(8, 12)
BMS.well_range(
Wells = Well_Range,
Labware_Format = Example_Plate_Layout
)
['A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'A11', 'A12', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'B10', 'B11', 'B12', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6']