BMS.Create_Labware_Needed() Function¶
This function can be used to calculate how many of a certain labware is needed based on the number of wells required, and create them as BMS.Labware_Layout objects. This can be useful when writing automation protocols where the number of wells required varies based on user inputs.
Usage¶
First, the BMS generic tools module is imported as BMS
import BiomationScripter as BMS
In this example, the BMS.Create_Labware_Needed function will be used to caclulate the number of 96 well PCR plates required based on the number of PCR reactions to be prepared. These plates will then be generated as BMS.Labware_Layout objects.
First, the number of PCR reactions is defined
Number_Of_PCR_Reactions = 234
Next, the PCR plate should be defined using the BMS.Labware_Layout class
PCR_Plate = BMS.Labware_Layout(
Name = "PCR Plate",
Type = "96 Well Plate"
)
PCR_Plate.define_format(
Rows = 8,
Columns = 12
)
print(PCR_Plate)
<BiomationScripter.Labware_Layout object at 0x00000261FB02B3D0>
Finally, the number of wells available in the PCR plate should be defined. By default, this is set to "All", which specifies that all wells in the Labware_Layout are available for use.
Wells_Available = "All"
# This could also be an int, which is useful when the `Labware_Layout` has no format defined
# Wells_Available = 96
Finally, the BMS.Create_Labware_Needed function can be used to calculate the number of PCR plates required, and return them as BMS.Labware_Layout objects.
PCR_Plate_Layouts = BMS.Create_Labware_Needed(
Labware_Format = PCR_Plate,
N_Wells_Needed = Number_Of_PCR_Reactions,
N_Wells_Available = Wells_Available
)
As can be seen below, three Labware_Layout objects were created and returned.
print(PCR_Plate_Layouts)
[<BiomationScripter.Labware_Layout object at 0x00000261FB02B3D0>, <BiomationScripter.Labware_Layout object at 0x00000261FCE79E20>, <BiomationScripter.Labware_Layout object at 0x00000261FCE792B0>]
It is possible to define whether or not the Labware_Layout used as the template (specified using the Labware_Format argument) is included in the list of Labware_Layout objects returned. By default, it is. Below it is shown how to specify that the template layout should not be returned
PCR_Plate_Layouts = BMS.Create_Labware_Needed(
Labware_Format = PCR_Plate,
N_Wells_Needed = Number_Of_PCR_Reactions,
N_Wells_Available = Wells_Available,
Return_Original_Layout = False
)
print(PCR_Plate_Layouts)
[<BiomationScripter.Labware_Layout object at 0x00000261FCE79A30>, <BiomationScripter.Labware_Layout object at 0x00000261FCE79790>]
Changing the number of wells required changes the number of Labware_Layout objects returned
Number_Of_PCR_Reactions = 20
PCR_Plate_Layouts = BMS.Create_Labware_Needed(
Labware_Format = PCR_Plate,
N_Wells_Needed = Number_Of_PCR_Reactions,
N_Wells_Available = Wells_Available,
Return_Original_Layout = True
)
print(PCR_Plate_Layouts)
[<BiomationScripter.Labware_Layout object at 0x00000261FB02B3D0>]
In the case above, the original Labware_Layout object is simply returned
PCR_Plate_Layouts[0] == PCR_Plate
True