def run_custom_protocol( volumes_csv: FileInput = example_csv, pipette_axis: StringSelection('B (left side)', 'A (right side)') = 'B (left side)', pipette_model: StringSelection('p200', 'p100', 'p50', 'p20', 'p10', 'p1000') = 'p200', source_plate_type: StringSelection('96-flat', '384-plate') = '96-flat', destination_plate_type: StringSelection('96-flat', '384-plate') = '96-flat', tip_reuse: StringSelection('new tip each time', 'reuse tip') = 'new tip each time'): pipette_max_vol = int(pipette_model[1:]) pipette = instruments.Pipette(axis='b' if pipette_axis[0] == 'B' else 'a', max_volume=pipette_max_vol, min_volume=pipette_max_vol / 10, tip_racks=tipracks, trash_container=trash) data = [[well, float(vol)] for well, vol in [row.split(',') for row in volumes_csv.strip().split('\n') if row]] source_plate = containers.load(source_plate_type, 'B1') dest_plate = containers.load(destination_plate_type, 'C1') tip_strategy = 'always' if tip_reuse == 'new tip each time' else 'once' for well_idx, (source_well, vol) in enumerate(data): pipette.transfer(vol, source_plate.wells(source_well), dest_plate(well_idx), new_tip=tip_strategy)
def run_custom_protocol( volumes_csv: FileInput = example_csv, pipette_axis: StringSelection('B (left side)', 'A (right side)') = 'B (left side)', pipette_model: StringSelection('p200', 'p100', 'p50', 'p20', 'p10', 'p1000') = 'p200', plate_type: StringSelection('96-flat', '384-plate') = '96-flat', tip_reuse: StringSelection('new tip each time', 'reuse tip') = 'new tip each time'): pipette_max_vol = int(pipette_model[1:]) pipette = instruments.Pipette(axis='b' if pipette_axis[0] == 'B' else 'a', max_volume=pipette_max_vol, min_volume=pipette_max_vol / 10, tip_racks=tipracks, trash_container=trash) plate = containers.load(plate_type, 'A1') volumes = [float(cell) for cell in well_csv_to_list(volumes_csv)] for vol in volumes: if 0 < vol < pipette.min_volume: robot.comment( 'WARNING: volume {} is below pipette\'s minimum volume.'. format(vol)) tip_strategy = 'always' if tip_reuse == 'new tip each time' else 'once' pipette.transfer(volumes, source, plate, new_tip=tip_strategy)
def run_custom_protocol( volumes_csv: FileInput = example_csv, pipette_axis: StringSelection('B (left side)', 'A (right side)') = 'B (left side)', pipette_model: StringSelection('p1000', 'p300', 'p50', 'p10') = 'p300', source_plate_type: StringSelection('96-flat', '384-plate') = '96-flat', destination_plate_type: StringSelection('96-flat', '384-plate') = '96-flat', tip_reuse: StringSelection('new tip each time', 'reuse tip') = 'new tip each time'): pipette_max_vol = int(pipette_model[1:]) mount = 'right' if pipette_axis[0] == 'B': mount = 'left' tiprack_slots = ['1', '4', '7', '10'] if pipette_max_vol == 300: tipracks = [ labware.load('tiprack-200ul', slot) for slot in tiprack_slots ] pipette = instruments.P300_Single(mount=mount, tip_racks=tipracks) elif pipette_max_vol == 50: tipracks = [ labware.load('tiprack-200ul', slot) for slot in tiprack_slots ] pipette = instruments.P50_Single(mount=mount, tip_racks=tipracks) elif pipette_max_vol == 10: tipracks = [ labware.load('tiprack-200ul', slot) for slot in tiprack_slots ] pipette = instruments.P10_Single(mount=mount, tip_racks=tipracks) elif pipette_max_vol == 1000: tipracks = [ labware.load('tiprack-200ul', slot) for slot in tiprack_slots ] pipette = instruments.P1000_Single(mount=mount, tip_racks=tipracks) data = [ [well, vol] for well, vol in [row.split(',') for row in volumes_csv.strip().splitlines() if row] ] source_plate = labware.load(source_plate_type, '2') dest_plate = labware.load(destination_plate_type, '3') tip_strategy = 'always' if tip_reuse == 'new tip each time' else 'once' for well_idx, (source_well, vol) in enumerate(data): if source_well and vol: vol = float(vol) pipette.transfer(vol, source_plate.wells(source_well), dest_plate.wells(well_idx), new_tip=tip_strategy)
def run_custom_protocol( transfer_volume: float=20, robot_model: StringSelection('hood', 'not hood')='not hood', source_container: StringSelection(*container_choices)='96-flat', destination_container: StringSelection(*container_choices)='96-flat', number_of_destination_plates: int=4): # Load containers all_dest_plates = [ containers.load(destination_container, slotName) for slotName in dest_slots] source_plate = containers.load(source_container, 'C2') if (robot_model == 'hood' and number_of_destination_plates > max_plates_for_hood): raise Exception(( 'OT Hood model can only accomodate {} plates for ' + 'this protocol, you entered {}').format( max_plates_for_hood, number_of_destination_plates)) if ('384-plate' in [source_container, destination_container] and source_container != destination_container): raise Exception( 'This protocol currently only allows 96:96 or 384:384 transfers.' + ' You entered "{}" and "{}"'.format( source_container, destination_container)) row_count = len(all_dest_plates[0].rows()) dest_plates = all_dest_plates[:number_of_destination_plates] # fill row 1 for all plates, then row 2 for all plates, etc for row_index in range(row_count): if destination_container == '384-plate': # Use "alternating wells" trick for 8-channel in 384 plate dest_wells = [ row for plate in dest_plates for row in alternating_wells(plate, row_index)] source_wells = alternating_wells(source_plate, row_index) else: dest_wells = [plate.rows(row_index) for plate in dest_plates] source_wells = source_plate.rows(row_index) p50multi.distribute( transfer_volume, source_wells, dest_wells, touch_tip=True, disposal_vol=0 )
def run_custom_protocol( pipette_axis: StringSelection( 'left', 'right')='left', pipette_model: StringSelection( 'p10', 'p50', 'p300', 'p1000')='p300', consolidate_volume: float=20.0, source_container: StringSelection( '96-flat', 'tube-rack-2ml')='96-flat', number_of_source_wells: int=4, destination_container: StringSelection( '96-flat', 'tube-rack-2ml')='96-flat', destination_well: str='A1', tip_reuse_strategy: StringSelection( 'reuse one tip', 'new tip each time')='reuse one tip'): pipette_max_vol = int(pipette_model[1:]) new_tip = 'always' if tip_reuse_strategy == 'new tip each time' else 'once' tip_rack = labware.load(tiprack_from_pipette(pipette_max_vol), '1') source = labware.load(source_container, '2') dest = labware.load(destination_container, '3') try: dest_well = dest.wells(destination_well) except ValueError: raise RuntimeError( 'Invalid destination well "{}". Expected well name like A1, H11, ' .format(destination_well) + 'etc. The destination plate may not ' + 'have a well of that name (eg a 96-well plate has no well "T18")') if pipette_model == 'p10': pipette = instruments.P10_Single( mount=pipette_axis, tip_racks=[tip_rack]) elif pipette_model == 'p50': pipette = instruments.P50_Single( mount=pipette_axis, tip_racks=[tip_rack]) elif pipette_model == 'p300': pipette = instruments.P300_Single( mount=pipette_axis, tip_racks=[tip_rack]) else: pipette = instruments.P1000_Single( mount=pipette_axis, tip_racks=[tip_rack]) pipette.consolidate( consolidate_volume, source[:number_of_source_wells], dest_well, new_tip=new_tip)
def run_custom_protocol(pipette_type: StringSelection( 'p300-Single', 'p50-Single', 'p10-Single')='p300-Single', dye_labware_type: StringSelection( 'trough-12row', 'tube-rack-2ml')='trough-12row'): if pipette_type == 'p300-Single': tiprack = containers.load('tiprack-200ul', 'A1') pipette = instruments.Pipette( axis='a', max_volume=300, tip_racks=[tiprack]) elif pipette_type == 'p50-Single': tiprack = containers.load('tiprack-200ul', 'A1') pipette = instruments.Pipette( axis='a', max_volume=50, tip_racks=[tiprack]) elif pipette_type == 'p10-Single': tiprack = containers.load('tiprack-10ul', 'A1') pipette = instruments.Pipette( axis='a', max_volume=10, tip_racks=[tiprack]) if dye_labware_type == 'trough-12row': dye_container = containers.load('trough-12row', 'B2') else: dye_container = containers.load('tube-rack-2ml', 'B2') output = containers.load('96-flat', 'D1') # Well Location set-up dye1_wells = ['A5', 'A6', 'A8', 'A9', 'B4', 'B10', 'C3', 'C11', 'D3', 'D11', 'E3', 'E11', 'F3', 'F11', 'G4', 'G10', 'H5', 'H6', 'H7', 'H8', 'H9'] dye2_wells = ['C7', 'D6', 'D7', 'D8', 'E5', 'E6', 'E7', 'E8', 'E9', 'F5', 'F6', 'F7', 'F8', 'F9', 'G6', 'G7', 'G8'] dye2 = dye_container.wells('A1') dye1 = dye_container.wells('A2') pipette.distribute( 50, dye1, output.wells(dye1_wells), new_tip='once') pipette.distribute( 50, dye2, output.wells(dye2_wells), new_tip='once')
def run_custom_protocol( left_pipette: StringSelection('p10-single', 'P50-single', 'p300-single', 'p1000-single') = 'p50-single', right_pipette: StringSelection('p10-single', 'P50-single', 'p300-single', 'p1000-single') = 'p300-single', master_mix_csv: FileInput = mastermix_csv_example): def mount_pipette(pipette_type, mount, tiprack_slot): if pipette_type == 'p10-single': tip_rack = labware.load('tiprack-10ul', tiprack_slot) pipette = instruments.P10_Single(mount=mount, tip_racks=[tip_rack]) elif pipette_type == 'p50-single': tip_rack = labware.load('opentrons-tiprack-300ul', tiprack_slot) pipette = instruments.P50_Single(mount=mount, tip_racks=[tip_rack]) elif pipette_type == 'p300-single': tip_rack = labware.load('opentrons-tiprack-300ul', tiprack_slot) pipette = instruments.P300_Single(mount=mount, tip_racks=[tip_rack]) else: tip_rack = labware.load('tiprack-1000ul', tiprack_slot) pipette = instruments.P1000_Single(mount=mount, tip_racks=[tip_rack]) return pipette # labware setup labware.load('opentrons-tuberack-2ml-eppendorf', '1') labware.load('opentrons-tuberack-2ml-screwcap', '2') trough = labware.load('trough-12row', '3') # instrument setup pipette_l = mount_pipette(left_pipette, 'left', '5') pipette_r = mount_pipette(right_pipette, 'right', '6') # destination mastermix_dest = trough.wells('A1') info_list = [ cell for line in master_mix_csv.splitlines() if line for cell in [line.split(',')] ] for line in info_list[1:]: source = robot.deck.children_by_name[line[1]][0].wells(line[2]) vol = float(line[3]) if vol < pipette_r.min_volume and vol > pipette_l.min_volume: pipette = pipette_l else: pipette = pipette_r pipette.transfer(vol, source, mastermix_dest)
def run_custom_protocol( transfer_volume: float = 20, robot_model: StringSelection('hood', 'not hood') = 'not hood', source_container: StringSelection(*container_choices) = '96-flat', destination_container: StringSelection(*container_choices) = '96-flat', number_of_destination_plates: int = 4): # Load labware all_dest_plates = [ labware.load(destination_container, slotName) for slotName in dest_slots ] source_plate = labware.load(source_container, source_slot) if ('384-plate' in [source_container, destination_container] and source_container != destination_container): raise Exception( 'This protocol currently only allows 96:96 or 384:384 transfers.' + ' You entered "{}" and "{}"'.format(source_container, destination_container)) col_count = len(all_dest_plates[0].cols()) dest_plates = all_dest_plates[:number_of_destination_plates] for col_index in range(col_count): if destination_container == '384-plate': dest_wells = [[ plate.cols(col_index).wells(well_index) for plate in dest_plates ] for well_index in range(2)] source_wells = [ source_plate.cols(col_index).wells(well_index) for well_index in range(2) ] for source, dest in zip(source_wells, dest_wells): p50multi.distribute(transfer_volume, source, dest, disposal_vol=0) else: dest_wells = [plate.cols(col_index) for plate in dest_plates] source_well = source_plate.cols(col_index) p50multi.distribute(transfer_volume, source_well, dest_wells, disposal_vol=0)
def run_custom_protocol( well_volume: float = 1.0, pipette_type: StringSelection('p300-Single', 'p50-Single', 'p10-Single', 'p300-Multi', 'p50-Multi', 'p10-Multi') = 'p300-Single'): pip_name = pipette_type.split('-') # Check which pipette type if pipette_type == 'p300-Single': pipette = instruments.P300_Single(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p50-Single': pipette = instruments.P50_Single(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p10-Single': pipette = instruments.P10_Single(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p300-Multi': pipette = instruments.P300_Multi(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p50-Multi': pipette = instruments.P50_Multi(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p10-Multi': pipette = instruments.P10_Multi(mount='left', tip_racks=[tiprack]) alternating_wells = [] for column in plate.cols(): if pip_name[1] == 'Multi': alternating_wells.append(column.wells('A')) alternating_wells.append(column.wells('B')) else: alternating_wells.append(column.wells('A', length=8, step=2)) alternating_wells.append(column.wells('B', length=8, step=2)) pipette.distribute(well_volume, trough.wells('A1'), alternating_wells)
def run_custom_protocol(well_volume: float=1.0, pipette_type: StringSelection( 'p300-Single', 'p50-Single', 'p10-Single', 'p300-Multi', 'p50-Multi', 'p10-Multi')='p50-Multi'): pip_name = pipette_type.split('-') # Check which pipette type chan = 1 # Number of channels if pip_name[1] == 'Multi': chan = 8 vol = int(pip_name[0][1::]) pipette = instruments.Pipette( axis='b', max_volume=vol, tip_racks=[tiprack], channels=chan, trash_container=trash) alternating_wells = [] for row in plate.rows(): if pip_name[1] == 'Multi': alternating_wells.append(row.wells('A')) alternating_wells.append(row.wells('B')) else: alternating_wells.append(row.wells('A', length=8, step=2)) alternating_wells.append(row.wells('B', length=8, step=2)) pipette.distribute( well_volume, trough.wells('A1'), alternating_wells, mix_before=(5, pipette.max_volume))
def run_custom_protocol( pipette_axis: StringSelection('B (left side)', 'A (right side)') = 'B (left side)', pipette_model: StringSelection('p200', 'p100', 'p50', 'p20', 'p10', 'p1000') = 'p200', consolidate_volume: float = 20.0, source_container: StringSelection('96-flat', 'tube-rack-2ml') = '96-flat', number_of_source_wells: int = 4, destination_container: StringSelection('96-flat', 'tube-rack-2ml') = '96-flat', destination_well: str = 'A1', tip_reuse_strategy: StringSelection( 'reuse one tip', 'new tip each time') = 'reuse one tip'): pipette_max_vol = int(pipette_model[1:]) new_tip = 'always' if tip_reuse_strategy == 'new tip each time' else 'once' tip_rack = containers.load(tiprack_from_pipette(pipette_max_vol), 'A1') source = containers.load(source_container, 'D1') dest = containers.load(destination_container, 'B1') try: dest_well = dest.wells(destination_well) except ValueError: raise RuntimeError( 'Invalid destination well "{}". Expected well name like A1, H11, '. format(destination_well) + 'etc. The destination plate may not ' + 'have a well of that name (eg a 96-well plate has no well "T18")') pipette = instruments.Pipette(axis=pipette_axis[0].lower(), max_volume=pipette_max_vol, min_volume=pipette_max_vol / 10, tip_racks=[tip_rack], trash_container=trash) pipette.consolidate(consolidate_volume, source[:number_of_source_wells], dest_well, new_tip=new_tip)
def run_custom_protocol( pipette_axis: StringSelection( 'left', 'right')='left'): p300 = instruments.P300_Single( mount=pipette_axis, tip_racks=[p200rack] ) # macro commands like .distribute() make writing long sequences easier: # distribute green solution to the body p300.distribute(50, green, green_wells, disposal_vol=0, blow_out=True) # distribute blue solution to the dinosaur's back p300.distribute(50, blue, blue_wells, disposal_vol=0, blow_out=True)
def run_custom_protocol( volumes_csv: FileInput = example_csv, pipette_mount: StringSelection('right', 'left') = 'right', pipette_model: StringSelection('p300-Single', 'p50-Single', 'p10-Single') = 'p300-Single', plate_type: StringSelection('96-flat', '384-plate') = '96-flat', tip_reuse: StringSelection('new tip each time', 'reuse tip') = 'new tip each time'): tipracks = [ labware.load('opentrons-tiprack-300ul', slot) for slot in tiprack_slots ] if pipette_model == 'p300-Single': pipette = instruments.P300_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_model == 'p50-Single': pipette = instruments.P50_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_model == 'p10-Single': tipracks = [ labware.load('tiprack-10ul', slot) for slot in tiprack_slots ] pipette = instruments.P10_Single(mount=pipette_mount, tip_racks=tipracks) plate = labware.load(plate_type, '3') volumes = [float(cell) for cell in well_csv_to_list(volumes_csv)] for vol in volumes: if 0 < vol < pipette.min_volume: robot.comment( 'WARNING: volume {} is below pipette\'s minimum volume.'. format(vol)) tip_strategy = 'always' if tip_reuse == 'new tip each time' else 'once' pipette.transfer(volumes, source, plate, new_tip=tip_strategy)
def run_custom_protocol( pipette_axis: StringSelection( 'B (left side)', 'A (right side)')='B (left side)'): p200 = instruments.Pipette( axis='b' if pipette_axis[0] == 'B' else 'a', min_volume=20, max_volume=200, tip_racks=[p200rack], ) # macro commands like .distribute() make writing long sequences easier: # distribute green solution to the body p200.distribute(50, green, green_wells, disposal_vol=0, blow_out=True) # distribute blue solution to the dinosaur's back p200.distribute(50, blue, blue_wells, disposal_vol=0, blow_out=True)
def run_custom_protocol( a: int = 12, b='woo', plate_type: StringSelection('96-flat', '96-PCR-flat', '96-PCR-tall') = '96-flat'): # noqa: E501 p200rack = containers.load( 'tiprack-200ul', # container type 'A1' # slot ) trough = containers.load('trough-12row', 'A3', 'trough') trash = containers.load('point', 'B2', 'trash') p200 = instruments.Pipette( trash_container=trash, tip_racks=[p200rack], min_volume=20, # actual minimum volume of the pipette axis="a", channels=8) p200.transfer(100, trough.wells(0), trough.wells(1))
def run_custom_protocol( input_csv: FileInput=example_csv, plate_type: StringSelection( 'FluidX_96_small', 'FluidX_24_9ml')='FluidX_96_small'): if plate_type == 'FluidX_96_small': destination = plate_96 else: destination = plate_24 offset = -30 input_lines = [x for x in example_csv.split("\n") if x.strip() != ""] header = [x.strip() for x in input_lines[0].split(",")] vol_to_add = [] pos_to_add = [] for line in input_lines[1:]: for i, col in enumerate(header): if col == "DilutionVolume": vol_to_add.append(float(line.split(",")[i].strip())) if col == "LocationRack": pos_to_add.append(str(line.split(",")[i].strip())) p1000.transfer(vol_to_add, source.wells('A2'), [destination.wells(x).top(offset) for x in pos_to_add])
def run_custom_protocol(number_of_samples: int = 96, left_pipette: StringSelection('p10-multi', 'P50-multi', 'p300-multi', 'none') = 'p50-multi', right_pipette: StringSelection('p10-multi', 'P50-multi', 'p300-multi', 'none') = 'p300-multi', mastermix_volume: float = 18, DNA_volume: float = 2): if left_pipette == right_pipette and left_pipette == 'none': raise Exception('You have to select at least 1 pipette.') def mount_pipette(pipette_type, mount, tiprack_slot): if pipette_type == 'p10-multi': tip_rack = [ labware.load('tiprack-10ul', slot) for slot in tiprack_slot ] pipette = instruments.P10_Multi(mount=mount, tip_racks=tip_rack) elif pipette_type == 'p50-multi': tip_rack = [ labware.load('opentrons-tiprack-300ul', slot) for slot in tiprack_slot ] pipette = instruments.P50_Multi(mount=mount, tip_racks=tip_rack) else: tip_rack = [ labware.load('opentrons-tiprack-300ul', slot) for slot in tiprack_slot ] pipette = instruments.P300_Multi(mount=mount, tip_racks=tip_rack) return pipette # labware setup dna_plate = labware.load('PCR-strip-tall', '1', 'DNA') dest_plate = labware.load('PCR-strip-tall', '2', 'Output') trough = labware.load('trough-12row', '3') # instrument setup pipette_l = mount_pipette( left_pipette, 'left', ['4', '5']) if 'none' not in left_pipette else None pipette_r = mount_pipette( right_pipette, 'right', ['6', '7']) if 'none' not in right_pipette else None # determine which pipette has the smaller volume range if pipette_l and pipette_r: if left_pipette == right_pipette: pip_s = pipette_l pip_l = pipette_r else: if pipette_l.max_volume < pipette_r.max_volume: pip_s, pip_l = pipette_l, pipette_r else: pip_s, pip_l = pipette_r, pipette_l else: pipette = pipette_l if pipette_l else pipette_r # reagent setup mastermix = trough.wells('A1') col_num = math.ceil(number_of_samples / 8) # distribute mastermix if pipette_l and pipette_r: if mastermix_volume <= pip_s.max_volume: pipette = pip_s else: pipette = pip_l pipette.distribute(mastermix_volume, mastermix, dest_plate.cols('1', length=col_num), blow_out=mastermix) # transfer DNA if pipette_l and pipette_r: if DNA_volume <= pip_s.max_volume: pipette = pip_s else: pipette = pip_l for source, dest in zip(dna_plate.cols('1', length=col_num), dest_plate.cols('1', length=col_num)): pipette.transfer(DNA_volume, source, dest)
def run_custom_protocol( well_volume: float = 50.0, reagent_well: StringSelection('A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'A11', 'A12') = 'A1', plate_starting_column: str = '1', number_of_columns_to_fill: int = 24, pipette_type: StringSelection('p300-Single', 'p50-Single', 'p10-Single', 'p300-Multi', 'p50-Multi', 'p10-Multi') = 'p50-Multi', mix_reagent_before_transfer: StringSelection('True', 'False') = 'True'): if int(plate_starting_column) <= 0 or int(plate_starting_column) > 24: raise Exception("Plate starting column number must be 1-24.") if (int(plate_starting_column) + number_of_columns_to_fill) > 25: raise Exception("Number of columns to fill exceeds plate's limit.") if mix_reagent_before_transfer == 'False': mix_times = 0 else: mix_times = 5 pip_name = pipette_type.split('-') # Check which pipette type if pip_name[0] == 'p10': tiprack = labware.load('tiprack-10ul', '1', 'p10rack') else: tiprack = labware.load('opentrons-tiprack-300ul', '1', 'p300rack') if pip_name[0] != 'p10' and well_volume < 5: raise Exception("Cannot transfer volume this small without p10.") if pip_name[0] == 'p30' and well_volume < 30: raise Exception("Cannot transfer volume this small with p300.") if pipette_type == 'p300-Single': pipette = instruments.P300_Single(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p50-Single': pipette = instruments.P50_Single(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p10-Single': pipette = instruments.P10_Single(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p300-Multi': pipette = instruments.P300_Multi(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p50-Multi': pipette = instruments.P50_Multi(mount='left', tip_racks=[tiprack]) elif pipette_type == 'p10-Multi': pipette = instruments.P10_Multi(mount='left', tip_racks=[tiprack]) if pip_name[1] == 'Multi': alternating_wells = [] for column in plate.cols(plate_starting_column, to='24'): alternating_wells.append(column.wells('A')) alternating_wells.append(column.wells('B')) dests = alternating_wells[:number_of_columns_to_fill * 2] else: dests = plate.cols(plate_starting_column, length=number_of_columns_to_fill) pipette.distribute(well_volume, trough.wells(reagent_well), dests, mix_before=(mix_times, pipette.max_volume))
def run_custom_protocol(volumes_csv: FileInput = volume_example, source_csv: FileInput = source_example, destination_csv: FileInput = destination_example, plate_type: StringSelection('96-flat', '384-flat') = '96-flat'): """ Helper Functions """ def prewet_tip(pipette): pipette.move_to((reagent1, reagent1.from_center(x=0, y=0, z=-1))) def wash(pipette): for _ in range(3): pipette.transfer(pipette.max_volume, reagent2, liquid_trash, new_tip='never') """ Check which plate you are using """ if plate_type == '96-flat': plate = labware.load('96-deep-well', '2') else: plate = labware.load('384-plate', '2') """ Turns files into dictionaries for volume, sources, destinations respectively Create vols dict mapping well number on the destination plate to volume to transfer to that well. The vols dict is of the form: {well_number: volume} """ vols = dict() temp_lines = [] for row in volumes_csv.split('\n'): # parse through each row of the CSV if row: # check if that row is not empty temp_lines.append(row.split(',')) for col in range(len(temp_lines)): # Starting with the column row_len = len(temp_lines[col]) for well in range(len(temp_lines[col])): # Now loop through each invidiual cell try: # Add a key based on the cell in excel # Each cell row corresponds to a row on the plate vols[col + well * row_len] = float(temp_lines[col][well]) except (ValueError, TypeError): vols[col + well * row_len] = 0 """ Create source dict mapping well number on the source plate to location of sample. The source dict is of the form: {sample: well_number} """ sources = defaultdict(list) temp_lines = [] for row in source_csv.split('\n'): if row: temp_lines.append(row.split(',')) for col in range(len(temp_lines)): row_len = len(temp_lines[col]) for well in range(len(temp_lines[col])): sources[temp_lines[col][well].strip()].append(well + col * row_len) """ Create destination dict mapping well number on the destination plate to which sample is in that well. The destination dict is of the form: {sample: [well_number1, well_number2 etc...]} """ dest_keys = [] dest = defaultdict(list) temp_lines = [] for row in destination_csv.split('\n'): if row: temp_lines.append(row.split(',')) for col in range(len(temp_lines)): for well in range(len(temp_lines[col])): dest_keys = dest_keys + list(temp_lines[col][well].strip()) row_len = len(temp_lines[col]) dest[temp_lines[col][well].strip()].append(col + well * row_len) dest_keys = list(set(dest_keys)) # This grabs only unique keys if not '' not in dest_keys: dest_keys.remove('') # gets rid of whitespace key """ Part A: Get samples from variously-sized labware into a deep (2.2 mL) 96 well plate: Step A1: Take clean pipette tip for p100 (single channel) and move to reagent 1 in the trough; ‘dunk’ the tip fully in the trough (but don’t take up anything) to remove any external particles Step A2: Move to reagent 2 (also in trough) and uptake full volume of tip and dispense to waste; repeat this step three times. Step A3: Take up between 20→100 uL of a sample (located in 15 or 50 mL tube rack) and dispense into the appropriate position in the 96 well plate Step A4: Discard pipette tip after sample is transferred """ for sample in dest_keys: p50single.pick_up_tip() prewet_tip(p50single) wash(p50single) destination = dest[sample] volumes = [vols[i] for i in destination] p50single.distribute(volumes, tuberack.wells(sources[sample]), plate.wells(destination), new_tip='never') p50single.drop_tip() """ Part B: Dilute each sample up to 1,900 uL using a clean tip Step B5: Take clean pipette tips for multi-channel p300 and move to reagent 1 in the trough; ‘dunk’ fully in the trough (but don’t take up anything) to remove any external particles Step B6: Move to reagent 2 (also in trough) and uptake full volume of tip and dispense to waste; repeat this step three times Step B7: Move to reagent 3 in the trough, uptake 300 uL and add to each sample; repeat six times so each sample has 1,800 uL of reagent 3. Note that, for samples that were <100 uL, the volume will be less than 1,900 uL, and so we’ll need to go back with the p100 (single channel) to dilute these samples with the correct amount of reagent 3. The exterior and interior tip cleaning procedure is the same as in steps A1 & A2. """ for sample in dest_keys: p300multi.pick_up_tip() prewet_tip(p300multi) wash(p300multi) destination = dest[sample] for well in destination: volume = 0 if vols[well] > 0: volume = 1900 - vols[well] p300multi.distribute(volume, reagent3, plate.wells(well), new_tip='never') if volume > 1800: p50single.pick_up_tip() prewet_tip(p50single) wash(p50single) p50single.transfer(volume - 1800, reagent3, plate.wells(well)) p50single.drop_tip() p300multi.drop_tip() """ Part C: Add 100 uL internal standard to each sample and homogenize Step C8: Using the p300 (multi-channel), clean a set of 200 uL tips as per steps B5 and B6 above (‘dunk’ in reagent 1; rinse with reagent 2) Step C9: Take 100 uL of internal standard (reagent 4) from a separate trough and dispense into the bottom of each sample Step C10: Dispense up and down a few times in each sample to mix/homogenize before withdrawing; discard pipette tips after this Repeat steps C8→C10 for each row of the well plate that contains samples. """ for row in range(len(dest_keys)): p300multi.pick_up_tip() prewet_tip(p300multi) wash(p300multi) destination = dest[sample] p300multi.transfer(100, reagent4, plate.rows(row), new_tip='never') p300multi.drop_tip()
def run_custom_protocol( left_pipette: StringSelection('p10-single', 'P50-single', 'p300-single', 'p1000-single', 'none') = 'p50-single', right_pipette: StringSelection('p10-single', 'P50-single', 'p300-single', 'p1000-single', 'none') = 'p300-single', master_mix_csv: FileInput = mastermix_csv_example): if left_pipette == right_pipette and left_pipette == 'none': raise Exception('You have to select at least 1 pipette.') def mount_pipette(pipette_type, mount, tiprack_slot): if pipette_type == 'p10-single': tip_rack = labware.load('tiprack-10ul', tiprack_slot) pipette = instruments.P10_Single(mount=mount, tip_racks=[tip_rack]) elif pipette_type == 'p50-single': tip_rack = labware.load('opentrons-tiprack-300ul', tiprack_slot) pipette = instruments.P50_Single(mount=mount, tip_racks=[tip_rack]) elif pipette_type == 'p300-single': tip_rack = labware.load('opentrons-tiprack-300ul', tiprack_slot) pipette = instruments.P300_Single(mount=mount, tip_racks=[tip_rack]) else: tip_rack = labware.load('tiprack-1000ul', tiprack_slot) pipette = instruments.P1000_Single(mount=mount, tip_racks=[tip_rack]) return pipette # labware setup labware.load('opentrons-tuberack-2ml-eppendorf', '1') labware.load('opentrons-tuberack-2ml-screwcap', '2') trough = labware.load('trough-12row', '3') # instrument setup pipette_l = mount_pipette(left_pipette, 'left', '5') if 'none' not in left_pipette else None pipette_r = mount_pipette(right_pipette, 'right', '6') if 'none' not in right_pipette else None # determine which pipette has the smaller volume range if pipette_l and pipette_r: if left_pipette == right_pipette: pip_s = pipette_l pip_l = pipette_r else: if pipette_l.max_volume < pipette_r.max_volume: pip_s, pip_l = pipette_l, pipette_r else: pip_s, pip_l = pipette_r, pipette_l else: pipette = pipette_l if pipette_l else pipette_r # destination mastermix_dest = trough.wells('A1') info_list = [ cell for line in master_mix_csv.splitlines() if line for cell in [line.split(',')] ] for line in info_list[1:]: source = robot.deck.children_by_name[line[1]][0].wells(line[2]) vol = float(line[3]) if pipette_l and pipette_r: if vol <= pip_s.max_volume: pipette = pip_s else: pipette = pip_l pipette.transfer(vol, source, mastermix_dest)
def run_custom_protocol( pipette_type: StringSelection('p300-Single', 'p300-Multi', 'p50-Single', 'p50-Multi') = 'p300-Multi', dilution_factor: float = 1.5, num_of_dilutions: int = 10, total_mixing_volume: float = 200.0, tip_use_strategy: StringSelection('use one tip', 'new tip each time') = 'use one tip'): pip_name = pipette_type.split('-')[1] if pipette_type == 'p300-Single': pipette = instruments.P300_Single(mount='left', tip_racks=tiprack) elif pipette_type == 'p50-Single': pipette = instruments.P50_Single(mount='left', tip_racks=tiprack) elif pipette_type == 'p300-Multi': pipette = instruments.P300_Multi(mount='left', tip_racks=tiprack) elif pipette_type == 'p50-Multi': pipette = instruments.P50_Multi(mount='left', tip_racks=tiprack) new_tip = 'never' if tip_use_strategy == 'use one tip' else 'always' transfer_volume = total_mixing_volume / dilution_factor diluent_volume = total_mixing_volume - transfer_volume if pip_name == 'Multi': # Distribute diluent across the plate to the the number of samples # And add diluent to one column after the number of samples for a blank pipette.distribute(diluent_volume, trough['A1'], plate.cols('2', length=(num_of_dilutions))) # Dilution of samples across the 96-well flat bottom plate pipette.pick_up_tip(presses=3, increment=1) pipette.transfer(transfer_volume, plate.columns('1', to=(num_of_dilutions - 1)), plate.columns('2', to=num_of_dilutions), mix_after=(3, total_mixing_volume / 2), new_tip=new_tip) # Remove transfer volume from the last column of the dilution pipette.transfer(transfer_volume, plate.columns(num_of_dilutions), liquid_trash, new_tip=new_tip) if new_tip == 'never': pipette.drop_tip() else: # Distribute diluent across the plate to the the number of samples # And add diluent to one column after the number of samples for a blank for col in plate.cols('2', length=(num_of_dilutions)): pipette.distribute(diluent_volume, trough['A1'], col) for row in plate.rows(): if new_tip == 'never': pipette.pick_up_tip() pipette.transfer(transfer_volume, row.wells('1', to=(num_of_dilutions - 1)), row.wells('2', to=(num_of_dilutions)), mix_after=(3, total_mixing_volume / 2), new_tip=new_tip) pipette.transfer(transfer_volume, row.wells(num_of_dilutions), liquid_trash, new_tip=new_tip) if new_tip == 'never': pipette.drop_tip()
def run_custom_protocol( number_of_samples: int = 96, left_pipette: StringSelection('p10-multi', 'P50-multi', 'p300-multi') = 'p50-multi', right_pipette: StringSelection('p10-multi', 'P50-multi', 'p300-multi') = 'p300-multi', mastermix_volume: float = 18, DNA_volume: float = 2): def mount_pipette(pipette_type, mount, tiprack_slot): if pipette_type == 'p10-single': tip_rack = [ labware.load('tiprack-10ul', slot) for slot in tiprack_slot ] pipette = instruments.P10_Single(mount=mount, tip_racks=tip_rack) elif pipette_type == 'p50-single': tip_rack = [ labware.load('opentrons-tiprack-300ul', slot) for slot in tiprack_slot ] pipette = instruments.P50_Single(mount=mount, tip_racks=tip_rack) elif pipette_type == 'p300-single': tip_rack = [ labware.load('opentrons-tiprack-300ul', slot) for slot in tiprack_slot ] pipette = instruments.P300_Single(mount=mount, tip_racks=tip_rack) else: tip_rack = [ labware.load('tiprack-1000ul', slot) for slot in tiprack_slot ] pipette = instruments.P1000_Single(mount=mount, tip_racks=tip_rack) return pipette # labware setup dna_plate = labware.load('PCR-strip-tall', '1', 'DNA') dest_plate = labware.load('PCR-strip-tall', '2', 'Output') trough = labware.load('trough-12row', '3') # instrument setup pipette_l = mount_pipette(left_pipette, 'left', ['4', '5']) pipette_r = mount_pipette(right_pipette, 'right', ['6', '7']) # reagent setup mastermix = trough.wells('A1') col_num = math.ceil(number_of_samples / 8) # distribute mastermix if mastermix_volume < pipette_r.min_volume and \ mastermix_volume > pipette_l.min_volume: pipette = pipette_l else: pipette = pipette_r pipette.distribute(mastermix_volume, mastermix, dest_plate.cols('1', length=col_num), blow_out=mastermix) # transfer DNA if DNA_volume < pipette_r.min_volume and DNA_volume > pipette_l.min_volume: pipette = pipette_l else: pipette = pipette_r for source, dest in zip(dna_plate.cols('1', length=col_num), dest_plate.cols('1', length=col_num)): pipette.transfer(DNA_volume, source, dest)
def run_custom_protocol(pipette_type: StringSelection( 'p300_Multi', 'p50_Single', 'p300_Single', 'p1000_Single', 'p10_Multi', 'p50_Multi', 'p10_Single') = 'p300_Multi', pipette_mount: StringSelection('left', 'right') = 'left', sample_number: int = 24, sample_volume: float = 20, bead_ratio: float = 1.8, elution_buffer_volume: float = 200, incubation_time: float = 1, settling_time: float = 1, drying_time: float = 5): total_tips = sample_number * 8 tiprack_num = total_tips // 96 + (1 if total_tips % 96 > 0 else 0) slots = ['3', '5', '6', '7', '8', '9', '10', '11'][:tiprack_num] if pipette_type == 'p1000_Single': tipracks = [labware.load('tiprack-1000ul', slot) for slot in slots] pipette = instruments.P1000_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p300_Single': tipracks = [labware.load('tiprack-200ul', slot) for slot in slots] pipette = instruments.P300_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p50_Single': tipracks = [labware.load('tiprack-200ul', slot) for slot in slots] pipette = instruments.P50_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p10_Single': tipracks = [labware.load('tiprack-10ul', slot) for slot in slots] pipette = instruments.P10_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p10_Multi': tipracks = [labware.load('tiprack-10ul', slot) for slot in slots] pipette = instruments.P10_Multi(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p50_Multi': tipracks = [labware.load('tiprack-200ul', slot) for slot in slots] pipette = instruments.P50_Multi(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p300_Multi': tipracks = [labware.load('tiprack-200ul', slot) for slot in slots] pipette = instruments.P300_Multi(mount=pipette_mount, tip_racks=tipracks) mode = pipette_type.split('_')[1] if mode == 'Single': if sample_number <= 5: reagent_container = labware.load('tube-rack-2ml', '4') liquid_waste = labware.load('trough-12row', '5').wells('A12') else: reagent_container = labware.load('trough-12row', '4') liquid_waste = reagent_container.wells('A12') samples = [well for well in mag_plate.wells()[:sample_number]] output = [well for well in output_plate.wells()[:sample_number]] else: reagent_container = labware.load('trough-12row', '4') liquid_waste = reagent_container.wells('A12') col_num = sample_number // 8 + (1 if sample_number % 8 > 0 else 0) samples = [col for col in mag_plate.cols()[:col_num]] output = [col for col in output_plate.cols()[:col_num]] # Define reagents and liquid waste beads = reagent_container.wells(0) ethanol = reagent_container.wells(1) elution_buffer = reagent_container.wells(2) # Define bead and mix volume bead_volume = sample_volume * bead_ratio if bead_volume / 2 > pipette.max_volume: mix_vol = pipette.max_volume else: mix_vol = bead_volume / 2 total_vol = bead_volume + sample_volume + 5 # Mix beads and PCR samples for target in samples: pipette.pick_up_tip() pipette.mix(5, mix_vol, beads) pipette.transfer(bead_volume, beads, target, new_tip='never') pipette.mix(10, mix_vol, target) pipette.blow_out() pipette.drop_tip() # Incubate beads and PCR product at RT for 5 minutes pipette.delay(minutes=incubation_time) # Engagae MagDeck and incubate mag_deck.engage() pipette.delay(minutes=settling_time) # Remove supernatant from magnetic beads pipette.set_flow_rate(aspirate=25, dispense=150) for target in samples: pipette.transfer(total_vol, target, liquid_waste, blow_out=True) # Wash beads twice with 70% ethanol air_vol = pipette.max_volume * 0.1 for cycle in range(2): for target in samples: pipette.transfer(200, ethanol, target, air_gap=air_vol, new_tip='once') pipette.delay(minutes=1) for target in samples: pipette.transfer(200, target, liquid_waste, air_gap=air_vol) # Dry at RT pipette.delay(minutes=drying_time) # Disengage MagDeck mag_deck.disengage() # Mix beads with elution buffer if elution_buffer_volume / 2 > pipette.max_volume: mix_vol = pipette.max_volume else: mix_vol = elution_buffer_volume / 2 for target in samples: pipette.pick_up_tip() pipette.transfer(elution_buffer_volume, elution_buffer, target, new_tip='never') pipette.mix(20, mix_vol, target) pipette.drop_tip() # Incubate at RT for 3 minutes pipette.delay(minutes=5) # Engagae MagDeck for 1 minute and remain engaged for DNA elution mag_deck.engage() pipette.delay(minutes=settling_time) # Transfer clean PCR product to a new well for target, dest in zip(samples, output): pipette.transfer(elution_buffer_volume, target, dest, blow_out=True)
def run_custom_protocol(pipette_type: StringSelection( 'p300_Multi', 'p50_Multi', 'p10_Multi', 'p1000_Single', 'p300_Single', 'p50_Single', 'p10_Single') = 'p300_Multi', pipette_mount: StringSelection('left', 'right') = 'left', sample_number: int = 16, PCR_volume: float = 20, bead_ratio: float = 1.8, elution_buffer_volume: float = 20): incubation_time = 300 settling_time = 50 drying_time = 5 total_tips = sample_number * 8 tiprack_num = total_tips // 96 + (1 if total_tips % 96 > 0 else 0) slots = ['3', '5', '6', '8', '9', '10', '11'][:tiprack_num] if pipette_type == 'p1000_Single': tipracks = [labware.load('tiprack-1000ul', slot) for slot in slots] pipette = instruments.P1000_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p300_Single': tipracks = [labware.load('tiprack-200ul', slot) for slot in slots] pipette = instruments.P300_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p50_Single': tipracks = [labware.load('tiprack-200ul', slot) for slot in slots] pipette = instruments.P50_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p10_Single': tipracks = [labware.load('tiprack-10ul', slot) for slot in slots] pipette = instruments.P10_Single(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p10_Multi': tipracks = [labware.load('tiprack-10ul', slot) for slot in slots] pipette = instruments.P10_Multi(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p50_Multi': tipracks = [labware.load('tiprack-200ul', slot) for slot in slots] pipette = instruments.P50_Multi(mount=pipette_mount, tip_racks=tipracks) elif pipette_type == 'p300_Multi': tipracks = [labware.load('tiprack-200ul', slot) for slot in slots] pipette = instruments.P300_Multi(mount=pipette_mount, tip_racks=tipracks) mode = pipette_type.split('_')[1] if mode == 'Single': if sample_number <= 5: reagent_container = labware.load('opentrons-tuberack-2ml-screwcap', '7') liquid_waste = labware.load('trough-12row', '5').wells('A12') else: reagent_container = labware.load('trough-12row', '7') liquid_waste = reagent_container.wells('A12') samples = [well for well in mag_plate.wells()[:sample_number]] samples_top = [well.top() for well in samples] output = [well for well in output_plate.wells()[:sample_number]] else: reagent_container = labware.load('trough-12row', '7') liquid_waste = reagent_container.wells('A12') col_num = sample_number // 8 + (1 if sample_number % 8 > 0 else 0) samples = [col for col in mag_plate.cols()[:col_num]] samples_top = [well.top() for well in mag_plate.rows(0)[:col_num]] output = [col for col in output_plate.cols()[:col_num]] # Define reagents and liquid waste beads = reagent_container.wells(0) ethanol = reagent_container.wells(1) elution_buffer = reagent_container.wells(2) # Define bead and mix volume to resuspend beads bead_volume = PCR_volume * bead_ratio if mode == 'Single': if bead_volume * sample_number > pipette.max_volume: mix_vol = pipette.max_volume else: mix_vol = bead_volume * sample_number else: if bead_volume * col_num > pipette.max_volume: mix_vol = pipette.max_volume else: mix_vol = bead_volume * col_num total_vol = bead_volume + PCR_volume + 15 mix_voltarget = PCR_volume + 10 # Disengage MagDeck mag_deck.disengage() # Mix Speed pipette.set_flow_rate(aspirate=180, dispense=180) # Mix beads and PCR samples for target in samples: pipette.set_flow_rate(aspirate=180, dispense=180) pipette.pick_up_tip() # Slow down head speed 0.5X for bead handling pipette.mix(25, mix_vol, beads) max_speed_per_axis = { 'x': (50), 'y': (50), 'z': (50), 'a': (10), 'b': (10), 'c': (10) } robot.head_speed(combined_speed=max(max_speed_per_axis.values()), **max_speed_per_axis) pipette.set_flow_rate(aspirate=10, dispense=10) pipette.transfer(bead_volume, beads, target, air_gap=0, new_tip='never') pipette.set_flow_rate(aspirate=50, dispense=50) pipette.mix(40, mix_voltarget, target) pipette.blow_out() max_speed_per_axis = { 'x': (600), 'y': (400), 'z': (100), 'a': (100), 'b': (40), 'c': (40) } robot.head_speed(combined_speed=max(max_speed_per_axis.values()), **max_speed_per_axis) pipette.drop_tip() # Return robot head speed to the defaults for all axes max_speed_per_axis = { 'x': (600), 'y': (400), 'z': (100), 'a': (100), 'b': (40), 'c': (40) } robot.head_speed(combined_speed=max(max_speed_per_axis.values()), **max_speed_per_axis) # Incubate beads and PCR product at RT for 5 minutes robot.comment("Incubating the beads and PCR products at room temperature \ for 5 minutes. Protocol will resume automatically.") pipette.delay(seconds=incubation_time) # Engage MagDeck and Magnetize robot._driver.run_flag.wait() mag_deck.engage() robot.comment("Delaying for " + str(settling_time) + " seconds for beads to \ settle.") pipette.delay(seconds=settling_time) # Remove supernatant from magnetic beads pipette.set_flow_rate(aspirate=25, dispense=120) for target in samples: pipette.transfer(total_vol, target.bottom(0.7), liquid_waste.top(), blow_out=True) # Wash beads twice with 70% ethanol air_vol = pipette.max_volume * 0.1 for cycle in range(2): pipette.pick_up_tip() for target in samples_top: pipette.transfer(185, ethanol, target, air_gap=air_vol, new_tip='never') robot.comment("Delaying for 17 seconds.") pipette.delay(seconds=17) for target in samples: if not pipette.tip_attached: pipette.pick_up_tip() pipette.transfer(195, target.bottom(0.7), liquid_waste.top(), air_gap=air_vol, new_tip='never') pipette.drop_tip() # Dry at RT robot.comment("Drying the beads for " + str(drying_time) + " minutes. Protocol \ will resume automatically.") pipette.delay(minutes=drying_time) # Disengage MagDeck robot._driver.run_flag.wait() mag_deck.disengage() # Mix beads with elution buffer if elution_buffer_volume / 2 > pipette.max_volume: mix_vol = pipette.max_volume else: mix_vol = elution_buffer_volume / 2 for target in samples: pipette.pick_up_tip() pipette.transfer(elution_buffer_volume, elution_buffer, target, new_tip='never') pipette.mix(45, mix_vol, target) pipette.drop_tip() # Incubate at RT for 3 minutes robot.comment( "Incubating at room temperature for 3 minutes. Protocol will \ resume automatically.") pipette.delay(minutes=3) # Engage MagDeck for 1 minute and remain engaged for DNA elution robot._driver.run_flag.wait() mag_deck.engage() robot.comment("Delaying for " + str(settling_time) + " seconds for beads to \ settle.") pipette.delay(seconds=settling_time) # Transfer clean PCR product to a new well for target, dest in zip(samples, output): pipette.transfer(elution_buffer_volume, target.bottom(1), dest.top(), blow_out=True) # Disengage MagDeck mag_deck.disengage()
def run_custom_protocol( well_volume: float = 50.0, reagent_well: StringSelection('A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'A11', 'A12') = 'A1', plate_starting_row: str = '1', number_of_rows_to_fill: int = 24, pipette_type: StringSelection('p300-Single', 'p50-Single', 'p10-Single', 'p300-Multi', 'p50-Multi', 'p10-Multi', 'p200-Single', 'p200-Multi') = 'p50-Multi', mix_reagent_before_transfer: StringSelection('True', 'False') = 'True'): if int(plate_starting_row) <= 0 or int(plate_starting_row) > 24: raise Exception("Plate starting column number must be 1-24.") if (int(plate_starting_row) + number_of_rows_to_fill) > 25: raise Exception("Number of columns to fill exceeds plate's limit.") if mix_reagent_before_transfer == 'False': mix_times = 0 else: mix_times = 5 pip_name = pipette_type.split('-') # Check which pipette type if pip_name[0] == 'p10': tiprack = containers.load('tiprack-10ul', 'A1', 'p10rack') else: tiprack = containers.load('tiprack-200ul', 'A1', 'p300rack') if pip_name[0] != 'p10' and well_volume < 5: raise Exception("Cannot transfer volume this small without p10.") if pip_name[0] == 'p20' and well_volume < 20: raise Exception("Cannot transfer volume this small with p200.") if pip_name[0] == 'p30' and well_volume < 30: raise Exception("Cannot transfer volume this small with p300.") # create pipette if pip_name[1] == 'Single': chan = 1 # Number of channels if pip_name[1] == 'Multi': chan = 8 vol = int(pip_name[0][1:]) pipette = instruments.Pipette(axis='b', max_volume=vol, tip_racks=[tiprack], channels=chan, trash_container=trash) if pip_name[1] == 'Multi': alternating_wells = [] for row in plate.rows(plate_starting_row, to='24'): alternating_wells.append(row.wells('A')) alternating_wells.append(row.wells('B')) dests = alternating_wells[:number_of_rows_to_fill * 2] else: dests = plate.rows(plate_starting_row, length=number_of_rows_to_fill) pipette.distribute(well_volume, trough.wells(reagent_well), dests, mix_before=(mix_times, pipette.max_volume))