def load(name, slot): module_instance = None if name in SUPPORTED_MODULES: if robot.is_simulating(): labware_instance = labware.load(name, slot) module_class = SUPPORTED_MODULES.get(name) module_instance = module_class(lw=labware_instance) else: # TODO: BC 2018-08-01 this currently loads the first module of # that type that is on the robot, in the future we should add # support for multiple instances of one module type this # accessor would then load the correct disambiguated module # instance via the module's serial matching_modules = [ module for module in robot.modules if isinstance(module, SUPPORTED_MODULES.get(name)) ] if matching_modules: module_instance = matching_modules[0] labware_instance = labware.load(name, slot) module_instance.labware = labware_instance else: raise AbsentModuleError( "no module of name {} is currently connected".format(name)) else: raise UnsupportedModuleError("{} is not a valid module".format(name)) return module_instance
def execute_move(function, args): # For the simulation if robot.is_simulating(): function(*args) return # When the robot starts moving light goes on and # button turns red robot._driver.turn_on_rail_lights() robot._driver.turn_on_red_button_light() cmd = "ffplay -nodisp -autoexit /mnt/usbdrive/robot.mp3 &> /dev/null" cmd2 = "pkill ffplay" # Will play while door is opened while not robot._driver.read_window_switches(): p = Popen(cmd,shell=True) while not robot._driver.read_window_switches() and p.poll() is None: sleep(.1) if robot._driver.read_window_switches() and p.poll() is None: os.system(cmd2) try: function(*args) except: debug_msg("Error calling function " + function().__name__ + "\n") robot._driver.turn_off_rail_lights() robot._driver.turn_on_blue_button_light()
def robot_wait(): if not robot.is_simulating(): robot.comment("Waiting...") robot._driver.turn_on_red_button_light() while not robot._driver.read_button(): sleep(0.5) robot._driver.turn_on_blue_button_light()
def robot_wait_tiprack(): if not robot.is_simulating(): robot.comment("Waiting...") set_button_light(blue=True, red=True, green=True) while not robot._driver.read_button(): sleep(0.5) robot._driver.turn_on_blue_button_light()
def robot_wait_tiprack(): if not robot.is_simulating(): robot.comment("Waiting...") os.system('/data/startpwm 1 1 1 16') while not robot._driver.read_button(): sleep(0.5) os.system('/data/stoppwm') robot._driver.turn_on_blue_button_light()
def robot_wait(func=None, timer=None): # You can specify a function to run <timer> minutes after the robot starts waiting if func is not None: if robot.is_simulating(): func() start_time = perf_counter() duration = 60 * timer started = False if not robot.is_simulating(): robot.comment("Waiting...") robot._driver.turn_on_red_button_light() while not robot._driver.read_button(): if func is not None and not started: now = perf_counter() if now - start_time > duration: started = True func() sleep(0.5) robot._driver.turn_on_blue_button_light()
def incubate(mins, secs=0, ar=100, dr=100): duration = 60*mins + secs start_time = time.perf_counter() elapsed_time = 0 while elapsed_time < duration: pipette.set_flow_rate(aspirate=ar, dispense=dr) pipette.pick_up_tip() pipette.mix(2,100,md_lab.wells('A1')) pipette.drop_tip() pipette.pick_up_tip() pipette.mix(2,100,md_lab.wells('A2')) pipette.delay(seconds=15) pipette.drop_tip() if robot.is_simulating(): elapsed_time += 30 else: elapsed_time = time.perf_counter() - start_time
robot.home() # Returns the Opentron pipette to the starting location source = 0 # Source is declared as an empty variable so it can track reagent position from the sort() function [ [ sort(values, well_counter, reagent, counter) for well_counter, values in enumerate(reagent) ] for counter, reagent in enumerate(reagents1, 0) ] # Unless you change the name of reagents1, you will never need to alter this line # The line above executes the entire protocol, iterating through the reagent lists and destinations, as such it shouldn't need to be adjusted unless the reagent list names change ######################################################################################### ######################################################################################### # COMPETENT CELLS if not robot.is_simulating(): # If the OT2 is currently not heating something tempdeck.set_temperature( TargetTemp["temp"] ) # Sets the temperature to the value in the TargetTemp dictionary with key temp tempdeck.wait_for_temp( ) # Pauses the protocol until the temperature deck reaches the desired temperature target1 = Compcells1( Even_wells) # Assigns the wells of Compcells1 as the target1 variable robot.home() # Returns the OT2 to the starting position robot.comment( "Make sure that centrifuge has been chilled down to 4*C and all buffers are on ice." ) # Produces a message on the OT2 display to inform the user of what the next step is robot.comment( "All plates should be chilled at the beginning and culture should be incubated on ice for 15 minutes before start."
# Run PCR as an independent protocol # Labware and module initialization if "eppendorf_rack" not in labware.list(): labware.create("eppendorf_rack", grid=(12, 8), spacing=(9, 9), diameter=5, depth=21, volume=50) plate = labware.load('eppendorf_rack', slot='8') tiprack = labware.load('opentrons-tiprack-300ul', slot='6') ninja = NinjaPCR(slot='10', simulating=robot.is_simulating()) primer_well = 'A2' mm_well = 'B2' dna_well = 'C2' water_well = 'D2' first_mix = 'A1' second_mix = 'B1' third_mix = 'C1' pipette_l = instruments.P50_Single(mount='left', tip_racks=[tiprack]) args = [ plate, pipette_l, tiprack, ninja, primer_well, mm_well, dna_well, water_well, first_mix, second_mix, third_mix
diameter=5, depth=30, volume=50) modules.magdeck.LABWARE_ENGAGE_HEIGHT[magdeck_plate] = 10 # MagDeck and associated labware magdeck = modules.load('MagDeck', slot=4) md_lab = labware.load(magdeck_plate, slot=4, share=True) # Thermal module. SHOULD REMAIN AT 4ºC DURING THE WHOLE PROTOCOL. TODO tempdeck = NinjaTempDeck(slot=1, simulating = True) td_lab = tempdeck.labware # Thermocycler. thermocycler = NinjaPCR(slot=10, simulating = robot.is_simulating()) tc_lab = thermocycler.labware samples = labware.load('Eppendorf_Samples', slot=8) tiprack = labware.load('opentrons-tiprack-300ul', slot=6) tiprack2 = labware.load('opentrons-tiprack-300ul', slot=3) liquid_trash = labware.load('corning_384_wellplate_112ul_flat', slot = 5) #primers = labware.load('eppendorf_rack', slot=2) pipette_l = instruments.P300_Single(mount='left', tip_racks=[tiprack])#, tiprack2]) md_well = md_lab.wells('A1') n_well = tc_lab.wells('A1') md_offset = 0 engage_wait_time = 10 plunger_speeds = {'aspirate_mix': 300, 'dispense_mix': 300, 'aspirate_normal': 150, 'dispense_normal': 150}
Compcells1.rows['F']['2':'11':2] ] # Specify the target wells that you want to have bacterial aliquots in Buffers_positions = Buffers.wells( 'A1', length=25 ) # Specify the buffer positions, change length=25 to whatever the number of buffers you have, eg if 15 buffers length=15 ######################################################################################### ######################################################################################### # BELOW IS CODE FOR THE PROTOCOL # IF WORKING WITH E. COLI, BELOW IS A OPTIMAL PROTOCOL THAT ONLY REQUIRES 1 WASH STEP # IF INVESTINGATING DIFFERENT INCUBATION TIMES, ALTER P300 DELAYS # IF WANTING TO CHANGE TEMPDECK ON CONSTANTLY, REMOVE ALL tempdeck.disengage() AND PLACE BEFORE # FINAL ROBOT COMMENT if not robot.is_simulating( ): # Cannot use while simulating, the OT2 needs to be inactive for this statement to be carried out tempdeck.set_temperature( target_temperature ) # Sets the temperature to whats specified as target_temperature tempdeck.wait_for_temp( ) # Pauses the protocol until the temperature deck reaches the target temperature target1 = Even_wells # Saves the wells specified earlier, in the array, as a variable robot.home() # Resets the position of the pipette to the starting location robot.pause() # Pauses the OT2 untiled resumed via the OT app robot.comment( "Make sure that centrifuge has been chilled down to 4*C and all buffers are on ice." ) # Causes the Opentron to produce a message, statin what is in the brackets robot.comment( "All plates should be chilled at the beginning and culture should be incubated on ice for 15 minutes before start."
thermic_name = 'Thermic_Module' #TODO check if thermic_name not in labware.list(): thermic = labware.create( thermic_name, # Labware Name grid = (4, 4), # Amount of (columns, rows) spacing = (9, 9), # Distances (mm) between each (column, row) diameter = 2, # Diameter (mm) of each well on the plate depth = 10, # Depth (mm) of each well on the plate volume = 50) plate_samples = labware.load('96-flat', slot ='11') # Samples TODO Eppendorf 1.5 tiprack = labware.load('tiprack-10ul', slot ='6') # Tipracks magnetic = modules.load('magdeck', slot ='4') # Magnetic Deck plate_magnet = labware.load('96-flat', slot ='4', share = True) # Magnetic Deck plate thermocycler = NinjaPCR(slot='10', simulating = robot.is_simulating()) # Ninja-PCR thermic_module = labware.load(thermic_name, slot ='1') # Auxiliar thermic module trash = labware.load('trash-box', slot = '12', share = True) # Trash # [2] Pipettes pipette_l = instruments.P300_Single(mount = 'left', tip_racks=[tiprack], trash_container = trash) pipette_r = instruments.P50_Multi(mount = 'right', tip_racks=[tiprack], trash_container = trash) pipette_l.set_flow_rate(aspirate = 50, dispense = 100) pipette_r.set_flow_rate(aspirate = 50, dispense = 100) # [3] Commands def execute_move(function, args): # For the simulation
print("Failed to find given modules. Are they plugged in?") exit(1) # Match temp deck with serial number: # Only two provided serial number are checked, update if more temp modules need to be loaded for deck in temp_decks: if deck.device_info == cold_deck_ID: cold_deck = deck elif deck.device_info == hot_deck_ID: hot_deck = deck else: print("Fatal error: Unknown serial number. Terminating...") exit(1) # Disconnect temp decks if simulating. Otherwise decks will start running when the opentrons app runs simulation to check script integrity if robot.is_simulating(): cold_deck.disconnect() hot_deck.disconnect() # Now you can use hot_deck and cold_deck to control temprature of your deck # However, you still need to load modules using their standard api: # This is because the objects constructed by `modules.load('tempdeck')` and 'tempdeck.TempDeck()' belong to two different classes and they each support different part of functions required in this kind of scenario. You have to use hot_deck for any functions related to temp (set, wait, etc) and load hotDeck so that the robot knows there is a module loaded at this position (it will presumably adjust how deep pipettes go down at these locations as plates are elevated by modules) hotDeck = modules.load('tempdeck', 4) coldDeck = modules.load( 'tempdeck', 7) # Or the positions they are in respectively on the deck # Use cold_deck and hot_deck to set temp: cold_deck.set_temprature(10) hot_deck.set_temprature(60)
Buffers_positions = Buffers.wells( 'A1', length=25 ) # Specify the buffer positions, change length=25 to whatever the number # of buffers you have, eg if 15 buffers length=15 ######################################################################################### ######################################################################################### # BELOW IS CODE FOR THE PROTOCOL # IF WORKING WITH E. COLI, BELOW IS A OPTIMAL PROTOCOL THAT ONLY REQUIRES 1 WASH STEP # IF INVESTINGATING DIFFERENT INCUBATION TIMES, ALTER P300 DELAYS # IF WANTING TO CHANGE TEMPDECK ON CONSTANTLY, REMOVE ALL tempdeck.disengage() AND PLACE BEFORE # FINAL ROBOT COMMENT tempdeck = TempDeck() # Connects the Tempdeck module to OT-2 if not robot.is_simulating(): # Cannot use while simulating, tempdeck.connect('/dev/ttyACM0') tempdeck.set_temperature( target_temperature) # Sets the temperature to whats specified above target1 = Compcells1(Even_wells) # Where your cells are going robot.home() # turbulent airflow within the OT-2 robot.pause() robot.comment( "Make sure that centrifuge has been chilled down to 4*C and all buffers are on ice." ) robot.comment( "All plates should be chilled at the beginning and culture should be incubated on ice for 15 minutes before start." ) robot.comment(
def _sleep(seconds): if not robot.is_simulating(): time.sleep(seconds)
autoconnect-priority=20 interface-name=eth0 permissions= [ethernet] cloned-mac-address=permanent mac-address-blacklist= [ipv4] dns-search= method=manual addresses={STATIC_IP} """ from opentrons import robot import os robot.comment( f"Run this protocol to permanently set the wired IP address of your OT-2 to {STATIC_IP}." ) if not robot.is_simulating(): with open( "/var/lib/NetworkManager/system-connections/support-team-wired-static-ip", "w") as keyfile: keyfile.write(keyfile_contents) os.sync() robot.comment("Done.") robot.comment("Restart your OT-2 to apply the changes.")
Plasmid2_wells = [] # The letter specifies the column, the numbers specify the range i.e 2 to 11, the third number specifies steps, 2 to 11 in steps of 2 # Additional List can be added, but these list need to be included in the All_wells array All_wells = [Plasmid1_wells, Plasmid2_wells] # Creates an array from the lists of wells. More lists can be declared and added to this array # By adding in another variable to this section a second list for cells requiring a different plasmid can be used # A third variable would be needed to house both lists and could be used to iterate through the loops with each smaller list being for each plasmid, biglist = [list1,list2], biglist[0] #All_Wells = Randomizer(All_wells) # Randomizes the wells, delete the hashtag to allow this randomizer to run. Imported from OT2_Functions ######################################################################################### ######################################################################################### tempdeck = TempDeck() # Saves the temperature deck into a variable, temperature = {"temp1": 4, "temp2": 42, "temp3": 37} # Saves the temperatures for the protocol into a dictionary. Dictionaries have keys and values # The value can be called by the key i.e temperature["temp1"] = 4 if not robot.is_simulating(): # If the robot is inactive and the temperature deck isn't processing a command tempdeck.connect('/dev/ttyACM0') # Connects to and begins cooling the temperature deck tempdeck.set_temperature(temperature["temp1"]) # Initialization temperature for cooling tempdeck.wait_for_temp() # Pauses the protocol until the temperature deck reaches the set temperature target = All_wells # Adds the array of wells into a variable for easier readability during manipulation SOB_wells = [well.top(1) for well in target] # well.top moves the pipette to the top of the well, the number specifies the distance in mm robot.pause() # Opentron command that pauses whatever the robot is doing. The user can remove and centrifuge at this point, if the need is there. resumed via the OT app # The code below handles distributing plasmid DNA for i in range(NumberofPlasmids): # Transfers plasmid DNA into competent cell aliquots. The variable NumberofPlasmids controls how many times the loop is carried out, once for each plasmid P10.distribute( # Presumes same plasmid for all cells, adds all doses to the pipette, wells specified later in the block PlasmidVolume, # Specifies the volume in ul DNA(i), # Selects which plasmid to pipette based on it's position on the container declared DNA. I increases with each loop, meaning the next plasmid is selected target, # Target is the specified wells where the plasmid is then distributed (this will not work if multiple plasmids are being used) blow_out=True, # Empties the pipette with an extra gust of air to ensure it is fluid free