Skip to content

Commit

Permalink
lint and formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rclarke0 committed Oct 30, 2024
1 parent 04c266f commit f5f28b6
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion abr-testing/abr_testing/protocols/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""protocols."""
"""protocols."""
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
154 changes: 83 additions & 71 deletions abr-testing/abr_testing/protocols/api 2.20/bms_pcr_protocol_220api.py
Original file line number Diff line number Diff line change
@@ -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 <[email protected]',
}
requirements = {
'robotType': 'OT-3',
'apiLevel': '2.20'
"protocolName": "PCR Protocol with TC Auto Sealing Lid",
"author": "Rami Farawi <[email protected]",
}
requirements = {"robotType": "OT-3", "apiLevel": "2.20"}


def add_parameters(parameters: ParameterContext):
def add_parameters(parameters: ParameterContext) -> 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]
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -148,50 +158,52 @@ 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()

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)
Expand All @@ -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)
8 changes: 5 additions & 3 deletions abr-testing/abr_testing/protocols/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ThermocyclerContext,
)

from typing import List, Union
from typing import List


def load_common_liquid_setup_labware_and_instruments(
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit f5f28b6

Please sign in to comment.