diff --git a/abr-testing/abr_testing/data_collection/abr_calibration_logs.py b/abr-testing/abr_testing/data_collection/abr_calibration_logs.py index d632a53dd31..f1501609605 100644 --- a/abr-testing/abr_testing/data_collection/abr_calibration_logs.py +++ b/abr-testing/abr_testing/data_collection/abr_calibration_logs.py @@ -363,6 +363,4 @@ def run( folder_name = args.folder_name[0] google_sheet_name = args.google_sheet_name[0] email = args.email[0] - run( - storage_directory, folder_name, google_sheet_name, email - ) + run(storage_directory, folder_name, google_sheet_name, email) diff --git a/abr-testing/abr_testing/protocols/__init__.py b/abr-testing/abr_testing/protocols/__init__.py index 309f19697cf..2f0d01ea241 100644 --- a/abr-testing/abr_testing/protocols/__init__.py +++ b/abr-testing/abr_testing/protocols/__init__.py @@ -1 +1 @@ -"""protocols.""" \ No newline at end of file +"""protocols.""" diff --git a/abr-testing/abr_testing/protocols/api 2.20/12_KAPA HyperPlus Library Prep.py b/abr-testing/abr_testing/protocols/api 2.20/12_KAPA HyperPlus Library Prep.py index d60cfe405fd..4f9fe05d976 100644 --- a/abr-testing/abr_testing/protocols/api 2.20/12_KAPA HyperPlus Library Prep.py +++ b/abr-testing/abr_testing/protocols/api 2.20/12_KAPA HyperPlus Library Prep.py @@ -153,7 +153,7 @@ def run(ctx: ProtocolContext) -> None: trash = ctx.load_waste_chute() # Load TC Lids - unused_lids = helpers.load_disposable_lids(ctx, 5, "C3") + unused_lids = helpers.load_disposable_lids(ctx, 5, ["C3"]) # Import Global Variables global tip50 diff --git a/abr-testing/abr_testing/protocols/api 2.20/5_96ch complex protocol with single tip Pick Up.py b/abr-testing/abr_testing/protocols/api 2.20/5_96ch complex protocol with single tip Pick Up.py index 53b68503202..502e89cf8a9 100644 --- a/abr-testing/abr_testing/protocols/api 2.20/5_96ch complex protocol with single tip Pick Up.py +++ b/abr-testing/abr_testing/protocols/api 2.20/5_96ch complex protocol with single tip Pick Up.py @@ -62,7 +62,7 @@ def run(ctx: ProtocolContext) -> None: helpers.temp_str, "C1" ) # type: ignore[assignment] if disposable_lid: - unused_lids = helpers.load_disposable_lids(ctx, 3, "A4") + unused_lids = helpers.load_disposable_lids(ctx, 3, ["A4"]) used_lids: List[Labware] = [] thermocycler.open_lid() h_s.open_labware_latch() diff --git a/abr-testing/abr_testing/protocols/api 2.20/bms_pcr_protocol_220api.py b/abr-testing/abr_testing/protocols/api 2.20/bms_pcr_protocol_220api.py index 54c121f9294..873f7026d09 100644 --- a/abr-testing/abr_testing/protocols/api 2.20/bms_pcr_protocol_220api.py +++ b/abr-testing/abr_testing/protocols/api 2.20/bms_pcr_protocol_220api.py @@ -1,104 +1,114 @@ """BMS PCR Protocol.""" from opentrons.protocol_api import ParameterContext, ProtocolContext, Labware -from opentrons.protocol_api.module_contexts import ThermocyclerContext, TemperatureModuleContext +from opentrons.protocol_api.module_contexts import ( + ThermocyclerContext, + TemperatureModuleContext, +) from opentrons.protocol_api import SINGLE from abr_testing.protocols import helpers -import threading from opentrons.hardware_control.modules.types import ThermocyclerStep from typing import List metadata = { - 'protocolName': 'PCR Protocol with TC Auto Sealing Lid', - 'author': 'Rami Farawi None: + """Parameters.""" helpers.create_pipette_mount_parameter(parameters) helpers.create_disposable_lid_parameter(parameters) parameters.add_csv_file( - display_name = "Samples", - variable_name = "samples_csv", - description = "Asp/ disp volumes." + display_name="Samples", + variable_name="samples_csv", + description="Asp/ disp volumes.", ) -def run(ctx: ProtocolContext)-> None: - """Protocol.""" - pipette_mount = ctx.params.pipette_mount - disposable_lid = ctx.params.disposable_lid - csv_samp = ctx.params.samples_csv +def run(ctx: ProtocolContext) -> None: + """Protocol.""" + pipette_mount = ctx.params.pipette_mount # type: ignore[attr-defined] + disposable_lid = ctx.params.disposable_lid # type: ignore[attr-defined] + parsed_csv = ctx.params.csv_data.parse_as_csv() # type: ignore[attr-defined] + rxn_vol = 50 real_mode = True # DECK SETUP AND LABWARE - tc_mod: ThermocyclerContext = ctx.load_module('thermocyclerModuleV2') + tc_mod: ThermocyclerContext = ctx.load_module( + "thermocyclerModuleV2" + ) # type: ignore[assignment] tc_mod.open_lid() tc_mod.set_lid_temperature(105) - temp_mod: TemperatureModuleContext = ctx.load_module('temperature module gen2', location='D3') + temp_mod: TemperatureModuleContext = ctx.load_module( + "temperature module gen2", location="D3" + ) # type: ignore[assignment] reagent_rack = temp_mod.load_labware( - 'opentrons_24_aluminumblock_nest_1.5ml_snapcap') # check if 2mL + "opentrons_24_aluminumblock_nest_1.5ml_snapcap" + ) # check if 2mL - dest_plate = tc_mod.load_labware('opentrons_96_wellplate_200ul_pcr_full_skirt') # do I change this to tough plate if they run pcr? + dest_plate = tc_mod.load_labware( + "opentrons_96_wellplate_200ul_pcr_full_skirt" + ) # do I change this to tough plate if they run pcr? - source_plate = ctx.load_labware('opentrons_96_wellplate_200ul_pcr_full_skirt', location="D1") # do I change this to their plate? + source_plate = ctx.load_labware( + "opentrons_96_wellplate_200ul_pcr_full_skirt", location="D1" + ) # do I change this to their plate? + + tiprack_50 = [ + ctx.load_labware("opentrons_flex_96_tiprack_50ul", slot) for slot in [8, 9] + ] - tiprack_50 = [ctx.load_labware('opentrons_flex_96_tiprack_50ul', slot) for slot in [8, 9]] - # Opentrons tough pcr auto sealing lids if disposable_lid: - unused_lids = [ctx.load_labware("opentrons_tough_pcr_auto_sealing_lid", "C3")] - for i in range(2): - unused_lids.append(unused_lids[-1].load_labware("opentrons_tough_pcr_auto_sealing_lid")) - unused_lids.reverse() - used_lids = [] + unused_lids = helpers.load_disposable_lids(ctx, 3, ["C3"]) + used_lids: List[Labware] = [] # LOAD PIPETTES p50 = ctx.load_instrument( - "flex_8channel_50", pipette_mount, tip_racks=tiprack_50, liquid_presence_detection = True) - p50.configure_nozzle_layout( - style=SINGLE, - start="A1", - tip_racks=tiprack_50) + "flex_8channel_50", + pipette_mount, + tip_racks=tiprack_50, + liquid_presence_detection=True, + ) + p50.configure_nozzle_layout(style=SINGLE, start="A1", tip_racks=tiprack_50) ctx.load_trash_bin("A3") - ctx.define_liquid(name="Mastermix", description='Mastermix', display_color='#008000') - ctx.define_liquid(name="Water", description='Water', display_color='#A52A2A') - ctx.define_liquid(name="DNA", description='DNA', display_color='#A52A2A') + mmx_liq = ctx.define_liquid( + name="Mastermix", description="Mastermix", display_color="#008000" + ) + water_liq = ctx.define_liquid( + name="Water", description="Water", display_color="#A52A2A" + ) + dna_liq = ctx.define_liquid(name="DNA", description="DNA", display_color="#A52A2A") # mapping - csv_lines = [[val.strip() for val in line.split(',')] - for line in csv_samp.splitlines() - if line.split(',')[0].strip()][1:] - temp_mod.set_temperature(4) - - water = reagent_rack['B1'] + water = reagent_rack["B1"] water.load_liquid(liquid=water_liq, volume=1500) # mmx_pic = reagent_rack.rows()[0] for mmx_well in mmx_pic: mmx_well.load_liquid(liquid=mmx_liq, volume=1500) - + dna_pic = source_plate.wells() for dna_well in dna_pic: dna_well.load_liquid(liquid=dna_liq, volume=50) # adding water - ctx.comment('\n\n----------ADDING WATER----------\n') + ctx.comment("\n\n----------ADDING WATER----------\n") p50.pick_up_tip() # p50.aspirate(40, water) # prewet # p50.dispense(40, water) - for row in csv_lines: + num_of_rows = len(parsed_csv) + for row in range(num_of_rows): water_vol = row[1] - if water_vol.lower() == 'x': + if water_vol.lower() == "x": continue water_vol = int(row[1]) dest_well = row[0] @@ -111,14 +121,14 @@ def run(ctx: ProtocolContext)-> None: p50.configure_for_volume(50) # p50.blow_out() - p50.drop_tip() + p50.drop_tip() # adding Mastermix - ctx.comment('\n\n----------ADDING MASTERMIX----------\n') + ctx.comment("\n\n----------ADDING MASTERMIX----------\n") for i, row in enumerate(csv_lines): p50.pick_up_tip() mmx_vol = row[3] - if mmx_vol.lower() == 'x': + if mmx_vol.lower() == "x": continue if i == 0: @@ -127,7 +137,7 @@ def run(ctx: ProtocolContext)-> None: mmx_tube = row[4] if mmx_tube_check != mmx_tube: - p50.drop_tip() + p50.drop_tip() p50.pick_up_tip() if not p50.has_tip: @@ -148,14 +158,14 @@ def run(ctx: ProtocolContext)-> None: p50.drop_tip() if p50.has_tip: - p50.drop_tip() + p50.drop_tip() # adding DNA - ctx.comment('\n\n----------ADDING DNA----------\n') + ctx.comment("\n\n----------ADDING DNA----------\n") for row in csv_lines: dna_vol = row[2] - if dna_vol.lower() == 'x': + if dna_vol.lower() == "x": continue p50.pick_up_tip() @@ -163,35 +173,37 @@ def run(ctx: ProtocolContext)-> None: dna_vol = int(row[2]) dest_and_source_well = row[0] - if dna_vol == 0: break p50.configure_for_volume(dna_vol) p50.aspirate(dna_vol, source_plate[dest_and_source_well]) p50.dispense(dna_vol, dest_plate[dest_and_source_well], rate=0.5) - p50.mix(10, 0.7*rxn_vol if 0.7*rxn_vol < 30 else 30, dest_plate[dest_and_source_well]) - p50.drop_tip() + p50.mix( + 10, + 0.7 * rxn_vol if 0.7 * rxn_vol < 30 else 30, + dest_plate[dest_and_source_well], + ) + p50.drop_tip() p50.configure_for_volume(50) - ctx.comment('\n\n-----------Running PCR------------\n') + ctx.comment("\n\n-----------Running PCR------------\n") if real_mode: profile1: List[ThermocyclerStep] = [ - {'temperature': 95, 'hold_time_minutes': 2}, + {"temperature": 95, "hold_time_minutes": 2}, ] profile2: List[ThermocyclerStep] = [ - - {'temperature': 98, 'hold_time_seconds': 10}, - {'temperature': 58, 'hold_time_seconds': 10}, - {'temperature': 72, 'hold_time_seconds': 30} - ] - profile3: List[ThermocyclerStep] = [ - {'temperature': 72, 'hold_time_minutes': 5} + {"temperature": 98, "hold_time_seconds": 10}, + {"temperature": 58, "hold_time_seconds": 10}, + {"temperature": 72, "hold_time_seconds": 30}, ] + profile3: List[ThermocyclerStep] = [{"temperature": 72, "hold_time_minutes": 5}] if disposable_lid: - lid_on_plate, unused_lids, used_lids = helpers.use_disposable_lid_with_tc(ctx, unused_lids, used_lids, dest_plate, tc_mod) + lid_on_plate, unused_lids, used_lids = helpers.use_disposable_lid_with_tc( + ctx, unused_lids, used_lids, dest_plate, tc_mod + ) else: tc_mod.close_lid() tc_mod.execute_profile(steps=profile1, repetitions=1, block_max_volume=50) @@ -201,7 +213,7 @@ def run(ctx: ProtocolContext)-> None: tc_mod.open_lid() if disposable_lid: - if len(used_lids) <= 1: - ctx.move_labware(lid_on_plate, "C2", use_gripper = True) + if len(used_lids) <= 1: + ctx.move_labware(lid_on_plate, "C2", use_gripper=True) else: - ctx.move_labware(lid_on_plate, used_lids[-2], use_gripper = True) + ctx.move_labware(lid_on_plate, used_lids[-2], use_gripper=True) diff --git a/abr-testing/abr_testing/protocols/helpers.py b/abr-testing/abr_testing/protocols/helpers.py index 64e44df4685..6393ec9f1f9 100644 --- a/abr-testing/abr_testing/protocols/helpers.py +++ b/abr-testing/abr_testing/protocols/helpers.py @@ -13,7 +13,7 @@ ThermocyclerContext, ) -from typing import List, Union +from typing import List def load_common_liquid_setup_labware_and_instruments( @@ -159,9 +159,11 @@ def load_disposable_lids( unused_lids[-1].load_labware("opentrons_tough_pcr_auto_sealing_lid") ) else: - for i in range(len(deck_slot)-1): + for i in range(len(deck_slot) - 1): unused_lids.append( - protocol.load_labware("opentrons_tough_pcr_auto_sealing_lid", deck_slot[i]) + protocol.load_labware( + "opentrons_tough_pcr_auto_sealing_lid", deck_slot[i] + ) ) unused_lids.reverse() return unused_lids diff --git a/abr-testing/abr_testing/protocols/test_protocols/tc_lid_x_offset_test.py b/abr-testing/abr_testing/protocols/test_protocols/tc_lid_x_offset_test.py index e1707a4113b..63e40519fac 100644 --- a/abr-testing/abr_testing/protocols/test_protocols/tc_lid_x_offset_test.py +++ b/abr-testing/abr_testing/protocols/test_protocols/tc_lid_x_offset_test.py @@ -1,5 +1,4 @@ """Protocol to Test the Stacking and Movement of Tough Auto Seal Lid.""" -from typing import List, Union from opentrons.protocol_api import ( ParameterContext, ProtocolContext, @@ -11,7 +10,7 @@ from abr_testing.protocols import helpers -metadata = {"protocolName": "Flat and Stacked Offset TC Lid Testing"} +metadata = {"protocolName": "5 Stack Test"} requirements = {"robotType": "Flex", "apiLevel": "2.20"} @@ -20,47 +19,56 @@ def add_parameters(parameters: ParameterContext) -> None: parameters.add_int( variable_name="lids_in_a_stack", display_name="Num of Lids in Stack", - minimum = 1, - maximum = 5, - default = 1 + minimum=1, + maximum=5, + default=5, ) parameters.add_float( - variable_name = "x_offset", - display_name= "X Offset", + variable_name="x_offset", + display_name="X Offset", choices=[ - {"display_name": "-1.4", "value": -1.4}, - {"display_name": "-1.3", "value": -1.3}, - {"display_name": "-1.2", "value": -1.2}, - {"display_name": "-1.1", "value": -1.1}, - {"display_name": "-1", "value": -1}, - {"display_name": "-0.9", "value": -0.9}, - {"display_name": "-0.8", "value": -0.8}, - {"display_name": "-0.7", "value": -0.7}, - {"display_name": "-0.6", "value": -0.6}, - {"display_name": "-0.5", "value": -0.5}, - {"display_name": "-0.4", "value": -0.4}, - {"display_name": "-0.3", "value": -0.3}, - {"display_name": "-0.2", "value": -0.2}, - {"display_name": "-0.1", "value": -0.1}, {"display_name": "0.0", "value": 0.0}, - {"display_name": "-0.1", "value": 0.1}, - {"display_name": "-0.1", "value": 0.2}, - {"display_name": "-0.1", "value": 0.3}, - {"display_name": "-0.1", "value": 0.4}, - {"display_name": "-0.1", "value": 0.5}, + {"display_name": "0.1", "value": 0.1}, + {"display_name": "0.2", "value": 0.2}, + {"display_name": "0.3", "value": 0.3}, + {"display_name": "0.4", "value": 0.4}, + {"display_name": "0.5", "value": 0.5}, + {"display_name": "0.6", "value": 0.6}, + {"display_name": "0.7", "value": 0.7}, + {"display_name": "0.8", "value": 0.8}, + {"display_name": "0.9", "value": 0.9}, + {"display_name": "1.0", "value": 1.0}, + {"display_name": "1.1", "value": 1.1}, + {"display_name": "1.2", "value": 1.2}, + {"display_name": "1.3", "value": 1.3}, + {"display_name": "1.4", "value": 1.4}, {"display_name": "1.5", "value": 1.5}, {"display_name": "1.6", "value": 1.6}, {"display_name": "1.7", "value": 1.7}, {"display_name": "1.8", "value": 1.8}, + {"display_name": "1.9", "value": 1.9}, + {"display_name": "2", "value": 2}, + + ], - default = 0.0 + default=2, ) + parameters.add_bool( + variable_name = "negative", + display_name = "Negative", + description = "Turn on to make offset negative.", + default = False + ) + def run(protocol: ProtocolContext) -> None: """Runs protocol that moves lids and stacks them.""" # Load Parameters lids_in_stack = protocol.params.lids_in_a_stack # type: ignore[attr-defined] - x_offset = protocol.params.x_offset # type: ignore[attr-defined] + x_offset = protocol.params.x_offset # type: ignore[attr-defined] + negative = protocol.params.negative # type: ignore[attr-defined] + if negative: + x_offset = x_offset * -1 # Thermocycler thermocycler: ThermocyclerContext = protocol.load_module( "thermocyclerModuleV2" @@ -70,28 +78,23 @@ def run(protocol: ProtocolContext) -> None: ) thermocycler.open_lid() # Load Lids - if lids_in_stack == 1: - slot_locations = ["D2", "C2", "B2", "C3", "B3"] - else: - slot_locations = ["D2"] - lids = helpers.load_disposable_lids(protocol, lids_in_stack, slot_locations) + lid_stack_1 = helpers.load_disposable_lids(protocol, lids_in_stack, ["D2"]) + lid_stack_2 = helpers.load_disposable_lids(protocol, lids_in_stack, ["C2"]) + lid_stack_3 = helpers.load_disposable_lids(protocol, lids_in_stack, ["B2"]) + lid_stack_4 = helpers.load_disposable_lids(protocol, lids_in_stack, ["C3"]) + lid_stack_5 = helpers.load_disposable_lids(protocol, lids_in_stack, ["B3"]) + drop_offset = {"x": x_offset, "y": 0, "z": 0} slot = 0 - for lid in lids: - protocol.comment( - f"Offset {x_offset}, Lid # {slot+1}" - ) + lids = [lid_stack_1, lid_stack_2, lid_stack_3, lid_stack_4, lid_stack_5] + for lid_list in lids: + lid_to_move = lid_list[0] + + lid_to_move_back_to = lid_list[1] + protocol.comment(f"Offset {x_offset}, Lid # {slot+1}") # move lid to plate in thermocycler protocol.move_labware( - lid, plate_in_cycler, use_gripper=True, drop_offset=drop_offset + lid_to_move, plate_in_cycler, use_gripper=True, drop_offset=drop_offset ) - - if slot == 0: - move_location = "C1" - else: - move_location = prev_moved_lid - - protocol.move_labware(lid, move_location, use_gripper=True) - slot +=1 - prev_moved_lid = lid - + protocol.move_labware(lid_to_move, lid_to_move_back_to, use_gripper=True) +