Week 3 HW: Lab Automation
Assignment: Python Script for Opentrons Artwork — DUE BY YOUR LAB TIME!
A Blooming Daisy Flower PINK, PURPLE & BLUE DESIGN! :) INITIAL DESIGN: Python documentation
from opentrons import types metadata = { 'author': 'Tammy Sisodiya', 'protocolName': ' HTGAA Dazzling Daisy', 'description': 'A blooming Daisy flower in Purple, Pink, and Blue.', 'source': 'HTGAA 2026 Opentrons Lab', 'apiLevel': '2.20' } ############################################################################## ### Robot deck setup constants ############################################################################## TIP_RACK_DECK_SLOT = 9 COLORS_DECK_SLOT = 6 AGAR_DECK_SLOT = 5 PIPETTE_STARTING_TIP_WELL = 'A1' # UPDATED: Mapping the new lab colors to source wells well_colors = { 'A1' : 'Purple', 'B1' : 'Pink', 'C1' : 'Blue' } def run(protocol): # Tips tips_20ul = protocol.load_labware('opentrons_96_tiprack_20ul', TIP_RACK_DECK_SLOT, 'Opentrons 20uL Tips') # Pipettes pipette_20ul = protocol.load_instrument("p20_single_gen2", "right", [tips_20ul]) # Modules temperature_module = protocol.load_module('temperature module gen2', COLORS_DECK_SLOT) temperature_plate = temperature_module.load_labware('opentrons_96_aluminumblock_generic_pcr_strip_200ul', 'Cold Plate') color_plate = temperature_plate # Agar Plate agar_plate = protocol.load_labware('htgaa_agar_plate', AGAR_DECK_SLOT, 'Agar Plate') center_location = agar_plate['A1'].top() pipette_20ul.starting_tip = tips_20ul.well(PIPETTE_STARTING_TIP_WELL) # Helper Functions def location_of_color(color_string): for well,color in well_colors.items(): if color.lower() == color_string.lower(): return color_plate[well] raise ValueError(f"No well found with color {color_string}") def dispense_and_detach(pipette, volume, location): assert(isinstance(volume, (int, float))) above_location = location.move(types.Point(z=location.point.z + 5)) pipette.move_to(above_location) pipette.dispense(volume, location) pipette.move_to(above_location) ### YOUR DESIGN DATA ### sfgfp_points = [(-4.4, 26.4),(1.1, 26.4),(2.2, 26.4),(3.3, 26.4),(4.4, 26.4),(-6.6, 25.3),(-5.5, 25.3),(-4.4, 25.3),(-3.3, 25.3),(1.1, 25.3),(4.4, 25.3),(-12.1, 24.2),(-11, 24.2),(-9.9, 24.2),(-8.8, 24.2),(-7.7, 24.2),(-6.6, 24.2),(-2.2, 24.2),(0, 24.2),(4.4, 24.2),(-13.2, 23.1),(-12.1, 23.1),(-7.7, 23.1),(-6.6, 23.1),(-2.2, 23.1),(4.4, 23.1),(6.6, 23.1),(7.7, 23.1),(8.8, 23.1),(-13.2, 22),(-7.7, 22),(-6.6, 22),(-2.2, 22),(0, 22),(4.4, 22),(5.5, 22),(6.6, 22),(8.8, 22),(-13.2, 20.9),(-7.7, 20.9),(-2.2, 20.9),(3.3, 20.9),(4.4, 20.9),(9.9, 20.9),(-13.2, 19.8),(-7.7, 19.8),(-2.2, 19.8),(3.3, 19.8),(9.9, 19.8),(-13.2, 18.7),(-2.2, 18.7),(8.8, 18.7),(9.9, 18.7),(-13.2, 17.6),(-2.2, 17.6),(-1.1, 17.6),(8.8, 17.6),(-18.7, 16.5),(-17.6, 16.5),(-16.5, 16.5),(-15.4, 16.5),(-14.3, 16.5),(-12.1, 16.5),(-2.2, 16.5),(7.7, 16.5),(8.8, 16.5),(-20.9, 15.4),(-19.8, 15.4),(-18.7, 15.4),(-14.3, 15.4),(-13.2, 15.4),(-12.1, 15.4),(-2.2, 15.4),(-1.1, 15.4),(7.7, 15.4),(-20.9, 14.3),(-13.2, 14.3),(-12.1, 14.3),(-11, 14.3),(-3.3, 14.3),(-2.2, 14.3),(5.5, 14.3),(6.6, 14.3),(-20.9, 13.2),(-9.9, 13.2),(-8.8, 13.2),(-3.3, 13.2),(4.4, 13.2),(5.5, 13.2),(-20.9, 12.1),(-8.8, 12.1),(-7.7, 12.1),(-3.3, 12.1),(-2.2, 12.1),(2.2, 12.1),(3.3, 12.1),(5.5, 12.1),(6.6, 12.1),(7.7, 12.1),(8.8, 12.1),(9.9, 12.1),(11, 12.1),(-20.9, 11),(-19.8, 11),(-6.6, 11),(-5.5, 11),(-4.4, 11),(0, 11),(1.1, 11),(2.2, 11),(3.3, 11),(4.4, 11),(11, 11),(-19.8, 9.9),(-4.4, 9.9),(-3.3, 9.9),(-2.2, 9.9),(-1.1, 9.9),(0, 9.9),(11, 9.9),(-23.1, 8.8),(-22, 8.8),(-20.9, 8.8),(-19.8, 8.8),(-18.7, 8.8),(-17.6, 8.8),(-5.5, 8.8),(-4.4, 8.8),(-3.3, 8.8),(-2.2, 8.8),(-1.1, 8.8),(0, 8.8),(9.9, 8.8),(11, 8.8),(15.4, 8.8),(16.5, 8.8),(17.6, 8.8),(18.7, 8.8),(19.8, 8.8),(20.9, 8.8),(22, 8.8),(23.1, 8.8),(24.2, 8.8),(-23.1, 7.7),(-3.3, 7.7),(-1.1, 7.7),(0, 7.7),(1.1, 7.7),(2.2, 7.7),(8.8, 7.7),(9.9, 7.7),(14.3, 7.7),(15.4, 7.7),(16.5, 7.7),(20.9, 7.7),(22, 7.7),(24.2, 7.7),(-24.2, 6.6),(-23.1, 6.6),(-5.5, 6.6),(-4.4, 6.6),(-3.3, 6.6),(-2.2, 6.6),(1.1, 6.6),(2.2, 6.6),(7.7, 6.6),(8.8, 6.6),(9.9, 6.6),(11, 6.6),(12.1, 6.6),(13.2, 6.6),(14.3, 6.6),(16.5, 6.6),(19.8, 6.6),(20.9, 6.6),(23.1, 6.6),(-22, 5.5),(-9.9, 5.5),(-7.7, 5.5),(-6.6, 5.5),(-5.5, 5.5),(-4.4, 5.5),(-2.2, 5.5),(3.3, 5.5),(4.4, 5.5),(13.2, 5.5),(16.5, 5.5),(18.7, 5.5),(19.8, 5.5),(23.1, 5.5),(-20.9, 4.4),(-19.8, 4.4),(-18.7, 4.4),(-17.6, 4.4),(-16.5, 4.4),(-15.4, 4.4),(-14.3, 4.4),(-13.2, 4.4),(-12.1, 4.4),(-9.9, 4.4),(-8.8, 4.4),(-7.7, 4.4),(-2.2, 4.4),(4.4, 4.4),(5.5, 4.4),(6.6, 4.4),(13.2, 4.4),(16.5, 4.4),(17.6, 4.4),(18.7, 4.4),(23.1, 4.4),(-12.1, 3.3),(-11, 3.3),(-2.2, 3.3),(5.5, 3.3),(7.7, 3.3),(8.8, 3.3),(9.9, 3.3),(11, 3.3),(12.1, 3.3),(13.2, 3.3),(16.5, 3.3),(17.6, 3.3),(23.1, 3.3),(-13.2, 2.2),(-12.1, 2.2),(-2.2, 2.2),(6.6, 2.2),(9.9, 2.2),(16.5, 2.2),(17.6, 2.2),(18.7, 2.2),(19.8, 2.2),(20.9, 2.2),(22, 2.2),(-14.3, 1.1),(-2.2, 1.1),(7.7, 1.1),(9.9, 1.1),(11, 1.1),(15.4, 1.1),(16.5, 1.1),(22, 1.1),(-15.4, 0),(-14.3, 0),(-2.2, 0),(7.7, 0),(11, 0),(14.3, 0),(15.4, 0),(22, 0),(-15.4, -1.1),(-2.2, -1.1),(3.3, -1.1),(8.8, -1.1),(13.2, -1.1),(14.3, -1.1),(20.9, -1.1),(-15.4, -2.2),(-14.3, -2.2),(-13.2, -2.2),(-12.1, -2.2),(-8.8, -2.2),(-7.7, -2.2),(-6.6, -2.2),(-2.2, -2.2),(3.3, -2.2),(8.8, -2.2),(11, -2.2),(12.1, -2.2),(13.2, -2.2),(20.9, -2.2),(-14.3, -3.3),(-11, -3.3),(-8.8, -3.3),(-7.7, -3.3),(-6.6, -3.3),(-3.3, -3.3),(-2.2, -3.3),(3.3, -3.3),(4.4, -3.3),(8.8, -3.3),(11, -3.3),(19.8, -3.3),(20.9, -3.3),(-13.2, -4.4),(-12.1, -4.4),(-11, -4.4),(-8.8, -4.4),(-3.3, -4.4),(-2.2, -4.4),(4.4, -4.4),(5.5, -4.4),(6.6, -4.4),(7.7, -4.4),(8.8, -4.4),(13.2, -4.4),(19.8, -4.4),(-16.5, -5.5),(-15.4, -5.5),(-14.3, -5.5),(-13.2, -5.5),(-8.8, -5.5),(-4.4, -5.5),(-3.3, -5.5),(-2.2, -5.5),(4.4, -5.5),(14.3, -5.5),(15.4, -5.5),(16.5, -5.5),(18.7, -5.5),(19.8, -5.5),(-19.8, -6.6),(-18.7, -6.6),(-17.6, -6.6),(-16.5, -6.6),(-8.8, -6.6),(-4.4, -6.6),(-1.1, -6.6),(3.3, -6.6),(4.4, -6.6),(17.6, -6.6),(18.7, -6.6),(-23.1, -7.7),(-22, -7.7),(-20.9, -7.7),(-19.8, -7.7),(-17.6, -7.7),(-16.5, -7.7),(-15.4, -7.7),(-8.8, -7.7),(-7.7, -7.7),(-6.6, -7.7),(-5.5, -7.7),(-4.4, -7.7),(-3.3, -7.7),(-2.2, -7.7),(-1.1, -7.7),(0, -7.7),(2.2, -7.7),(3.3, -7.7),(16.5, -7.7),(17.6, -7.7),(-24.2, -8.8),(-23.1, -8.8),(-14.3, -8.8),(-13.2, -8.8),(-8.8, -8.8),(-7.7, -8.8),(-3.3, -8.8),(-2.2, -8.8),(0, -8.8),(1.1, -8.8),(2.2, -8.8),(3.3, -8.8),(5.5, -8.8),(14.3, -8.8),(15.4, -8.8),(16.5, -8.8),(-26.4, -9.9),(-25.3, -9.9),(-24.2, -9.9),(-12.1, -9.9),(-11, -9.9),(-9.9, -9.9),(-8.8, -9.9),(-3.3, -9.9),(0, -9.9),(7.7, -9.9),(8.8, -9.9),(11, -9.9),(12.1, -9.9),(13.2, -9.9),(-27.5, -11),(-26.4, -11),(-25.3, -11),(-24.2, -11),(-23.1, -11),(-22, -11),(-20.9, -11),(-19.8, -11),(-18.7, -11),(-17.6, -11),(-16.5, -11),(-15.4, -11),(-14.3, -11),(-13.2, -11),(-12.1, -11),(-11, -11),(-3.3, -11),(0, -11),(-28.6, -12.1),(-27.5, -12.1),(-19.8, -12.1),(-18.7, -12.1),(-17.6, -12.1),(-15.4, -12.1),(-12.1, -12.1),(-4.4, -12.1),(-3.3, -12.1),(-2.2, -12.1),(0, -12.1),(-28.6, -13.2),(-27.5, -13.2),(-20.9, -13.2),(-19.8, -13.2),(-12.1, -13.2),(-4.4, -13.2),(0, -13.2),(-26.4, -14.3),(-25.3, -14.3),(-13.2, -14.3),(-12.1, -14.3),(-5.5, -14.3),(-2.2, -14.3),(0, -14.3),(-23.1, -15.4),(-20.9, -15.4),(-19.8, -15.4),(-13.2, -15.4),(-8.8, -15.4),(-7.7, -15.4),(-6.6, -15.4),(-1.1, -15.4),(0, -15.4),(-18.7, -16.5),(-16.5, -16.5),(-15.4, -16.5),(-14.3, -16.5),(-13.2, -16.5),(-12.1, -16.5),(-9.9, -16.5),(-8.8, -16.5),(-2.2, -16.5),(0, -16.5),(-2.2, -17.6),(0, -17.6),(0, -18.7),(-1.1, -19.8),(1.1, -19.8),(-1.1, -20.9),(1.1, -20.9),(2.2, -20.9),(0, -22),(3.3, -22),(12.1, -22),(13.2, -22),(14.3, -22),(15.4, -22),(0, -23.1),(4.4, -23.1),(5.5, -23.1),(9.9, -23.1),(11, -23.1),(12.1, -23.1),(13.2, -23.1),(1.1, -24.2),(2.2, -24.2),(5.5, -24.2),(6.6, -24.2),(7.7, -24.2),(8.8, -24.2),(9.9, -24.2),(11, -24.2),(12.1, -24.2),(2.2, -25.3),(3.3, -25.3),(4.4, -25.3),(9.9, -25.3),(11, -25.3),(5.5, -26.4),(6.6, -26.4),(7.7, -26.4),(8.8, -26.4)] mrfp1_points = [(-15.4, 12.1),(-14.3, 12.1),(-14.3, 11),(-13.2, 11),(-12.1, 11)] mscarlet_i_points = [(-11, 20.9),(-9.9, 20.9),(-11, 19.8),(-9.9, 19.8),(-9.9, 18.7)] mko2_points = [(3.3, 18.7),(4.4, 18.7),(5.5, 18.7),(6.6, 18.7),(4.4, 17.6)] mjuniper_points = [(6.6, 9.9),(7.7, 9.9),(4.4, 8.8),(5.5, 8.8),(6.6, 8.8),(7.7, 8.8),(-6.6, 2.2),(-9.9, 1.1),(-8.8, 1.1),(-7.7, 1.1),(-6.6, 1.1)] electra2_points = [(1.1, 4.4),(1.1, 3.3),(1.1, 2.2),(1.1, 1.1)] # 2. UPDATED Design Mapping # Purple for the large petals, Pink for highlights, Blue for details. layers = [ ('Purple', sfgfp_points), ('Pink', mrfp1_points), ('Pink', mscarlet_i_points), ('Pink', mko2_points), ('Blue', mjuniper_points), ('Blue', electra2_points) ] # 3. Execution Loop drop_vol = 1.0 for color_name, points in layers: if not points: continue source_well = location_of_color(color_name) for i in range(0, len(points), 15): chunk = points[i:i + 15] pipette_20ul.pick_up_tip() aspirate_vol = (len(chunk) * drop_vol) + 2.0 if aspirate_vol > 20.0: aspirate_vol = 20.0 pipette_20ul.aspirate(aspirate_vol, source_well) for x, y in chunk: if (x2 + y2) < 1600: target_point = center_location.point + types.Point(x=x, y=y, z=0) target_loc = types.Location(target_point, None) dispense_and_detach(pipette_20ul, drop_vol, target_loc) # Return residual to source well top to avoid contamination if pipette_20ul.current_volume > 0: pipette_20ul.dispense(pipette_20ul.current_volume, source_well.top()) pipette_20ul.drop_tip() Post-Lab Questions — DUE BY START OF FEB 24 LECTURE