Example #1
0
def run(protocol: protocol_api.ProtocolContext):
    tiprack = protocol.load_labware_from_definition(TIPRACK_DEF,
                                                    TEST_TIPRACK_SLOT,
                                                    TIPRACK_LABEL)
    pipette = protocol.load_instrument(PIPETTE_NAME,
                                       PIPETTE_MOUNT,
                                       tip_racks=[tiprack])

    num_cols = len(TIPRACK_DEF.get('ordering', [[]]))
    num_rows = len(TIPRACK_DEF.get('ordering', [[]])[0])

    def set_speeds(rate):
        protocol.max_speeds.update({
            'X': (600 * rate),
            'Y': (400 * rate),
            'Z': (125 * rate),
            'A': (125 * rate),
        })

        speed_max = max(protocol.max_speeds.values())

        for instr in protocol.loaded_instruments.values():
            instr.default_speed = speed_max

    set_speeds(RATE)
    firstwell = tiprack.well('A1')
    pipette.move_to(firstwell.top())
    protocol.pause("If the pipette is accurate click 'resume'")
    pipette.pick_up_tip()
    protocol.pause(
        "If the pipette went into the center of the tip, click 'resume'")
    pipette.return_tip()
    protocol.pause(
        "If the pipette successfully picked up the tip(s) but does not eject succesfully, pull the tip(s) off by hand and click 'resume'. Do not worry about tip ejection yet"
    )

    last_col = (num_cols * num_rows) - num_rows
    if (PIPETTE_NAME == 'p20_multi_gen2' or PIPETTE_NAME == 'p300_multi_gen2'):
        well = tiprack.well(last_col)
        pipette.move_to(well.top())
        protocol.pause("If the position is accurate click 'resume'")
        pipette.pick_up_tip(well)
    else:
        last_well = (num_cols) * (num_rows)
        well = tiprack.well(last_well - 1)
        pipette.move_to(well.top())
        protocol.pause("If the position is accurate click 'resume'")
        pipette.pick_up_tip(well)

    protocol.pause(
        "If the pipette went to the center of the tip, click 'resume'")
    pipette.return_tip()
    protocol.comment(
        "If the pipette successfully picked up the tip(s) but does not eject succesfully, pull the tip(s) off by hand and click 'resume'. Do not worry about tip ejection yet"
    )
Example #2
0
def run(protocol: protocol_api.ProtocolContext):

    # load the labware into the protocol
    sorenson_384_wellplate_30ul = protocol.load_labware_from_definition(
        LABWARE_DEF,
        sorenson384_slot,
        LABWARE_LABEL,
    )
    tiprack = protocol.load_labware(tip_rack_name, tip_rack_slot)
    reservoirs = protocol.load_labware(reservoirs_name, reservoirs_slot)

    # pipettes
    right_pipette = protocol.load_instrument(Right_pipette, 'right', tip_racks=[tiprack])

    #commands

    # right_pipette.distribute(30, reservoirs.wells(0), sorenson_384_wellplate_30ul.wells(), blow_out=True, blowout_location='source well')
    right_pipette.distribute(30, reservoirs.wells(0), sorenson_384_wellplate_30ul.rows_by_name()['A'], blow_out=True, blowout_location='source well')
    right_pipette.distribute(30, reservoirs.wells(2), sorenson_384_wellplate_30ul.rows_by_name()['B'], blow_out=True, blowout_location='source well')
def run(protocol: protocol_api.ProtocolContext):

    # load the labware into the protocol
    Axygen_25_ml = protocol.load_labware_from_definition(
        LABWARE_DEF,
        Axygen_25_ml_slot,
        LABWARE_LABEL,
    )
    tiprack = protocol.load_labware(tip_rack_name, tip_rack_slot)
    plate = protocol.load_labware(plate_name, plate_slot)

    # pipettes
    right_pipette = protocol.load_instrument(Right_pipette,
                                             'right',
                                             tip_racks=[tiprack])

    #commands
    right_pipette.distribute(30,
                             Axygen_25_ml.wells(0),
                             plate.wells(),
                             blow_out=True,
                             blowout_location='source well')
Example #4
0
    def run_test(self, ctx: ProtocolContext):
        """Test protocol"""
        ctx.comment("Test the custom '{}' rack".format(
            self.metadata["displayName"]))

        rack = ctx.load_labware_from_definition(self.labware_definition(), '2',
                                                'custom tuberack')
        tipracks1000 = [
            ctx.load_labware('opentrons_96_filtertiprack_1000ul', '1',
                             '1000µl filter tiprack')
        ]
        p1000 = ctx.load_instrument('p1000_single_gen2',
                                    'right',
                                    tip_racks=tipracks1000)

        p1000.pick_up_tip()
        for w in rack.wells():
            ctx.pause("moving to top of {}".format(w))
            p1000.move_to(w.top())
            ctx.pause("moving to bottom of {} (1 mm high)".format(w))
            p1000.move_to(w.bottom(1))
            p1000.aspirate(5)
            p1000.dispense(5)
        p1000.drop_tip()
Example #5
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix from a 1.5mL or 5mL tube.
    Adding barcoded primers - from 1.5mL tubes, 2 different R primers.
    """
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================
    # Pipette tips
    if dispension_vol >= 19:
        ## When the mm volume to be dispensed >= 19, 200µL tips are
        ## needed in addition to the 20µL tips.
        tips_200 = protocol.load_labware('opentrons_96_filtertiprack_200ul', 2,
                                         '200tips')
        tips_20_1 = protocol.load_labware('opentrons_96_filtertiprack_20ul', 7,
                                          '20tips_1')
        tips_20_2 = protocol.load_labware('opentrons_96_filtertiprack_20ul',
                                          10, '20tips_2')
        tips_20 = [tips_20_1, tips_20_2]
    else:
        ## When the mm volume to be dispensed <=19, only 20µL are needed
        tips_20_1 = protocol.load_labware('opentrons_96_filtertiprack_20ul', 2,
                                          '20tips_1')
        tips_20_2 = protocol.load_labware('opentrons_96_filtertiprack_20ul', 7,
                                          '20tips_2')
        tips_20_3 = protocol.load_labware('opentrons_96_filtertiprack_20ul',
                                          10, '20tips_3')
        tips_20 = [tips_20_1, tips_20_2, tips_20_3]

    # Tube_racks & plates
    F_primer_source = protocol.load_labware(
        'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap', 11,
        'F_primer_source')
    Ra_primer_source = protocol.load_labware(
        'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap', 8,
        'Ra_primer_source')
    Rb_primer_source = protocol.load_labware(
        'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap', 5,
        'Rb_primer_source')

    if mastermix_tube_type == 'tube_1.5mL':
        mastermix_tube = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap', 3,
            'mastermix_tube')

    if simulate:  #Simulator
        with open("labware/pcrstrips_96_wellplate_200ul/"
                  "pcrstrips_96_wellplate_200ul.json") as labware_file:
            labware_def_pcrstrips = json.load(labware_file)
        PCR_strips = protocol.load_labware_from_definition(
            labware_def_pcrstrips, 6, 'PCR_strips')
        if mastermix_tube_type == 'tube_5mL':
            with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
                      "eppendorfscrewcap_15_tuberack_5000ul.json"
                      ) as labware_file:
                labware_def_5mL = json.load(labware_file)
            mastermix_tube = protocol.load_labware_from_definition(
                labware_def_5mL, 3, 'mastermix_tube')
    else:  #Robot
        PCR_strips = protocol.load_labware('pcrstrips_96_wellplate_200ul', 6,
                                           'PCR_strips')
        if mastermix_tube_type == 'tube_5mL':
            mastermix_tube = protocol.load_labware(
                'eppendorfscrewcap_15_tuberack_5000ul', 3, 'mastermix_tube')

    # Pipettes
    if dispension_vol >= 19:
        p300 = protocol.load_instrument('p300_single_gen2',
                                        'right',
                                        tip_racks=[tips_200])
    p20 = protocol.load_instrument('p20_single_gen2',
                                   'left',
                                   tip_racks=tips_20)
    # =============================================================================

    # PREDIFINED VARIABLES=========================================================
    # =============================================================================
    aspiration_vol = dispension_vol + (dispension_vol / 100 * 2)
    ## The aspiration_vol is the volume (µL) that is aspirated from the
    ## container.
    ##### Variables for volume tracking
    start_height = vt.cal_start_height(mastermix_tube_type, start_vol)
    ## Call start height calculation function from volume tracking module.
    current_height = start_height
    ## Set the current height to start height at the beginning of the
    ## protocol.
    F_primer_mix_vol = F_primer_vol + 3
    R_primer_mix_vol = R_primer_vol + 3
    ## primer_mix_vol = volume for pipetting up and down
    # =============================================================================

    # SETTING LOCATIONS============================================================
    # =============================================================================
    # Setting starting tip
    if dispension_vol >= 19:
        ## If the mm volume to be dispendsed >= 19, assign p300 starting tip
        p300.starting_tip = tips_200.well(starting_tip_p200)
    p20.starting_tip = tips_20_1.well(starting_tip_p20)

    # Mastermix tube location
    MasterMix = mastermix_tube[mastermix_source]

    # Create a list of wells where mix and primers should go
    destination_wells = []
    PCR_strips_columns = ([
        PCR_strips.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ])
    for column in PCR_strips_columns:
        for destination_well in column:
            destination_wells.append(destination_well)
    MasterMixAliquots = destination_wells[:number_of_primers]
    ## cuts off the list after a the number_of_primers number of wells
    F_primer_source_wells = F_primer_source.wells()[:number_of_primers]
    Ra_primer_source_wells = Ra_primer_source.wells()[:number_of_primers]
    Rb_primer_source_wells = Rb_primer_source.wells()[:number_of_primers]
    # =============================================================================

    ## PIPETTING===================================================================
    ## ============================================================================
    ## LIGHTS----------------------------------------------------------------------
    protocol.set_rail_lights(True)
    ## ----------------------------------------------------------------------------
    ## ALIQUOTING MASTERMIX--------------------------------------------------------
    if dispension_vol >= 19:
        pipette = p300
    else:
        pipette = p20
    for i, well in enumerate(MasterMixAliquots):
        ## aliquot mix, for each well do the following:
        if i == 0:
            pipette.pick_up_tip()
            ## If we are at the first well, start by picking up a tip.
        elif i % 8 == 0:
            pipette.drop_tip()
            pipette.pick_up_tip()
            ## Then, after every 8th well, drop tip and pick up new

        current_height, pip_height, bottom_reached = vt.volume_tracking(
            mastermix_tube_type, dispension_vol, current_height)
        ## call volume_tracking function, obtain current_height,
        ## pip_height and whether bottom_reached.

        if bottom_reached:
            aspiration_location = MasterMix.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
            ## If bottom is reached keep pipetting from bottom + 1
        else:
            aspiration_location = MasterMix.bottom(pip_height)
            ## Set the location of where to aspirate from.

        #### The actual aliquoting of mastermix
        pipette.aspirate(aspiration_vol, aspiration_location)
        ## Aspirate the amount specified in aspiration_vol from the
        ## location specified in aspiration_location.
        pipette.dispense(dispension_vol, well)
        ## Dispense the amount specified in dispension_vol to the
        ## location specified in well (so a new well every time the
        ## loop restarts)
        pipette.dispense(10, aspiration_location)
        ## Alternative for blow-out, make sure the tip doesn't fill
        ## completely when using a disposal volume by dispensing some
        ## of the volume after each pipetting step. (blow-out to many
        ## bubbles)
    pipette.drop_tip()
    ## ----------------------------------------------------------------------------
    ## ADDING F PRIMERS TO THE MIX-------------------------------------------------
    for F_primer_well, destination_well in zip(F_primer_source_wells,
                                               MasterMixAliquots):
        ## Loop trough primer_wells and sample_wells
        p20.pick_up_tip()
        p20.aspirate(F_primer_vol, F_primer_well)
        p20.dispense(F_primer_vol, destination_well)
        p20.mix(3, F_primer_mix_vol, destination_well)
        p20.dispense(10, destination_well)
        p20.drop_tip()
# ## ----------------------------------------------------------------------------
# ## ADDING Ra PRIMERS TO THE MIX------------------------------------------------
    for Ra_primer_well, destination_well in zip(Ra_primer_source_wells,
                                                MasterMixAliquots):
        ## Loop trough primer_wells and sample_wells
        p20.pick_up_tip()
        p20.aspirate(R_primer_vol, Ra_primer_well)
        p20.dispense(R_primer_vol, destination_well)
        p20.mix(3, R_primer_mix_vol, destination_well)
        p20.dispense(10, destination_well)
        p20.drop_tip()
# ## ----------------------------------------------------------------------------
# ## ADDING Rb PRIMERS TO THE MIX-------------------------------------------------
    for Rb_primer_well, destination_well in zip(Rb_primer_source_wells,
                                                MasterMixAliquots):
        ## Loop trough primer_wells and sample_wells
        p20.pick_up_tip()
        p20.aspirate(R_primer_vol, Rb_primer_well)
        p20.dispense(R_primer_vol, destination_well)
        p20.mix(3, R_primer_mix_vol, destination_well)
        p20.dispense(10, destination_well)
        p20.drop_tip()
## ----------------------------------------------------------------------------
## LIGHTS----------------------------------------------------------------------
    protocol.set_rail_lights(False)


# ----------------------------------------------------------------------------
## ============================================================================
Example #6
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting Phusion mastermix from a 5 mL tube to 6 PCR strips in 
    2x 96-wells plates; using volume tracking so that the pipette starts 
    aspirating at the starting height of the liquid and goes down as the 
    volume decreases.
    Adding primers from PCR strips (with 10 uM primer F&R primer mix)
    to PCR strips (with mastermix).
    """
    # =============================================================================

    # ======================LOADING LABWARE AND PIPETTES===========================
    # =============================================================================
    ## For available labware see "labware/list_of_available_labware".       ##
    tips_200 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        3,  #deck position
        '200tips')  #custom name
    tips_20 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        4,  #deck position
        '20tips')  #custom name
    ##### !!! OPTION 1: ROBOT
    # mastermix_tube = protocol.load_labware(
    #     'eppendorfscrewcap_15_tuberack_5000ul', #labware def
    #     5,                                      #deck position
    #     'mastermix_tube')                       #custom name
    # primer_strips_1 = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',    #labware definition
    #     6,                                 #deck position
    #     'primer_strips_1')                 #custom name
    # primer_strips_2 = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',    #labware definition
    #     7,                                 #deck position
    #     'primer_strips_2')                 #custom name
    # mastermix_strips_1 = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',    #labware definition
    #     8,                                 #deck position
    #     'mastermix_strips_1')              #custom name
    # mastermix__strips_2 = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',    #labware definition
    #     9,                                 #deck position
    #     'mastermix_strips_2')              #custom name
    ##### !!! OPTION 2: SIMULATOR
    with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
              "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
        labware_def_5mL = json.load(labware_file)
    mastermix_tube = protocol.load_labware_from_definition(
        labware_def_5mL,  #variable derived from opening json
        2,  #deck position
        'mastermix_tube')  #custom name
    with open("labware/pcrstrips_96_wellplate_200ul/"
              "pcrstrips_96_wellplate_200ul.json") as labware_file:
        labware_def_pcrstrips = json.load(labware_file)
    primer_strips_1 = protocol.load_labware_from_definition(
        labware_def_pcrstrips,  #variable derived from opening json
        6,  #deck position
        'primer_strips_1')  #custom name
    primer_strips_2 = protocol.load_labware_from_definition(
        labware_def_pcrstrips,  #variable derived from opening json
        7,  #deck position
        'primer_strips_2')  #custom name
    mastermix_strips_1 = protocol.load_labware_from_definition(
        labware_def_pcrstrips,  #variable derived from opening json
        8,  #deck position
        'mastermix_strips_1')  #custom name
    mastermix_strips_2 = protocol.load_labware_from_definition(
        labware_def_pcrstrips,  #variable derived from opening json
        9,  #deck position
        'mastermix_strips_2')  #custom name

    ##### Loading pipettes
    p300 = protocol.load_instrument(
        'p300_single_gen2',  #instrument definition
        'right',  #mount position
        tip_racks=[tips_200])  #assigned tiprack
    p20 = protocol.load_instrument(
        'p20_single_gen2',  #instrument definition
        'left',  #mount position
        tip_racks=[tips_20])  #assigned tiprack
    # =============================================================================

    # ==========================VARIABLES TO SET#!!!===============================
    # =============================================================================
    start_vol = 2060
    ## The start_vol is the volume (ul) that is in the source labware at  ##
    ## the start of the protocol.                                         ##
    dispension_vol = 39
    ## The dispension_vol is the volume (ul) that needs to be aliquoted   ##
    ## into the destination wells/tubes.                                  ##
    primer_vol = 6
    ## The primer_vol is the volume (ul) of barcoded F&R primer that      ##
    ## needs to be added to the reactions that get a barcode.             ##
    p300.starting_tip = tips_200.well('A1')
    p20.starting_tip = tips_20.well('A1')
    ## The starting_tip is the location of first pipette tip in the box   ##
    container = 'tube_5mL'
    ## The container variable is needed for the volume tracking module.   ##
    ## It tells the module which dimensions to use for the calculations   ##
    ## of the pipette height. It is the source labware from which liquid  ##
    ## is aliquoted.                                                      ##
    ## There are several options to choose from:                          ##
    ## 'tube_1.5ml', 'tube_2mL', 'tube_5mL', 'tube_15mL', 'tube_50mL'   	##
    mastermix_source = mastermix_tube['C1']
    # Mastermix destination wells==================================================
    mastermix = []
    ## Create an empty list to append wells to for the mastermix wells.   ##
    mastermix_columns = ([
        mastermix_strips_1.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ] + [
        mastermix_strips_2.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ])
    ## Make a list of columns for the mastermix, this is a list of lists! ##
    for column in mastermix_columns:
        for well in column:
            mastermix.append(well)
    ## Separate the columns into wells and append them to the empty       ##
    ## mastermix wells list                                               ##
# Primer source tubes==========================================================
    primers = []
    ## Create an empty list to append wells to for the primer wells.      ##
    primer_columns = ([
        primer_strips_1.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ] + [
        primer_strips_2.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ])
    ## Make a list of columns for the primers, this is a list of lists!   ##
    for column in primer_columns:
        for well in column:
            primers.append(well)
    ## Separate the columns into wells and append them to the empty primer##
    ## wells list                                                         ##
# =============================================================================
# =============================================================================

# ==========================PREDIFINED VARIABLES===============================
# =============================================================================
    aspiration_vol = dispension_vol + (dispension_vol / 100 * 2)
    ## The aspiration_vol is the volume (ul) that is aspirated from the   ##
    ## container.                                                         ##
    ##### Variables for volume tracking
    start_height = vt.cal_start_height(container, start_vol)
    ## Call start height calculation function from volume tracking module.##
    current_height = start_height
    ## Set the current height to start height at the beginning of the     ##
    ## protocol.                                                          ##
    # =============================================================================

    # ===============================ALIQUOTING MIX================================
    # =============================================================================
    ## For each column in destination_wells, pick up a tip, than for each   ##
    ## well in these columns pipette mix, and after the+ column drop the tip##
    ## Repeat untill all columns in the list are done.                      ##
    for i, well in enumerate(mastermix):
        ## Name all the wells in the plate 'well', for all these do:            ##
        ## If we are at the first well, start by picking up a tip.          ##
        if i == 0:
            p300.pick_up_tip()
        ## Then, after every 8th well, drop tip and pick up a new one.      ##
        elif i % 8 == 0:
            p300.drop_tip()
            p300.pick_up_tip()
        current_height, pip_height, bottom_reached = vt.volume_tracking(
            container, dispension_vol, current_height)
        ## The volume_tracking function needs the arguments container ##
        ## dispension_vol and the current_height which we have set in ##
        ## this protocol. With those variables, the function updates  ##
        ## the current_height and calculates the delta_height of the  ##
        ## liquid after the next aspiration step.                     ##
        if bottom_reached:
            aspiration_location = mastermix_tube['C1'].bottom(z=1)  #!!!
            protocol.comment("You've reached the bottom!")
        else:
            aspiration_location = mastermix_source.bottom(pip_height)  #!!!
        ## If the level of the liquid in the next run of the loop will##
        ## be smaller than 1 we have reached the bottom of the tube.  ##
        ## To prevent the pipette from crashing into the bottom, we   ##
        ## tell it to go home and pause the protocol so that this can ##
        ## never happen. Set the location of where to aspirate from.  ##
        ## Because we put this in the loop, the location will change  ##
        ## to the newly calculated height after each pipetting step.  ##
        p300.aspirate(aspiration_vol, aspiration_location)
        ## Aspirate the amount specified in aspiration_vol from the   ##
        ## location specified in aspiration_location.                 ##
        p300.dispense(dispension_vol, well)
        ## Dispense the amount specified in dispension_vol to the     ##
        ## location specified in well (so a new well every time the   ##
        ## loop restarts)                                             ##
        p300.dispense(10, aspiration_location)
        ## Alternative for blow-out, make sure the tip doesn't fill   ##
        ## completely when using a disposal volume by dispensing some ##
        ## of the volume after each pipetting step. (blow-out to many ##
        ## bubbles)                                                   ##
    p300.drop_tip()
    # =============================================================================

    # ===============================ADDING PRIMERS================================
    # =============================================================================
    ## For the columns in both the source (primers) and the destination     ##
    ## (mix): loop trough the wells in those columns.                       #
    for primer_tube, mix_tube in zip(primers, mastermix):
        p20.pick_up_tip()
        p20.aspirate(primer_vol, primer_tube)
        p20.dispense(primer_vol, mix_tube)
        primer_mix_vol = primer_vol + 3
        ## primer_mix_vol = volume for pipetting up and down                ##
        p20.mix(3, primer_mix_vol, mix_tube)
        p20.dispense(10, mix_tube)
        p20.drop_tip()
Example #7
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix;
    Adding samples from different labware.
    """
# =============================================================================

# LOADING LABWARE AND PIPETTES=================================================
# =============================================================================
    # Pipette tips
    if dispension_vol >= 19:
      ## When the mm volume to be dispensed >= 19, 200µL tips are          
      ## needed in addition to the 20µL tips.                              
        tips_200 = protocol.load_labware(
            'opentrons_96_filtertiprack_200ul', 
            4,                                  
            '200tips')                          
        tips_20_1 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  
            7,                                  
            '20tips_1')                                
        tips_20_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  
            10,                                 
            '20tips_2')                         
        tips_20 = [tips_20_1, tips_20_2]
    else:
      ## When the mm volume to be dispensed <=19, only 20µL are needed      
        tips_20_1 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  
            4,                                  
            '20tips_1')                           
        tips_20_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  
            7,                                  
            '20tips_2')                           
        tips_20_3 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  
            10,                                 
            '20tips_3')                             
        tips_20 = [tips_20_1, tips_20_2, tips_20_3]
    
    # Tube_racks & plates
    destination_plate = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',        
        3,                                      
        'plate_96')   
    
    if mastermix_tube_type == 'tube_1.5mL':
        mastermix_tube = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
            1,
            'mastermix_tube')
    
    if sample_tube_type == 'tube_1.5mL':
        sample_source_1 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
            2,
            'sample_source_1')
        sample_source_2 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
            5,
            'sample_source_2')
        sample_source_3 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
            8,
            'sample_source_3')
        sample_source_4 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
            11,
            'sample_source_4')
    if sample_tube_type == 'plate_96':
        sample_source_1 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',    
            2,                                  
            'sample_source_1')
        sample_source_2 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',    
            5,                                  
            'sample_source_2')
    
    if simulate: #Simulator
        if mastermix_tube_type == 'tube_5mL': 
            with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
                 "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
                      labware_def_5mL = json.load(labware_file)
            mastermix_tube = protocol.load_labware_from_definition( 
                labware_def_5mL,           
                1,                         
                'mastermix_tube')   
        if sample_tube_type == 'PCR_strip':
            with open("labware/pcrstrips_96_wellplate_200ul/"
                      "pcrstrips_96_wellplate_200ul.json") as labware_file:
                    labware_def_pcrstrips = json.load(labware_file)
            sample_source_1 = protocol.load_labware_from_definition( 
                labware_def_pcrstrips,     
                2,                         
                'sample_source_1')         
            sample_source_2 = protocol.load_labware_from_definition( 
                labware_def_pcrstrips, 
                5,                     
                'sample_source_2')    
            sample_source_3 = protocol.load_labware_from_definition( 
                labware_def_pcrstrips,
                8,                   
                'sample_source_3')    
            sample_source_4 = protocol.load_labware_from_definition( 
                labware_def_pcrstrips,
                11,                   
                'sample_source_4')     
    else: 
        if mastermix_tube_type == 'tube_5mL': 
            mastermix_tube = protocol.load_labware(
                'eppendorfscrewcap_15_tuberack_5000ul',
                1,                                     
                'mastermix_tube')  
        if sample_tube_type == 'PCR_strips':
            sample_source_1 = protocol.load_labware( 
                'pcrstrips_96_wellplate_200ul',        
                2,                                     
                'sample_source_1')                      
            sample_source_2 = protocol.load_labware_( 
                'pcrstrips_96_wellplate_200ul',    
                5,                                 
                'sample_source_2')                 
            sample_source_3 = protocol.load_labware( 
                'pcrstrips_96_wellplate_200ul',    
                8,                                
                'sample_source_3') 
            sample_source_4 = protocol.load_labware( 
                'pcrstrips_96_wellplate_200ul',    
                11,                                
                'sample_source_4') 
                
    # Pipettes
    if dispension_vol >= 19:
        p300 = protocol.load_instrument(
            'p300_single_gen2',             
            'right',                        
            tip_racks=[tips_200])           
    p20 = protocol.load_instrument(
        'p20_single_gen2',                  
        'left',                             
        tip_racks=tips_20)
# =============================================================================

# PREDIFINED VARIABLES=========================================================
# =============================================================================
    aspiration_vol = dispension_vol + (dispension_vol/100*2)
      ## The aspiration_vol is the volume (µL) that is aspirated from the   
      ## container.                                                         
    ##### Variables for volume tracking
    start_height = vt.cal_start_height(mastermix_tube_type, start_vol)
      ## Call start height calculation function from volume tracking module.
    current_height = start_height
      ## Set the current height to start height at the beginning of the     
      ## protocol.                                                          
    sample_mix_vol = sample_vol + 3
      ## primer_mix_vol = volume for pipetting up and down                  
# =============================================================================    

# SETTING LOCATIONS============================================================
# =============================================================================
    # Setting starting tip                                           
    if dispension_vol >= 19:
        ## If the mm volume to be dispendsed >= 19, assign p300 starting tip
        p300.starting_tip = tips_200.well(starting_tip_p200)
    p20.starting_tip = tips_20_1.well(starting_tip_p20)
    
    # Mastermix tube location
    MasterMix = mastermix_tube[mastermix_source]
    
    # Make a list of all possible wells in the destination plate
    destination_wells = []
    for well in destination_plate.wells():
        destination_wells.append(well)
    # Create a list of wells where samples should go
    sample_wells = destination_wells[:number_of_samples*replicates]
    
    #Create a list of wells where standard sample replicates should go
    slice_std_sample_wells = slice(
        (number_of_samples * replicates), (number_of_samples * replicates)+ number_of_std_samples)
    std_sample_wells = destination_wells[slice_std_sample_wells]
      ## Slice the list after the number of samples, and after the number
      ## of standard sample replicates to retrieve the wells in between
    
    # Create the list of wells where NTCs should go
    slice_NTC_wells = slice(
        (number_of_samples * replicates)+ number_of_std_samples,
        (number_of_samples * replicates)+ number_of_std_samples + number_of_NTCs)
    NTC_wells = destination_wells[slice_NTC_wells]
      ## Slice the list after the number of samples + the number of standard
      ## sample replicates, and after that + the number of NTCs to retrieve
      ## the wells in between (the last of the wells that need to be filled)
    
    # Create the list of wells where standerd series should go
    std_series_wells = [] 
    std_series_columns = (
        [destination_plate.columns_by_name()[column_name] for column_name in
         ['12', '11', '10']])
    std_series_columns = std_series_columns[:number_of_std_series]
    ## Reserve a column at the end of the plate for every std_series        
    ## Separate the columns into wells and append them to list              
    for column in std_series_columns:
        column = column[:length_std_series]
        ## cut off the columns after a certain std_series length            
        for well in column:
            std_series_wells.append(well)
    
    # Create a list with wells where mastermix should go
    MasterMixAliquots = (
        sample_wells + std_sample_wells + NTC_wells + std_series_wells)
    
    if redo:
        ## This is the part of the protocol that accesses the specific
        ## sample wells specified in the variables to set
        ## NOTE: this only works for 96wells plate, when you need to redo 
        ## samples with other labware you can rearrange the order of tubes
        sample_sources = []
        wells_sample_source_1 = (
            [sample_source_1.wells_by_name()[well_name] for well_name in
            samples_sample_source_1])
        for well in wells_sample_source_1:
            sample_sources.append(well)
        wells_sample_source_2 = (
            [sample_source_2.wells_by_name()[well_name] for well_name in
            samples_sample_source_2])
        for well in wells_sample_source_2:
            sample_sources.append(well)
        wells_sample_source_3 = (
            [sample_source_3.wells_by_name()[well_name] for well_name in
            samples_sample_source_3])
        for well in wells_sample_source_3:
            sample_sources.append(well)
        wells_sample_source_4 = (
            [sample_source_4.wells_by_name()[well_name] for well_name in
            samples_sample_source_4])
        for well in wells_sample_source_4:
            sample_sources.append(well)
        
    else: 
        ## This is the part of the protocol that access the sample wells in
        ## a normal PCR (where you don't need to access specific wells)
        sample_source_wells = []
        sample_source_wells_string = []
          ## The string list is needed to be able to start at another well
        if sample_tube_type == 'tube_1.5mL' or sample_tube_type == 'plate_96':
            if sample_racks >= 1:
                for well in sample_source_1.wells():
                    sample_source_wells.append(well)
                    sample_source_wells_string.append(str(well))
            if sample_racks >= 2:
                for well in sample_source_2.wells():
                    sample_source_wells.append(well)
                    sample_source_wells_string.append(str(well))
            if sample_racks >= 3:
                for well in sample_source_3.wells():
                    sample_source_wells.append(well)
                    sample_source_wells_string.append(str(well))
            if sample_racks >= 4:
                for well in sample_source_4.wells():
                    sample_source_wells.append(well)
                    sample_source_wells_string.append(str(well))

        if sample_tube_type == 'PCR_strip':
            sample_source_columns = (
                    ([sample_source_1.columns_by_name()[column_name] 
                      for column_name in sample_columns]))
            if sample_racks >= 2:
                sample_columns_2 = (
                    ([sample_source_2.columns_by_name()[column_name] 
                      for column_name in sample_columns]))
                for column in sample_columns_2:
                    sample_source_columns.append(column)
            if sample_racks >= 3:
                sample_columns_3 = (
                    ([sample_source_3.columns_by_name()[column_name] 
                      for column_name in sample_columns]))
                for column in sample_columns_3:
                    sample_source_columns.append(column)
            if sample_racks >= 4:
                sample_columns_4 = (
                    ([sample_source_4.columns_by_name()[column_name] 
                      for column_name in sample_columns]))
                for column in sample_columns_4:
                    sample_source_columns.append(column)
              ## Make a list of columns, this is a list of lists!   
            for column in sample_source_columns:
                for well in column:
                    sample_source_wells.append(well)
                    sample_source_wells_string.append(str(well))
              ## Separate the columns into wells and append them to list 

        ## Cut slice out off list of sample_sources, starting with the 
        ## indicated first sample and ending after the number_of_samples                        
        first_sample_index = sample_source_wells_string.index(
            first_sample + ' of sample_source_1 on 2')
          ## Determine the index of the first sample in the list made from 
          ## strings -- we cannot find strings in the normal robot list
          ## so we needed to convert the wells to strings.
        slice_sample_sources = slice(
            first_sample_index, 
            first_sample_index + number_of_samples)
          ## Determine the slice

        ## Determine position of the std_sample
        slice_std_sample = slice(
            first_sample_index + number_of_samples,
            first_sample_index + number_of_samples + 1)
        ## If you have a std sample included, this will be added as the last sample  
        std_source = sample_source_wells[slice_std_sample] * number_of_std_samples
          ## Makes a list of len number_of_std_samples of the std_source well
        
        ## Cut sample slice out of sample_source_wells list
        sample_sources = sample_source_wells[slice_sample_sources]
        ## If replicates are desired, this copies the sample_sources list
        sample_sources = sample_sources * replicates
       
        ## If you have a std sample included, this will add the std_samples 
        ## to the end of the sample_sources list
        sample_sources = sample_sources + std_source
# =============================================================================              

              
## PIPETTING===================================================================
## ============================================================================
## LIGHTS----------------------------------------------------------------------
    if qPCR:
        protocol.set_rail_lights(False)
    if not qPCR:
        protocol.set_rail_lights(True)
## ----------------------------------------------------------------------------
## ALIQUOTING MASTERMIX--------------------------------------------------------
    if dispension_vol >= 19:
        pipette = p300
    else:
        pipette = p20
    for i, well in enumerate(MasterMixAliquots):
      ## aliquot mix, for each well do the following:                       
        if i == 0: 
            pipette.pick_up_tip()
              ## If we are at the first well, start by picking up a tip.    
        elif i % 8 == 0:
            pipette.drop_tip()
            pipette.pick_up_tip()
              ## Then, after every 8th well, drop tip and pick up new       
    
        current_height, pip_height, bottom_reached = vt.volume_tracking(
                mastermix_tube_type, dispension_vol, current_height)
                  ## call volume_tracking function, obtain current_height,  
                  ## pip_height and whether bottom_reached.                 
        
        if bottom_reached:
            aspiration_location = MasterMix.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
              ## If bottom is reached keep pipetting from bottom + 1        
        else:
            aspiration_location = MasterMix.bottom(pip_height)
              ## Set the location of where to aspirate from.                

        #### The actual aliquoting of mastermix                             
        pipette.aspirate(aspiration_vol, aspiration_location)
          ## Aspirate the amount specified in aspiration_vol from the       
          ## location specified in aspiration_location.                     
        pipette.dispense(dispension_vol, well)
          ## Dispense the amount specified in dispension_vol to the         
          ## location specified in well (so a new well every time the       
          ## loop restarts)                                                 
        pipette.dispense(10, aspiration_location)
          ## Alternative for blow-out, make sure the tip doesn't fill      
          ## completely when using a disposal volume by dispensing some     
          ## of the volume after each pipetting step. (blow-out to many     
          ## bubbles)                                                       
    pipette.drop_tip()   
## ----------------------------------------------------------------------------
## ADDING SAMPLES--------------------------------------------------------------
    ## Loop through source and destination wells
    for sample_tube, well in zip(sample_sources, destination_plate.wells()):
        p20.pick_up_tip()
        p20.aspirate(sample_vol, sample_tube)
        p20.dispense(sample_vol, well)
        sample_mix_vol = sample_vol + 3
          ## primer_mix_vol = volume for pipetting up and down              
        p20.mix(3, sample_mix_vol, well)
        p20.dispense(10, well)
        p20.drop_tip()
# ----------------------------------------------------------------------------
## LIGHTS----------------------------------------------------------------------
    if not qPCR:
        protocol.set_rail_lights(False)
# ----------------------------------------------------------------------------
# =============================================================================
def run(protocol: protocol_api.ProtocolContext):
    """
    Adding samples from 1.5 mL tubes to PCR_strips.
    different DNA volumes + water to add up
    """
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================
    ## For available labware see "labware/list_of_available_labware".       ##

    #pipette tips
    tips_20_1 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        3,  #deck position
        '20tips_1')  #custom name
    tips_20_2 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        6,  #deck position
        '20tips_2')  #custom name

    # Tube_racks & plates
    sample_tubes_1 = protocol.load_labware(
        'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labware def
        1,  #deck position
        'sample_tubes_1')  #custom name
    if sample_racks >= 2:
        sample_tubes_2 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labw def
            4,  #deck pos
            'sample_tubes_2')  #cust name
    if sample_racks >= 3:
        sample_tubes_3 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labw def
            7,  #deck pos
            'sample_tubes_3')  #cust name
    if sample_racks >= 4:
        sample_tubes_4 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labw def
            10,  #deck pos
            'sample_tubes_4')  #cust name

    if PCR_tubes == 'PCR_strips':
        ### !!! OPTION 1: ROBOT
        # PCR_1 = protocol.load_labware(
        #  'pcrstrips_96_wellplate_200ul',    #labware definition
        #  2,                                 #deck position
        #  'PCR_tube_1')                      #custom name
        # if PCR_racks >= 2:
        #    PCR_2 = protocol.load_labware(
        #          'pcrstrips_96_wellplate_200ul',    #labware definition
        #          5,                                 #deck position
        #          'PCR_tube_2')                      #custom name
        # if PCR_racks >= 3:
        #    PCR_3 = protocol.load_labware(
        #          'pcrstrips_96_wellplate_200ul',    #labware definition
        #          8,                                 #deck position
        #          'PCR_tube_3')                      #custom name
        # if PCR_racks == 4:
        #    PCR_4 = protocol.load_labware(
        #          'pcrstrips_96_wellplate_200ul',    #labware definition
        #          11,                                #deck position
        #          'PCR_tube_3')                      #custom name

        ##### !!! OPTION 2: SIMULATOR
        with open("labware/pcrstrips_96_wellplate_200ul/"
                  "pcrstrips_96_wellplate_200ul.json") as labware_file:
            labware_def_pcrstrips = json.load(labware_file)
        PCR_1 = protocol.load_labware_from_definition(
            labware_def_pcrstrips,  #variable derived from opening json
            2,  #deck position
            'PCR_tube_1')  #custom name
        if PCR_racks >= 2:
            PCR_2 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                5,  #deck position
                'PCR_tube_2')  #custom name
        if PCR_racks >= 3:
            PCR_3 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                8,  #deck position
                'PCR_tube_2')  #custom name
        if PCR_racks == 4:
            PCR_4 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                11,  #deck position
                'PCR_tube_4')  #custom name

    if PCR_tubes == 'plate_96':
        #### !!! OPTION 1: ROBOT
        # PCR_1 = protocol.load_labware(
        #     'biorad_qpcr_plate_eppendorf_cool_rack',#labware definition
        #     2,                                      #deck position
        #     '96well_plate_rack')                    #custom name
        ##### !!! OPTION 2: SIMULATOR
        with open(
                "labware/biorad_qpcr_plate_eppendorf_cool_rack/"
                "biorad_qpcr_plate_eppendorf_cool_rack.json") as labware_file:
            labware_def_cool_rack = json.load(labware_file)
        PCR_1 = protocol.load_labware_from_definition(
            labware_def_cool_rack,  #variable derived from opening json
            2,  #deck position
            '96well_plate_rack')  #custom name

    # Pipettes
    p20 = protocol.load_instrument(
        'p20_single_gen2',  #instrument definition
        'left',  #mount position
        tip_racks=[tips_20_1, tips_20_2])  #assigned tiprack

    # =============================================================================

    # PREDIFINED VARIABLES=========================================================
    # =============================================================================
    p20.starting_tip = tips_20_1.well(starting_tip_p20)
    ## The starting_tip is the location of first pipette tip in the box   ##

    # Sample source wells
    sample_sources = []
    ## Create an empty list to append wells to.                           ##
    sample_sources = sample_tubes_1.wells()
    if sample_racks >= 2:
        sample_sources = sample_sources + sample_tubes_2.wells()
    if sample_racks >= 3:
        sample_sources = sample_sources + sample_tubes_3.wells()
    if sample_racks >= 4:
        sample_sources = sample_sources + sample_tubes_4.wells()
    water_tube = sample_sources[-1]
    sample_sources = sample_sources[:number_of_samples]

    # Destination wells
    sample_destinations = []
    ## Create an empty list to append wells to.                           ##
    if PCR_tubes == 'plate_96':
        sample_destinations = PCR_1.wells()
    elif PCR_tubes == 'PCR_strips':
        PCR_columns = (([
            PCR_1.columns_by_name()[column_name]
            for column_name in strip_positions
        ]))
        if PCR_racks >= 2:
            PCR_columns_2 = (([
                PCR_2.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            PCR_columns = PCR_columns + PCR_columns_2
        if PCR_racks >= 3:
            PCR_columns_3 = (([
                PCR_3.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            PCR_columns = PCR_columns + PCR_columns_3
        if PCR_racks >= 4:
            PCR_columns_4 = (([
                PCR_4.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            PCR_columns = PCR_columns + PCR_columns_4
        for column in PCR_columns:
            for well in column:
                sample_destinations.append(well)

    sample_destinations = sample_destinations[:number_of_samples + 1]

    # ADDING SAMPLES AND WATER=====================================================
    # =============================================================================
    ## Loop through source and destination wells
    for sample_tube, well, sample_vol in zip(sample_sources,
                                             sample_destinations, DNA_µL_list):
        p20.pick_up_tip()
        p20.aspirate(sample_vol, sample_tube)
        p20.dispense(sample_vol, well)
        sample_mix_vol = sample_vol + 3
        ## primer_mix_vol = volume for pipetting up and down              ##
        p20.mix(3, sample_mix_vol, well)
        p20.dispense(10, well)
        p20.drop_tip()

        water_vol = max_DNA_volume - sample_vol
        ## volume of water needed to add a total of 5µL
        if water_vol > 0:
            p20.pick_up_tip()
            p20.aspirate(water_vol, water_tube)
            p20.dispense(water_vol, well)
            sample_mix_vol = water_vol + 3
            ## primer_mix_vol = volume for pipetting up and down              ##
            p20.mix(3, sample_mix_vol, well)
            p20.dispense(10, well)
            p20.drop_tip()

    ## Add water to NTC
    water_vol = 5
    well = sample_destinations[-1]
    p20.pick_up_tip()
    p20.aspirate(water_vol, water_tube)
    p20.dispense(water_vol, well)
    sample_mix_vol = sample_vol + 3
    ## primer_mix_vol = volume for pipetting up and down              ##
    p20.mix(3, sample_mix_vol, well)
    p20.dispense(10, well)
    p20.drop_tip()
Example #9
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix from a 1.5 or 5 mL tube to a 96 wells plate or 
    tube strips that already contain sample.
    Mix by pipetting up and down.
    """
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================

    # pipette tips
    if MM_dispension_vol > 17:
        tips_1 = protocol.load_labware(
            'opentrons_96_filtertiprack_200ul',  #labware definition
            7,  #deck position
            '200tips_1')  #custom name
        tips_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_200ul',  #labware definition
            10,  #deck position
            '200tips_2')  #custom name

    else:
        tips_1 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  #labware definition
            7,  #deck position
            '20tips_1')  #custom name
        tips_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  #labware definition
            10,  #deck position
            '20tips_2')  #custom name

    # tube racks
    if sample_tubes == 'plate_96':
        samples_1 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            1,  #deck position
            'samples_plate')  #custom name

    if sample_tubes == 'PCR_strips':
        ##### !!! OPTION 1: ROBOT
        # samples_1 = protocol.load_labware(
        # 'pcrstrips_96_wellplate_200ul',         #labware definition
        # 1,                                      #deck position
        # 'sample_strips_1')                      #custom name
        # if sample_racks >= 2:
        #     samples_2 = protocol.load_labware(
        #         'pcrstrips_96_wellplate_200ul', #labware definition
        #         2,                              #deck position
        #         'sample_strips_2')              #custom name
        # if sample_racks >= 3:
        #     samples_3 = protocol.load_labware(
        #         'pcrstrips_96_wellplate_200ul', #labware definition
        #         3,                              #deck position
        #         'sample_strips_3')              #custom name
        ##### !!! OPTION 2: SIMULATOR
        with open("labware/pcrstrips_96_wellplate_200ul/"
                  "pcrstrips_96_wellplate_200ul.json") as labware_file:
            labware_def_pcrstrips = json.load(labware_file)
        samples_1 = protocol.load_labware_from_definition(
            labware_def_pcrstrips,  #variable derived from json
            1,  #deck position
            'sample_strips_1')  #custom name
        if sample_racks >= 2:
            samples_2 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from json
                2,  #deck position
                'sample_strips_2')  #custom name
        if sample_racks >= 3:
            samples_3 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from json
                3,  #deck position
                'sample_strips_3')  #custom name

    if MM_tube == 'tube_1.5mL':
        MM = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labw def
            4,  #deck pos
            'MM_1.5mL')  #custname
    if MM_tube == 'tube_5mL':
        ##### !!! OPTION 1: ROBOT
        # MM = protocol.load_labware(
        #     'eppendorfscrewcap_15_tuberack_5000ul',     #labware def
        #     4,                                          #deck position
        #     'mastermix_tube')                           #custom name
        ##### !!! OPTION 2: SIMULATOR
        with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
                  "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
            labware_def_5mL = json.load(labware_file)
        MM = protocol.load_labware_from_definition(
            labware_def_5mL,  #variable derived from json
            4,  #deck position
            'mastermix_tube')  #custom name

    # Pipettes
    if MM_dispension_vol > 17:
        pipette = protocol.load_instrument(
            'p300_single_gen2',  #instrument definition
            'right',  #mount position
            tip_racks=[tips_1, tips_2])  #assigned tiprack
    else:
        pipette = protocol.load_instrument(
            'p20_single_gen2',  #instrument definition
            'left',  #mount position
            tip_racks=[tips_1, tips_2])  #assigned tiprack
# =============================================================================

# SETTING LOCATIONS============================================================
# =============================================================================
##### Setting starting tip                                              ##
    pipette.starting_tip = tips_1.well(starting_tip)
    ## The starting_tip is the location of first pipettetip in the first box##

    ##### Tube locations                                                    ##
    MasterMix = MM[MM_well]
    ## Location of the tube with mastermix                                ##

    destination_wells = []
    ## Where should mastermix go                                          ##
    if sample_tubes == 'plate_96':
        destination_wells = samples_1.wells()

    elif sample_tubes == 'PCR_strips':
        sample_columns = (([
            samples_1.columns_by_name()[column_name]
            for column_name in strip_positions
        ]))
        if sample_racks >= 2:
            sample_columns_2 = (([
                samples_2.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            sample_columns = sample_columns + sample_columns_2
        if sample_racks >= 3:
            sample_columns_3 = (([
                samples_3.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            sample_columns = sample_columns + sample_columns_3
        for column in sample_columns:
            for well in column:
                destination_wells.append(well)

    destination_wells = destination_wells[:number_of_samples]
    ## cuts off the list after a certain number of wells                  ##
    # =============================================================================

    # VARIABLES FOR VOLUME TRACKING================================================
    # =============================================================================
    start_height = vt.cal_start_height(MM_tube, MM_start_vol)
    ## Call start height calculation function from volume tracking module.##
    if MM_start_vol < 500:
        start_height = start_height - 8
    ## start_height is not so good for small amounts
    current_height = start_height
    ## Set the current height to start height at the beginning of the     ##
    ## protocol.                                                          ##
    # =============================================================================

    ## ALIQUOTING MASTERMIX========================================================
    ## ============================================================================
    for i, well in enumerate(destination_wells):
        ## For each destination_well do the following:                        ##

        ##### volume tracking                                               ##
        current_height, pip_height, bottom_reached = vt.volume_tracking(
            MM_tube, MM_dispension_vol, current_height)
        ## call volume_tracking function, obtain current_height,        ##
        ## pip_height and whether bottom_reached.                       ##

        # What to do if bottom_reached                                      ##
        if bottom_reached:
            aspiration_location = MasterMix.bottom()
            protocol.comment("You've reached the bottom of the tube!")
            ## If bottom is reached keep pipetting from bottom            ##
        else:
            aspiration_location = MasterMix.bottom(pip_height)
            ## Set the location of where to aspirate from.                ##

        ##### The actual aliquoting of mastermix                            ##
        pipette.pick_up_tip()
        ## Pick up a new tip for every sample
        pipette.aspirate(MM_dispension_vol, aspiration_location)
        ## Aspirate the specified volume, from the specified location     ##
        pipette.dispense(MM_dispension_vol, well)
        ## Dispense the specified volume to the location specified in     ##
        ## well (so a new well every time the loop restarts)              ##
        pipette.mix(3, mix_vol, well)
        ## Mix by pipetting up and down 3x with the specified volume + 3  ##
        pipette.dispense(10, well)
        ## Alternative for blow_out                                       ##
        pipette.drop_tip()
        ## Drop tip in trash                                              ##


# =============================================================================
Example #10
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Dilute samples in a fixed or varying rates 
    or transfer samples to different tubes.
    """
# =============================================================================


# LOADING LABWARE AND PIPETTES=================================================
# =============================================================================
    ##### Loading pipettes and tips    
    tips_20 = []
    tips_200 = []
    
    if tips_20_needed > 0:
        tips_20_1 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',      
            11,                                     
            'tips_20_1')
        tips_20.append(tips_20_1)
        tips_20_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',      
            10,                                     
            'tips_20_2')
        tips_20.append(tips_20_2)
        if tips_20_needed > 96:
            tips_20_3 = protocol.load_labware(
                'opentrons_96_filtertiprack_20ul',      
                7,                                      
                'tips_20_3')
            tips_20.append(tips_20_3)
            if tips_20_needed > 192:
                tips_20_4 = protocol.load_labware(
                'opentrons_96_filtertiprack_20ul',      
                8,                                      
                'tips_20_4')
                tips_20.append(tips_20_4)
            elif tips_200_needed > 0:
                tips_200_1 = protocol.load_labware(
                    'opentrons_96_filtertiprack_200ul',      
                    8,                                     
                    'tips_200_1')
                tips_200.append(tips_200_1)
        elif tips_200_needed > 0:
            tips_200_1 = protocol.load_labware(
                'opentrons_96_filtertiprack_200ul',      
                7,                                     
                'tips_200_1')
            tips_200.append(tips_200_1)
            tips_200_2 = protocol.load_labware(
                'opentrons_96_filtertiprack_200ul',      
                8,                                     
                'tips_200_2')
            tips_200.append(tips_200_2)
            
    
    else:
        tips_200_1 = protocol.load_labware(
            'opentrons_96_filtertiprack_200ul',      
            11,                                     
            'tips_200_1')
        tips_200.append(tips_200_1)
        tips_200_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_200ul',      
            10,                                     
            'tips_200_2')
        tips_200.append(tips_200_2)
        if tips_200_needed > 96:
            tips_200_3 = protocol.load_labware(
                'opentrons_96_filtertiprack_200ul',      
                7,                                      
                'tips_200_3')
            tips_200.append(tips_200_3)
            if tips_200_needed > 192:
                tips_200_4 = protocol.load_labware(
                    'opentrons_96_filtertiprack_200ul',      
                    8,                                      
                    'tips_200_4')
                tips_200.append(tips_200_4)
    
    
    
    ##### Loading pipettes
    if tips_20_needed > 0:
        p20 = protocol.load_instrument(
            'p20_single_gen2',
            'left',
            tip_racks = tips_20)
    if tips_200_needed > 0:
        p300 = protocol.load_instrument(
            'p300_single_gen2',
            'right',
            tip_racks = tips_200)

    
    ##### Loading labware 
    if sample_tubes == 'plate_96':
        if sample_racks >= 1:            
            sample_source_1 = protocol.load_labware(
                'biorad_96_wellplate_200ul_pcr',
                1,
                'sample_source_1')
        if sample_racks >= 2:          
            sample_source_2 = protocol.load_labware(
                'biorad_96_wellplate_200ul_pcr',
                4,
                'sample_source_2')
        if sample_racks >= 3:
            sample_source_3 = protocol.load_labware(
                'biorad_96_wellplate_200ul_pcr',
                2,
                'sample_source_3')
    if sample_tubes == 'tubes_1.5mL':
        if sample_racks >= 1:
            sample_source_1 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                1,
                'sample_source_1')
        if sample_racks >= 2:    
            sample_source_2 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                2,
                'sample_source_2')
        if sample_racks >= 3:    
            sample_source_3 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                4,
                'sample_source_3')
        if sample_racks >= 4:
            sample_source_4 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                5,
                'sample_source_4')
         
    if dilution_tubes == 'plate_96':
        if dilution_racks >= 1:        
            dilution_dest_1 = protocol.load_labware(
                'biorad_96_wellplate_200ul_pcr',
                6,
                'dilution_dest_1')
        if dilution_racks >= 2:            
            dilution_dest_2 = protocol.load_labware(
                'biorad_96_wellplate_200ul_pcr',
                3,
                'dilution_dest_2')
        if dilution_racks >= 3:             
            dilution_dest_3 = protocol.load_labware(
                'biorad_96_wellplate_200ul_pcr',
                5,
                'dilution_dest_3')
    if dilution_tubes == 'tubes_1.5mL':
        if dilution_racks >= 1:
            dilution_dest_1 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                6,                                      
                'dilution_dest_1')                      
        if dilution_racks >= 2:    
            dilution_dest_2 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                3,                                      
                'dilution_dest_2')                      
        if dilution_racks >= 3:    
            dilution_dest_3 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                5,                                      
                'dilution_dest_3')                      
        if dilution_racks >= 4:
            dilution_dest_4 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                2,                                      
                'dilution_dest_4')                      

    if simulate:
        with open("labware/pcrstrips_96_wellplate_200ul/"
                  "pcrstrips_96_wellplate_200ul.json") as labware_file:
                labware_def_pcrstrips = json.load(labware_file)
        if sample_tubes == 'PCR_strips':
            if sample_racks >= 1:
                sample_source_1 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    1,                     
                    'sample_source_1')     
            if sample_racks >= 2:
                sample_source_2 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    4,                     
                    'sample_source_2')     
            if sample_racks >= 3:
                sample_source_3 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    2,                     
                    'sample_source_3')     
            if sample_racks >= 4:
                sample_source_4 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    5,                     
                    'sample_source_4')     
        if dilution_tubes == 'PCR_strips':
            if dilution_racks >= 1:
                dilution_dest_1 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    3,                     
                    'dilution_dest_1')     
            if dilution_racks >= 2:
                dilution_dest_2 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    6,                     
                    'dilution_dest_2')     
            if dilution_racks >= 3:
                dilution_dest_3 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    5,                     
                    'dilution_dest_3')     
            if dilution_racks >= 4:
                dilution_dest_4 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    2,                     
                    'dilution_dest_4')       
        with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
                  "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
                labware_def_5mL = json.load(labware_file)
        tubes_5mL = protocol.load_labware_from_definition( 
            labware_def_5mL, 
            9, 
            '5mL_tubes')    
    else:
        if sample_tubes == 'PCR_strips':
            if sample_racks >= 1:
                sample_source_1 = protocol.load_labware(
                    'pcrstrips_96_wellplate_200ul',         
                    1,                                      
                    'sample_source_1')                      
            if sample_racks >= 2:
                sample_source_2 = protocol.load_labwware(
                    'pcrstrips_96_wellplate_200ul',         
                    4,                                      
                    'sample_source_2')                      
            if sample_racks >= 3:   
                sample_source_3 = protocol.load_labwware(
                    'pcrstrips_96_wellplate_200ul',         
                    2,                                      
                    'sample_source_3')                      
            if sample_racks >= 4: 
                sample_source_4 = protocol.load_labwware(
                    'pcrstrips_96_wellplate_200ul',         
                    5,                                      
                    'sample_source_4')                      
        if dilution_tubes == 'PCR_strips':
            if dilution_racks >= 1:
                dilution_dest_1 = protocol.load_labware(
                    'pcrstrips_96_wellplate_200ul',         
                    3,                                      
                    'dilution_dest_1')                      
            if dilution_racks >= 2:
                dilution_dest_2 = protocol.load_labwware(
                    'pcrstrips_96_wellplate_200ul',         
                    6,                                      
                    'dilution_dest_2')                      
            if dilution_racks >= 3:    
                dilution_dest_3 = protocol.load_labwware(
                    'pcrstrips_96_wellplate_200ul',         
                    5,                                      
                    'dilution_dest_3')                      
            if dilution_racks >= 4:        
                dilution_dest_4 = protocol.load_labwware(
                    'pcrstrips_96_wellplate_200ul',         
                    2,                                      
                    'dilution_dest_4')                          
        tubes_5mL = protocol.load_labware(
            'eppendorfscrewcap_15_tuberack_5000ul',     
            9,                                          
            'tubes_5mL')                                    
    
          
    

    ##### MB: I think this can be removed... but not completely sure because I
        #don't know why it was her ein the first place.
    # # Setting sample_source
    # if sample_racks == 1: 
    #     sample_source_1 = sample_source_1 
    # elif sample_racks == 2:
    #     sample_source_1 = sample_source_1
    #     sample_source_2 = sample_source_2
    # elif sample_racks == 3:
    #     sample_source_1 = sample_source_1
    #     sample_source_2 = sample_source_2
    #     sample_source_3 = sample_source_3
    # elif sample_racks == 4:
    #     sample_source_1 = sample_source_1
    #     sample_source_2 = sample_source_2
    #     sample_source_3 = sample_source_3
    #     sample_source_4 = sample_source_4

    # # Setting dilution_dest
    # if dilution_racks == 1:
    #     dilution_dest_1 = dilution_dest_1   
    # elif dilution_racks == 2:
    #     dilution_dest_1 = dilution_dest_1
    #     dilution_dest_2 = dilution_dest_2
    # elif dilution_racks == 3:
    #     dilution_dest_1 = dilution_dest_1
    #     dilution_dest_2 = dilution_dest_2
    #     dilution_dest_3 = dilution_dest_3
    # elif dilution_racks == 4:
    #     dilution_dest_1 = dilution_dest_1
    #     dilution_dest_2 = dilution_dest_2
    #     dilution_dest_3 = dilution_dest_3
    #     dilution_dest_4 = dilution_dest_4
# =============================================================================

# SETTING LOCATIONS#!!!========================================================
# =============================================================================
    ##### Setting starting tip
    if tips_20_needed > 0:
        p20.starting_tip = tips_20_1.well(starting_tip_p20)
    if tips_200_needed > 0:
        p300.starting_tip = tips_200_1.well(starting_tip_p200)
      ## The starting_tip is the location of first pipette tip in the box   ##
      
    ##### Setting tube locations
   
    sample_wells = []
    if sample_tubes == 'PCR_strips':
        columns_odd = ['1','3','5','7','9','11']
        sample_columns = []
        if sample_racks >= 1:
            sample_columns_1 = (                                                           
                ([sample_source_1.columns_by_name()[column_name] 
                  for column_name in columns_odd])) 
            for column in sample_columns_1:
                sample_columns.append(column)
        if sample_racks >= 2:
            sample_columns_2 = ( 
                ([sample_source_2.columns_by_name()[column_name] 
                  for column_name in columns_odd]))
            for column in sample_columns_2:
                sample_columns.append(column)
        if sample_racks >= 3:
            sample_columns_3 = ( 
                ([sample_source_3.columns_by_name()[column_name] 
                  for column_name in columns_odd]))
            for column in sample_columns_3:
                sample_columns.append(column)
        if sample_racks >= 4:
            sample_columns_4 = ( 
                ([sample_source_4.columns_by_name()[column_name] 
                  for column_name in columns_odd]))
            for column in sample_columns_4:
                sample_columns.append(column)
        for column in sample_columns:
            for well in column:
                sample_wells.append(well)
         ##makes a list of all wells in 1,2,3 or 4 full plates of PCR strips##
    else:
        if sample_racks == 1: 
            for well in sample_source_1.wells():
                sample_wells.append(well)
        if sample_racks == 2:
            for well in sample_source_1.wells():
                sample_wells.append(well)
            for well in sample_source_2.wells():
                sample_wells.append(well)
        if sample_racks == 3:
            for well in sample_source_1.wells():
                sample_wells.append(well)
            for well in sample_source_2.wells():
                sample_wells.append(well)
            for well in sample_source_3.wells():
                sample_wells.append(well)
        if sample_racks == 4:
            for well in sample_source_1.wells():
                sample_wells.append(well)
            for well in sample_source_2.wells():
                sample_wells.append(well)
            for well in sample_source_3.wells():
                sample_wells.append(well)
            for well in sample_source_4.wells():
                sample_wells.append(well)
              
    dilution_wells = []
    if dilution_tubes == 'PCR_strips':
        columns_odd = ['1','3','5','7','9','11']
        dilution_columns = []
        if dilution_racks >= 1:
            dilution_columns_1 = (                                                           
                ([dilution_dest_1.columns_by_name()[column_name] 
                  for column_name in columns_odd])) 
            for column in dilution_columns_1:
                dilution_columns.append(column)
        if dilution_racks >= 2:
            dilution_columns_2 = ( 
                ([dilution_dest_2.columns_by_name()[column_name] 
                  for column_name in columns_odd]))
            for column in dilution_columns_2:
                dilution_columns.append(column)
        if dilution_racks >= 3:
            dilution_columns_3 = ( 
                ([dilution_dest_3.columns_by_name()[column_name] 
                  for column_name in columns_odd]))
            for column in dilution_columns_3:
                dilution_columns.append(column)
        if dilution_racks >= 4:
            dilution_columns_4 = ( 
                ([dilution_dest_4.columns_by_name()[column_name] 
                  for column_name in columns_odd]))
            for column in dilution_columns_4:
                dilution_columns.append(column)
        for column in dilution_columns:
            for well in column:
                dilution_wells.append(well)
         ##makes a list of all wells in 1,2,3 or 4 full plates of PCR strips## 
    else:
        if dilution_racks == 1: 
            for well in dilution_dest_1.wells():
                dilution_wells.append(well)
        if dilution_racks == 2:
            for well in dilution_dest_1.wells():
                dilution_wells.append(well)
            for well in dilution_dest_2.wells():
                dilution_wells.append(well)
        if dilution_racks == 3:
            for well in dilution_dest_1.wells():
                dilution_wells.append(well)
            for well in dilution_dest_2.wells():
                dilution_wells.append(well)
            for well in dilution_dest_3.wells():
                dilution_wells.append(well)
        if dilution_racks == 4:
            for well in dilution_dest_1.wells():
                dilution_wells.append(well)
            for well in dilution_dest_2.wells():
                dilution_wells.append(well)
            for well in dilution_dest_3.wells():
                dilution_wells.append(well)
            for well in dilution_dest_4.wells():
                dilution_wells.append(well)
            
    sample_wells = sample_wells[:number_of_samples]
    dilution_wells = dilution_wells[:number_of_samples]
    ## cuts off the list after certain number of samples                    ##
# =============================================================================

# MESSAGE AT THE START=========================================================
# =============================================================================
    if len([x for x in water_volumes if x > 0]) > 0:
        protocol.pause("I need "+ str(water_tubes) + " tube(s) with 5mL of water.")
# =============================================================================

# ALIQUOTING WATER=============================================================    
# =============================================================================
    ##### Variables for volume tracking and aliquoting
    if len([x for x in water_volumes if x > 0]) > 0:
        counter = 0 # to count how many tubes already emptied
        source = tubes_5mL.wells()[counter]
        destination = dilution_wells
        container = 'tube_5mL'
        start_height = vt.cal_start_height(container, 4800)
        current_height = start_height
              
        for i, (well, water_vol) in enumerate(zip(destination, water_volumes)):
          ## aliquot water in the correct wells, for each well do the following:  
            
            if water_vol > 0:
                dispension_vol = water_vol
                aspiration_vol = dispension_vol + (dispension_vol/100*2)
    
                if i == 0:
                    if len([x for x in water_volumes[i:i+15] if x < 20]) > 0:
                        p20.pick_up_tip()
                    if len([x for x in water_volumes[i:i+15] if x >= 20]) > 0:
                        p300.pick_up_tip()
                      ## If we are at the first well, start by picking up a tip
                elif i % 16 == 0:
                    try:
                        p20.drop_tip()
                    except:
                        pass
                    try:
                        p300.drop_tip()
                    except:
                        pass
                      ## Then, after every 16th well, try to drop tip
                    
                    if len([x for x in water_volumes[i:i+15] if x < 20]) > 0:
                        p20.pick_up_tip()
                    if len([x for x in water_volumes[i:i+15] if x >= 20]) > 0:
                        p300.pick_up_tip()                    
                      ## Pick up new tip if needed in next 16                    
                        
                current_height, pip_height, bottom_reached = vt.volume_tracking(
                    container, dispension_vol, current_height)
                      ## call volume_tracking function, obtain current_height,     
                      ## pip_height and whether bottom_reached.                    
                
                if bottom_reached:
                  ## continue with next tube, reset vt                            
                    current_height = start_height
                    current_height, pip_height, bottom_reached = (
                        vt.volume_tracking(
                            container, dispension_vol, current_height))
                    counter = counter + 1
                    source = tubes_5mL.wells()[counter]
                    aspiration_location = source.bottom(current_height)
                    protocol.comment(
                        "Continue with tube " + str(counter + 1) + " of water")
                else:
                    aspiration_location = source.bottom(pip_height)
                      ## Set the location of where to aspirate from.
    
                if aspiration_vol > 20:
                    water_pipette = p300
                else:
                    water_pipette = p20
                  ## What pipette to use
        
                #### The actual aliquoting of water
                water_pipette.aspirate(aspiration_vol, aspiration_location)
                  ## Aspirate the amount specified in aspiration_vol from the
                  ## location specified in aspiration_location.
                water_pipette.dispense(dispension_vol, well)
                  ## Dispense the amount specified in dispension_vol to the
                  ## location specified in well (looping through plate)
                water_pipette.dispense(10, aspiration_location)
                  ## Alternative for blow-out, make sure the tip doesn't fill
                  ## completely when using a disposal volume by dispensing some
                  ## of the volume after each pipetting step. (blow-out too many
                  ## bubbles)
        try: 
            p20.drop_tip()
        except:
            pass
        try:
            p300.drop_tip()
        except:
            pass
          ## when entire plate is full, try to drop tip  
# =============================================================================

# DILUTING SAMPLES=============================================================
# =============================================================================
    for sample_well, dilution_well, sample_vol, water_vol in zip(
            sample_wells, dilution_wells, sample_volumes, water_volumes):
        ## Combine each sample with a dilution_well and a destination well  ##
        if sample_vol > 17:
            sample_pipette = p300
        else:
            sample_pipette = p20
        sample_pipette.pick_up_tip()
          ## p20 picks up tip from location of specified starting_tip       ##
          ## or following                                                   ##
        sample_pipette.aspirate(sample_vol, sample_well)
          ## aspirate sample_volume_dil = volume for dilution from sample   ##
        sample_pipette.dispense(sample_vol, dilution_well)
          ## dispense sample_volume_dil = volume for dilution into dil_well ##
        if water_vol > 0:
            sample_pipette.mix(3, sample_vol + 3, dilution_well)
          ## pipette up&down 3x to get everything from the tip              ##
        sample_pipette.dispense(20, dilution_well)
          ## instead of blow-out
        sample_pipette.drop_tip()
          ## Drop tip in trashbin on 12.                                    ##
         
# =============================================================================
Example #11
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix;
    Adding barcoded primers.
    """
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================
    # Pipette tips
    if dispension_vol >= 19:
        ## When the mm volume to be dispensed >= 19, 200µL tips are
        ## needed in addition to the 20µL tips.
        tips_200 = protocol.load_labware('opentrons_96_filtertiprack_200ul', 2,
                                         '200tips')
        tips_20_1 = protocol.load_labware('opentrons_96_filtertiprack_20ul', 7,
                                          '20tips_1')
        tips_20_2 = protocol.load_labware('opentrons_96_filtertiprack_20ul',
                                          10, '20tips_2')
        tips_20 = [tips_20_1, tips_20_2]
    else:
        ## When the mm volume to be dispensed <=19, only 20µL are needed
        tips_20_1 = protocol.load_labware('opentrons_96_filtertiprack_20ul', 2,
                                          '20tips_1')
        tips_20_2 = protocol.load_labware('opentrons_96_filtertiprack_20ul', 7,
                                          '20tips_2')
        tips_20_3 = protocol.load_labware('opentrons_96_filtertiprack_20ul',
                                          10, '20tips_3')
        tips_20 = [tips_20_1, tips_20_2, tips_20_3]

    # Tube_racks & plates
    plate_96 = protocol.load_labware('biorad_96_wellplate_200ul_pcr', 6,
                                     'plate_96')
    if qPCR:
        big_primer_source = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap', 8,
            'big_primer_source')

    if mastermix_tube_type == 'tube_1.5mL':
        mastermix_tube = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap', 3,
            'mastermix_tube')

    if primer_tube_type == 'plate_96':
        primer_source_1 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr', 1, 'primer_source_1')

    if simulate:  #Simulator
        if mastermix_tube_type == 'tube_5mL':
            with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
                      "eppendorfscrewcap_15_tuberack_5000ul.json"
                      ) as labware_file:
                labware_def_5mL = json.load(labware_file)
            mastermix_tube = protocol.load_labware_from_definition(
                labware_def_5mL, 3, 'mastermix_tube')
        if primer_tube_type == 'PCR_strips':
            with open("labware/pcrstrips_96_wellplate_200ul/"
                      "pcrstrips_96_wellplate_200ul.json") as labware_file:
                labware_def_pcrstrips = json.load(labware_file)
            primer_source_1 = protocol.load_labware_from_definition(
                labware_def_pcrstrips, 4, 'primer_source_1')
            if primer_racks >= 2:
                primer_source_2 = protocol.load_labware_from_definition(
                    labware_def_pcrstrips, 1, 'primer_source_2')
            if primer_racks >= 3:
                primer_source_3 = protocol.load_labware_from_definition(
                    labware_def_pcrstrips, 11, 'primer_source_3')
    else:  #Robot
        if mastermix_tube_type == 'tube_5mL':
            mastermix_tube = protocol.load_labware(
                'eppendorfscrewcap_15_tuberack_5000ul', 3, 'mastermix_tube')
        if primer_tube_type == 'PCR_strips':
            primer_source_1 = protocol.load_labware(
                'pcrstrips_96_wellplate_200ul', 4, 'primer_source_1')
            if primer_racks >= 2:
                primer_source_2 = protocol.load_labware(
                    'pcrstrips_96_wellplate_200ul', 1, 'primer_source_2')
            if primer_racks >= 3:
                primer_source_3 = protocol.load_labware(
                    'pcrstrips_96_wellplate_200ul', 11, 'primer_source_3')

    # Pipettes
    if dispension_vol >= 19:
        p300 = protocol.load_instrument('p300_single_gen2',
                                        'right',
                                        tip_racks=[tips_200])
    p20 = protocol.load_instrument('p20_single_gen2',
                                   'left',
                                   tip_racks=tips_20)
    # =============================================================================

    # PREDIFINED VARIABLES=========================================================
    # =============================================================================
    aspiration_vol = dispension_vol + (dispension_vol / 100 * 2)
    ## The aspiration_vol is the volume (µL) that is aspirated from the
    ## container.
    ##### Variables for volume tracking
    start_height = vt.cal_start_height(mastermix_tube_type, start_vol)
    ## Call start height calculation function from volume tracking module.
    current_height = start_height
    ## Set the current height to start height at the beginning of the
    ## protocol.
    primer_mix_vol = primer_vol + 3
    ## primer_mix_vol = volume for pipetting up and down
    # =============================================================================

    # SETTING LOCATIONS============================================================
    # =============================================================================
    # Setting starting tip
    if dispension_vol >= 19:
        ## If the mm volume to be dispendsed >= 19, assign p300 starting tip
        p300.starting_tip = tips_200.well(starting_tip_p200)
    p20.starting_tip = tips_20_1.well(starting_tip_p20)

    # Mastermix tube location
    MasterMix = mastermix_tube[mastermix_source]

    # Make a list with all 96 wells of the plate
    wells = []
    for well in plate_96.wells():
        wells.append(well)

    # Create the list of wells where samples should go
    sample_wells = wells[:number_of_primers]
    ## cuts off the list after a the number_of_samples number of wells

    # Create the list of wells where standard sample replicates should go
    slice_std_wells = slice(number_of_primers,
                            number_of_primers + number_of_std_samples)
    ## Slice the list - I need the number_of_std_samples of wells after
    ## the number_of_samples wells. So I need a certain amount of wells
    ## after the sample wells, but not all of the wells after that.
    ## This slices the list after the samples and after the std sample
    ## so that we only take the wells in between.
    std_sample_wells = wells[slice_std_wells]

    # Create the list of wells where standerd series should go
    std_series_wells = []
    std_series_columns = ([
        plate_96.columns_by_name()[column_name]
        for column_name in ['12', '11', '10']
    ])
    std_series_columns = std_series_columns[:number_of_std_series]
    ## Reserve a column at the end of the plate for every std_series
    ## Separate the columns into wells and append them to list
    for column in std_series_columns:
        column = column[:length_std_series]
        ## cut off the columns after a certain std_series length
        for well in column:
            std_series_wells.append(well)

    # Add the wells of the standards into 1 list
    ## This needs to be a list separate from the rest of the wells because
    ## they need the same primer from a separate tube.
    std_wells = std_sample_wells + std_series_wells
    # Add all the wells that need mastermix into 1 list
    MasterMixAliquots = sample_wells + std_wells

    # Primer locations
    primer_wells = []
    if primer_tube_type == 'PCR_strips':
        primer_columns = []
        if primer_racks >= 1:
            primer_columns_1 = (([
                primer_source_1.columns_by_name()[column_name]
                for column_name in primer_loc
            ]))
            for column in primer_columns_1:
                primer_columns.append(column)
        if primer_racks >= 2:
            primer_columns_2 = (([
                primer_source_2.columns_by_name()[column_name]
                for column_name in primer_loc
            ]))
            for column in primer_columns_2:
                primer_columns.append(column)
        if primer_racks >= 3:
            primer_columns_3 = (([
                primer_source_3.columns_by_name()[column_name]
                for column_name in primer_loc
            ]))
            for column in primer_columns_3:
                primer_columns.append(column)
            ## Make a list of columns, this is a list of lists!
        for column in primer_columns:
            for well in column:
                primer_wells.append(well)
    if primer_tube_type == 'plate_96':
        if primer_racks == 1:
            for well in primer_source_1.wells():
                primer_wells.append(well)
        if primer_racks == 2:
            for well in primer_source_2.wells():
                primer_wells.append(well)
        if primer_racks == 3:
            for well in primer_source_3.wells():
                primer_wells.append(well)
    primer_wells = primer_wells[:number_of_primers]

    # Set location for primer for standards
    if number_of_std_samples >= 1:
        std_primer = big_primer_source.wells_by_name()[std_primer_loc]
# =============================================================================

## PIPETTING===================================================================
## ============================================================================
## LIGHTS----------------------------------------------------------------------
    if qPCR:
        protocol.set_rail_lights(False)
    if not qPCR:
        protocol.set_rail_lights(True)
## ----------------------------------------------------------------------------
## ALIQUOTING MASTERMIX--------------------------------------------------------
    if dispension_vol >= 19:
        pipette = p300
    else:
        pipette = p20
    for i, well in enumerate(MasterMixAliquots):
        ## aliquot mix, for each well do the following:
        if i == 0:
            pipette.pick_up_tip()
            ## If we are at the first well, start by picking up a tip.
        elif i % 8 == 0:
            pipette.drop_tip()
            pipette.pick_up_tip()
            ## Then, after every 8th well, drop tip and pick up new

        current_height, pip_height, bottom_reached = vt.volume_tracking(
            mastermix_tube_type, dispension_vol, current_height)
        ## call volume_tracking function, obtain current_height,
        ## pip_height and whether bottom_reached.

        if bottom_reached:
            aspiration_location = MasterMix.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
            ## If bottom is reached keep pipetting from bottom + 1
        else:
            aspiration_location = MasterMix.bottom(pip_height)
            ## Set the location of where to aspirate from.

        #### The actual aliquoting of mastermix
        pipette.aspirate(aspiration_vol, aspiration_location)
        ## Aspirate the amount specified in aspiration_vol from the
        ## location specified in aspiration_location.
        pipette.dispense(dispension_vol, well)
        ## Dispense the amount specified in dispension_vol to the
        ## location specified in well (so a new well every time the
        ## loop restarts)
        pipette.dispense(10, aspiration_location)
        ## Alternative for blow-out, make sure the tip doesn't fill
        ## completely when using a disposal volume by dispensing some
        ## of the volume after each pipetting step. (blow-out to many
        ## bubbles)
    pipette.drop_tip()
    ## ----------------------------------------------------------------------------
    ## ADDING PRIMERS FOR SAMPLES TO THE MIX---------------------------------------
    for primer_well, sample_well in zip(primer_wells, sample_wells):
        ## Loop trough primer_wells and sample_wells
        p20.pick_up_tip()
        p20.aspirate(primer_vol, primer_well)
        p20.dispense(primer_vol, sample_well)
        p20.mix(3, primer_mix_vol, sample_well)
        p20.dispense(10, sample_well)
        p20.drop_tip()
## ----------------------------------------------------------------------------
## ADDING PRIMERS FOR STANDARDS TO THE MIX-------------------------------------
    for well in std_wells:
        p20.pick_up_tip()
        p20.aspirate(primer_vol, std_primer)
        ## use last primer pair for NTC and std series
        p20.dispense(primer_vol, well)
        p20.mix(3, primer_mix_vol, well)
        p20.dispense(10, well)
        p20.drop_tip()
## ----------------------------------------------------------------------------
## LIGHTS----------------------------------------------------------------------
    if not qPCR:
        protocol.set_rail_lights(False)


# ----------------------------------------------------------------------------
## ============================================================================
def run(protocol: protocol_api.ProtocolContext):
    """
    Adding samples from 1.5 mL tubes or PCR_strips to a 96 wells plate.
    """
# =============================================================================

# LOADING LABWARE AND PIPETTES=================================================
# =============================================================================
    # Pipette tips
    tips_20_1 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  
        7,                                  
        '20tips_1')                                
    tips_20_2 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  
        10,                                 
        '20tips_2')                         

    # Tube_racks & plates
    if sample_tubes == 'tubes_1.5mL':
        sample_tubes_1 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
            4,                                                       
            'sample_tubes_1')                                        
        if sample_racks >= 2:
            sample_tubes_2 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                1,                                                       
                'sample_tubes_2')                                        
        if sample_racks >= 3:
            sample_tubes_3 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                3,                                                       
                'sample_tubes_3')                                        
        if sample_racks >= 4:
            sample_tubes_4 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                11,                                                      
                'sample_tubes_4')                                        
    
    if simulate: #Simulator
        if sample_tubes == 'PCR_strips':
            with open("labware/pcrstrips_96_wellplate_200ul/"
                      "pcrstrips_96_wellplate_200ul.json") as labware_file:
                    labware_def_pcrstrips = json.load(labware_file)
            sample_strips_1 = protocol.load_labware_from_definition( 
                labware_def_pcrstrips, 
                4,                     
                'sample_strips_1')       
            if sample_racks >= 2:
                sample_strips_2 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    1,                     
                    'sample_strips_2')     
            if sample_racks >= 3:
                sample_strips_3 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    3,                    
                    'sample_strips_3')                            
            if sample_racks >= 4:
                sample_strips_4 = protocol.load_labware_from_definition( 
                    labware_def_pcrstrips, 
                    11,                   
                    'sample_strips_4') 
        with open("labware/biorad_qpcr_plate_eppendorf_cool_rack/"
                    "biorad_qpcr_plate_eppendorf_cool_rack.json") as labware_file:
                  labware_def_cool_rack = json.load(labware_file)
        plate_96 = protocol.load_labware_from_definition( 
            labware_def_cool_rack,  
            5,                     
            '96well_plate_rack')        
    else: #Robot
        if sample_tubes == 'PCR_strips':  
            sample_tubes_1 = protocol.load_labware(
                'pcrstrips_96_wellplate_200ul',    
                4,                                
                'sample_strips_1')                 
            if sample_racks >= 2:
                sample_strips_2 = protocol.load_labware(
                'pcrstrips_96_wellplate_200ul',    
                1,                                 
                'sample_strips_2')                 
            if sample_racks >= 3:
                sample_strips_3 = protocol.load_labware(
                'pcrstrips_96_wellplate_200ul',   
                3,                               
                'sample_strips_3')                 
            if sample_racks >= 4:
                sample_strips_4 = protocol.load_labware(
                'pcrstrips_96_wellplate_200ul',    
                11,                                
                'sample_strips_4')  
        plate_96 = protocol.load_labware(
            'biorad_qpcr_plate_eppendorf_cool_rack',
            5,                                      
            '96well_plate_rack')                                                          
        
    # Pipettes
    p20 = protocol.load_instrument(
        'p20_single_gen2',                  
        'left',                             
        tip_racks=[tips_20_1, tips_20_2])   
# =============================================================================

# SETTING LOCATIONS============================================================
# =============================================================================
    p20.starting_tip = tips_20_1.well(starting_tip_p20)
      ## The starting_tip is the location of first pipette tip in the box   

    # Sample source wells
    sample_sources = []
      ## Create an empty list to append wells to.                           
    if sample_tubes == 'tubes_1.5mL':  
        sample_sources = sample_tubes_1.wells()
        if sample_racks >= 2:
            sample_sources = sample_sources + sample_tubes_2.wells()
        if sample_racks >= 3:
            sample_sources = sample_sources + sample_tubes_3.wells()    
        if sample_racks >= 4:
            sample_sources = sample_sources + sample_tubes_4.wells()
        sample_sources = sample_sources[:number_of_samples]
        
        if number_of_std_samples >= 1:
            std_source = [sample_sources[-1]] * (number_of_std_samples - 1)
            for well in std_source:
                sample_sources.append(well)
            ## adds the same well (where the std_sample is) to the sample  
            ## sources list, so will pipete number_of_std_samples times from   
            ## the same well                                               
    if sample_tubes == 'PCR_strips':
        sample_columns = (
            ([sample_strips_1.columns_by_name()[column_name] 
              for column_name in strip_positions])) 
        if sample_racks >= 2:
            sample_columns2 = (
                ([sample_strips_2.columns_by_name()[column_name] 
                  for column_name in strip_positions]))
            for column in sample_columns2:
                sample_columns.append(column)
        if sample_racks >= 3:
            sample_columns3 = (
                ([sample_strips_3.columns_by_name()[column_name] 
                  for column_name in strip_positions]))
            for column in sample_columns3:
                sample_columns.append(column)
        if sample_racks >= 4:
            sample_columns4 = (
                ([sample_strips_4.columns_by_name()[column_name] 
                  for column_name in strip_positions]))
            for column in sample_columns4:
                sample_columns.append(column)
            ## Make a list of columns, this is a list of lists!             
        
        for column in sample_columns:
            for well in column:
                sample_sources.append(well)
        sample_sources = sample_sources[:number_of_samples]
          ## Separate the columns into wells and append them to list        
        
        if number_of_std_samples >= 1:
            std_source = [sample_sources[-1]] * (number_of_std_samples - 1)
            for well in std_source:
                sample_sources.append(well)
            ## adds the same well (where the std_sample is) to the sample  
            ## sources list, so will pipete number_of_std_samples times from   
            ## the same well             
# =============================================================================

## PIPETTING===================================================================
## ============================================================================
## LIGHTS----------------------------------------------------------------------
    if qPCR:
        protocol.set_rail_lights(False)
    if not qPCR:
        protocol.set_rail_lights(True)
## ADDING SAMPLES--------------------------------------------------------------
    ## Loop through source and destination wells
    for sample_tube, well in zip(sample_sources, plate_96.wells()):
        p20.pick_up_tip()
        p20.aspirate(sample_vol, sample_tube)
        p20.dispense(sample_vol, well)
        sample_mix_vol = sample_vol + 3
          ## primer_mix_vol = volume for pipetting up and down              
        p20.mix(3, sample_mix_vol, well)
        p20.dispense(10, well)
        p20.drop_tip()
## LIGHTS----------------------------------------------------------------------
    if not qPCR:
        protocol.set_rail_lights(False)
## ----------------------------------------------------------------------------
# =============================================================================
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix from a 5 mL tube to a 96 wells plate or tube strips.
    Followed by adding samples.
    """
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================
    ## For available labware see "labware/list_of_available_labware".       ##

    # pipette tips
    tips_200 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        10,  #deck position
        '200tips')  #custom name

    # Tube_racks & plates
    if PCR_tubes == 'plate_96':
        PCR_tube = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            8,  #deck position
            'plate_96')  #custom name
    if PCR_tubes == 'PCR_strips':
        ##### !!! OPTION 1: ROBOT
        # PCR_tube_1 = protocol.load_labware(
        # 'pcrstrips_96_wellplate_200ul',    #labware definition
        # 8,                                 #deck position
        # 'PCR_tube_1')                      #custom name
        # if PCR_racks >= 2:
        #     PCR_tube_2 = protocol.load_labware(
        #         'pcrstrips_96_wellplate_200ul',    #labware definition
        #         5,                                 #deck position
        #         'PCR_tube_2')                      #custom name
        # if PCR_racks >= 3:
        #     PCR_tube_3 = protocol.load_labware(
        #         'pcrstrips_96_wellplate_200ul',    #labware definition
        #         2,                                 #deck position
        #         'PCR_tube_3')                      #custom name
        # if PCR_racks == 4:
        #     PCR_tube_4 = protocol.load_labware(
        #         'pcrstrips_96_wellplate_200ul',    #labware definition
        #         1,                                 #deck position
        #         'PCR_tube_4')                      #custom name

        ##### !!! OPTION 2: SIMULATOR
        with open("labware/pcrstrips_96_wellplate_200ul/"
                  "pcrstrips_96_wellplate_200ul.json") as labware_file:
            labware_def_pcrstrips = json.load(labware_file)
        PCR_tube_1 = protocol.load_labware_from_definition(
            labware_def_pcrstrips,  #variable derived from opening json
            8,  #deck position
            'PCR_tube_1')  #custom name
        if PCR_racks >= 2:
            PCR_tube_2 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                5,  #deck position
                'PCR_tube_2')  #custom name
        if PCR_racks >= 3:
            PCR_tube_3 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                2,  #deck position
                'PCR_tube_3')  #custom name
        if PCR_racks >= 4:
            PCR_tube_4 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                1,  #deck position
                'PCR_tube_4')  #custom name

    ##### !!! OPTION 1: ROBOT
    # mastermix_tube = protocol.load_labware(
    #     'eppendorfscrewcap_15_tuberack_5000ul', #labware def
    #     4,                                      #deck position
    #     'mastermix_tube')                       #custom name
##### !!! OPTION 2: SIMULATOR
    with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
              "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
        labware_def_5mL = json.load(labware_file)
    mastermix_tube = protocol.load_labware_from_definition(
        labware_def_5mL,  #variable derived from opening json
        4,  #deck position
        'mastermix_tube')  #custom name

    # Pipettes
    p300 = protocol.load_instrument(
        'p300_single_gen2',  #instrument definition
        'right',  #mount position
        tip_racks=[tips_200])  #assigned tiprack
    # =============================================================================

    # PREDIFINED VARIABLES=========================================================
    # =============================================================================
    aspiration_vol = dispension_vol + (dispension_vol / 100 * 2)
    ## The aspiration_vol is the volume (ul) that is aspirated from the   ##
    ## container.                                                         ##
    ##### Variables for volume tracking
    start_height = vt.cal_start_height('tube_5mL', start_vol)
    ## Call start height calculation function from volume tracking module.##
    current_height = start_height
    ## Set the current height to start height at the beginning of the     ##
    ## protocol.                                                          ##
    # =============================================================================

    # SETTING LOCATIONS============================================================
    # =============================================================================
    ##### Setting starting tip                                              ##
    p300.starting_tip = tips_200.well(starting_tip_p200)
    ## The starting_tip is the location of first pipette tip in the box   ##

    ##### Tube locations                                                    ##
    MasterMix = mastermix_tube[mastermix_source]
    ## Location of the 5mL tube with mastermix                            ##

    #### Where should mastermix go                                          ##
    number_of_wells = number_of_samples + number_of_NTCs
    ##How many wells do need to be filled with mastermix                  ##
    MasterMixAliquots = []
    if PCR_tubes == 'plate_96':
        MasterMixAliquots = PCR_tube.wells()

    elif PCR_tubes == 'PCR_strips':
        PCR_columns = (([
            PCR_tube_1.columns_by_name()[column_name]
            for column_name in strip_positions
        ]))
        if PCR_racks >= 2:
            PCR_columns_2 = (([
                PCR_tube_2.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            PCR_columns = PCR_columns + PCR_columns_2
        if PCR_racks >= 3:
            PCR_columns_3 = (([
                PCR_tube_3.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            PCR_columns = PCR_columns + PCR_columns_3
        if PCR_racks >= 4:
            PCR_columns_4 = (([
                PCR_tube_4.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            PCR_columns = PCR_columns + PCR_columns_4
        for column in PCR_columns:
            for well in column:
                MasterMixAliquots.append(well)

    ## Make a list with all wells for PCR                         ##
    MasterMixAliquots = MasterMixAliquots[:number_of_wells]
    ## cuts off the list after a certain number of wells                  ##
    # =============================================================================

    ## ALIQUOTING MASTERMIX========================================================
    ## ============================================================================
    for i, well in enumerate(MasterMixAliquots):
        ## aliquot mix, for each well do the following:                       ##
        if i == 0:
            p300.pick_up_tip()
            ## If we are at the first well, start by picking up a tip.    ##
        elif i % 16 == 0:
            p300.drop_tip()
            p300.pick_up_tip()
            ## Then, after every 16th well, drop tip and pick up new       ##

        current_height, pip_height, bottom_reached = vt.volume_tracking(
            'tube_5mL', dispension_vol, current_height)
        ## call volume_tracking function, obtain current_height,  ##
        ## pip_height and whether bottom_reached.                 ##

        if bottom_reached:
            aspiration_location = MasterMix.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
            ## If bottom is reached keep pipetting from bottom + 1        ##
        else:
            aspiration_location = MasterMix.bottom(pip_height)
            ## Set the location of where to aspirate from.                ##

        #### The actual aliquoting of mastermix                             ##
        p300.aspirate(aspiration_vol, aspiration_location)
        ## Aspirate the amount specified in aspiration_vol from the       ##
        ## location specified in aspiration_location.                     ##
        p300.dispense(dispension_vol, well)
        ## Dispense the amount specified in dispension_vol to the         ##
        ## location specified in well (so a new well every time the       ##
        ## loop restarts)                                                 ##
        p300.dispense(10, aspiration_location)
        ## Alternative for blow-out, make sure the tip doesn't fill       ##
        ## completely when using a disposal volume by dispensing some     ##
        ## of the volume after each pipetting step. (blow-out to many     ##
        ## bubbles)                                                       ##
    p300.drop_tip()
Example #14
0
def run(protocol: protocol_api.ProtocolContext):
    """
    General protocol for multiple qPCRs of a batch. 
    Define if and how many dilution series you want to include. Usually only
    in the first PCR of a batch, 3 dilution series are included.
    Aliquoting Phusion PCRmix with EvaGreen added from a 5 mL tube to a 
    96-wells plate; use volume tracking.
    After that, add samples to PCR mix.
    Also include a standard sample mix (distribute to an entire column).
    Dilution series should be added by hand in the first (how many you chose) 
    columns.
    """
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================
    ##### Loading labware
    tips_200 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        3,  #deck position
        'tips_200')  #custom name
    tips_20_1 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        10,  #deck position
        'tips_20')  #custom name
    tips_20_2 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        7,  #deck position
        'tips_20')  #custom name
    plate_96_qPCR = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',  #labware definition
        5,  #deck position
        'plate_96_qPCR')  #custom name
    plate_96_dil_1 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',  #labware definition
        4,  #deck position
        'plate_96_dil')  #custom name
    plate_96_dil_2 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',  #labware definition
        1,  #deck position
        'plate_96_dil_2')  #custom name

    ##### !!! FOR ROBOT
    # tubes_5mL = protocol.load_labware(
    #     'eppendorfscrewcap_15_tuberack_5000ul', #labware definition
    #     6,                                      #deck position
    #     'tubes_5mL')                            #custom name

    # ####    !!! FOR SIMULATOR
    with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
              "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
        labware_def_5mL = json.load(labware_file)
        tubes_5mL = protocol.load_labware_from_definition(
            labware_def_5mL,  #variable derived from opening json
            6,
            '5mL_tubes')

    ##### Loading pipettes
    p300 = protocol.load_instrument(
        'p300_single_gen2',  #instrument definition
        'right',  #mount position
        tip_racks=[tips_200])  #assigned tiprack
    p20 = protocol.load_instrument(
        'p20_single_gen2',  #instrument definition
        'left',  #mount position
        tip_racks=[tips_20_1, tips_20_2])  #assigned tiprack

    # =============================================================================

    # SETTING LOCATIONS============================================================
    # =============================================================================
    ##### Setting starting tip                                              ##
    p300.starting_tip = tips_200.well(starting_tip_p200)
    p20.starting_tip = tips_20_1.well(starting_tip_p20)
    ## The starting_tip is the location of first pipette tip in the box   ##

    ##### Tube locations                                                    ##

    MasterMix = tubes_5mL['C1']
    ## Location of the 5mL tube with mastermix                            ##

    #### Where should mastermix go                                          ##
    number_of_wells = (number_of_samples + (number_std_series * 8) +
                       number_of_samplemix + number_of_NTCs)
    ##How many wells do need to be filled with mastermix                  ##
    MasterMixAliquots = []
    for well in plate_96_qPCR.wells():
        MasterMixAliquots.append(well)
    ## Make a list with all wells of the plate                            ##
    MasterMixAliquots = MasterMixAliquots[:number_of_wells]
    ## cuts off the list after a certain number of samples                ##

    #### Where are the samples located                                     ##
    samples = []
    samples_string = []
    for well in plate_96_dil_1.wells():
        samples.append(well)
        samples_string.append(str(well))
    for well in plate_96_dil_2.wells():
        samples.append(well)
    ## Makes a list of all wells in 2 full plates                         ##
    index_first_sample = samples_string.index(first_sample +
                                              ' of plate_96_dil on 4')
    samples = samples[index_first_sample:]
    ## starts sample location at firts sample                             ##
    samples = samples[:number_of_samples]
    ## Cuts off the list after certain number of samples                  ##

    #### Where do the samples go in the PCR plate                         ##
    sample_dest = []
    for well in plate_96_qPCR.wells():
        sample_dest.append(well)
    sample_dest = sample_dest[((number_std_series * 8) + number_of_samplemix):]
    ## skip wells for dilution series and sample_mix                      ##
    sample_dest = sample_dest[:number_of_samples]
    ## cuts off the list after a certain number of samples                ##

    #### Where is the sample_mix located
    sample_mix = plate_96_dil_2.well(sample_mix_well)
    #### Where the sample_mix will go in the PCR plate                    ##
    sample_mix_dest = []
    sample_mix_column = str(number_std_series + 1)
    for well in plate_96_qPCR.columns_by_name()[sample_mix_column]:
        sample_mix_dest.append(well)
    ## PCR will start with dilution series (if desired), followed by an   ##
    ## entire column with sample mix. This is used to normalize between   ##
    ## PCRs                                                               ##
    sample_mix_dest = sample_mix_dest[:number_of_samplemix]
    ## Cuts of the list of wells after the desired number of sample mixes ##

    # # ALIQUOTING MASTERMIX=======================================================
    # # ===========================================================================

    ##### Variables for volume tracking
    start_height_mix = vt.cal_start_height('tube_5mL', start_vol_mix)
    current_height = start_height_mix

    for i, well in enumerate(MasterMixAliquots):
        ## aliquot mix, for each well do the following:                       ##

        aspiration_vol = dispension_vol_mix + (dispension_vol_mix / 100 * 2)
        ## Set correct variables for volume_tracking                  ##
        if i == 0:
            p300.pick_up_tip()
            ## If we are at the first well, start by picking up a tip.    ##
        elif i % 8 == 0:
            p300.drop_tip()
            p300.pick_up_tip()
            ## Then, after every 8th well, drop tip and pick up new       ##

        current_height, pip_height, bottom_reached = vt.volume_tracking(
            'tube_5mL', dispension_vol_mix, current_height)
        ## call volume_tracking function, obtain current_height,  ##
        ## pip_height and whether bottom_reached.                 ##

        if bottom_reached:
            aspiration_location = MasterMix.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
            ## If bottom is reached keep pipetting from bottom + 1        ##
        else:
            aspiration_location = MasterMix.bottom(pip_height)
            ## Set the location of where to aspirate from.                ##

        #### The actual aliquoting of mastermix                             ##
        p300.aspirate(aspiration_vol, aspiration_location)
        ## Aspirate the amount specified in aspiration_vol from the       ##
        ## location specified in aspiration_location.                     ##
        p300.dispense(dispension_vol_mix, well)
        ## Dispense the amount specified in dispension_vol to the         ##
        ## location specified in well (looping through plate)             ##
        p300.dispense(10, aspiration_location)
        ## Alternative for blow-out, make sure the tip doesn't fill       ##
        ## completely when using a disposal volume by dispensing some     ##
        ## of the volume after each pipetting step. (blow-out too many    ##
        ## bubbles)                                                       ##
    p300.drop_tip()
    ## when done, drop tip                                                ##

    # DISTRIBUTING SAMPLES AND SAMPLE MIX==========================================
    # =============================================================================
    ##### Distributing sample
    for sample, destination_well in zip(samples, sample_dest):
        ## Combine each sample with a destination well                      ##
        p20.pick_up_tip()
        ## p20 picks up tip from location of specified starting_tip       ##
        ## or following                                                   ##
        p20.aspirate(sample_volume, sample)
        ## aspirate sample_volume from sample                             ##
        p20.dispense(sample_volume, destination_well)
        ## dispense sample_volume in destination_well                     ##
        p20.mix(3, 20, destination_well, rate=5)
        ## pipette max pipette_volume up&down 3                           ##
        p20.dispense(20, destination_well)
        ## alternative to blow_out                                        ##
        p20.drop_tip()
        ## Drop tip in trashbin on 12.                                    ##

    ##### Distributing sample_mix
    for destination_well in sample_mix_dest:
        p20.pick_up_tip()
        ## p20 picks up tip from location of specified tip                ##
        p20.aspirate(sample_volume, sample_mix)
        ## aspirate sample_volume from sample                             ##
        p20.dispense(sample_volume, destination_well)
        ## dispense sample_volume in destination_well                     ##
        p20.mix(3, 20, destination_well, rate=5)
        ## pipette max pipette_volume up&down 3                           ##
        p20.dispense(20, destination_well)
        ## alternative to blow_out                                        ##
        p20.drop_tip()
Example #15
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting Illumina primers from 1 tube rack filled with 1.5 mL tubes,
    to 3 PCR strips in a BioRad 96-well plate, calibrated with Westburg
    PCR strips.
    """
    # =============================================================================

    # =====================LOADING LABWARE AND PIPETTES============================
    # =============================================================================
    ## For available labware see "labware/list_of_available_labware".       ##
    tips_200_1 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        10,  #deck position
        '200tips')  #custom name
    tips_200_2 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        7,  #deck position
        '200tips')  #custom name
    tips_200_3 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        4,  #deck position
        '200tips')  #custom name
    tips_200_4 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        1,  #deck position
        '200tips')  #custom name
    primer_tubes = protocol.load_labware(
        'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labware def
        3,  #deck position
        'primer_tubes')  #custom name
    ##### !!! OPTION 1: ROBOT
    # pcr_strips = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',     #labware definition
    #     6,                                  #deck position
    #     'pcr_strips')                        #custom name
    ##### !!! OPTION 2: SIMULATOR
    with open("labware/pcrstrips_96_wellplate_200ul/"
              "pcrstrips_96_wellplate_200ul.json") as labware_file:
        labware_def_pcrstrips = json.load(labware_file)
    pcr_strips = protocol.load_labware_from_definition(
        labware_def_pcrstrips,  #variable derived from opening json
        6,
        'pcr_strips')
    ##   Load the labware using load_labware_from_definition() instead of  ##
    ##   load_labware(). Then use the variable you just set with the opened##
    ##   json file to define which labware to use.                         ##

    p300 = protocol.load_instrument(
        'p300_single_gen2',  #instrument definition
        'right',  #mount position
        tip_racks=[tips_200_1, tips_200_2, tips_200_3,
                   tips_200_4])  #as tiprack
    # =============================================================================

    # ===========================VARIABLES TO SET#!!!==============================
    # =============================================================================
    p300.starting_tip = tips_200_1.well('A1')
    primer_volume = 30
    # =============================================================================

    # ============================ALIQUOTING PRIMERS===============================
    # =============================================================================
    protocol.set_rail_lights(True)

    protocol.pause('Put F primers F1 to F47 in slot 3, and '
                   'three empty PCR strips in columns 2, 7, and 11 with the '
                   'caps to the right in slot 6.')
    # =============================================================================
    # F1 to F47 + corresponding R primers==========================================
    for primer_tube, pcr_strip_tube in zip(primer_tubes.wells(), [
            pcr_strips.wells_by_name()[well_name] for well_name in [
                'A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2', 'H2', 'A7', 'B7',
                'C7', 'D7', 'E7', 'F7', 'G7', 'H7', 'A11', 'B11', 'C11', 'D11',
                'E11', 'F11', 'G11', 'H11'
            ]
    ]):
        ## simultanious loop through primer_tubes and PCR_strips           ##
        ## From wells to columns doesn't work, therefore all PCRstrip      ##
        ## wells are given.                                                ##
        p300.pick_up_tip()
        p300.aspirate(primer_volume, primer_tube)
        p300.air_gap(10)
        p300.dispense(primer_volume + 50, pcr_strip_tube)
        p300.air_gap()
        ## air_gap to suck up any liquid that remains in the tip           ##
        p300.drop_tip()
    ## Used aspirate/dipense instead of transfer, to allow for more        ##
    ## customization.  ##
    protocol.pause('Remove F primers and put corresponding'
                   ' R primers on slot 3.')

    for primer_tube, pcr_strip_tube in zip(primer_tubes.wells(), [
            pcr_strips.wells_by_name()[well_name] for well_name in [
                'A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2', 'H2', 'A7', 'B7',
                'C7', 'D7', 'E7', 'F7', 'G7', 'H7', 'A11', 'B11', 'C11', 'D11',
                'E11', 'F11', 'G11', 'H11'
            ]
    ]):
        p300.pick_up_tip()
        p300.aspirate(primer_volume, primer_tube)
        p300.air_gap(10)
        p300.dispense(primer_volume + 50, pcr_strip_tube)
        p300.air_gap()
        p300.drop_tip()
    protocol.pause('Remove R primers and PCR strips, '
                   'put new strips in columns 2, 7 and 11 with caps to '
                   'the right and put F49 to F83 on slot 3.')
    # =============================================================================
    # F49 to F83 + corresponding R primers=========================================
    for primer_tube, pcr_strip_tube in zip(primer_tubes.wells(), [
            pcr_strips.wells_by_name()[well_name] for well_name in [
                'A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2', 'H2', 'A7', 'B7',
                'C7', 'D7', 'E7', 'F7', 'G7', 'H7', 'A11', 'B11'
            ]
    ]):
        p300.pick_up_tip()
        p300.aspirate(primer_volume, primer_tube)
        p300.air_gap(10)
        p300.dispense(primer_volume + 50, pcr_strip_tube)
        p300.air_gap()
        p300.drop_tip()
    protocol.pause('Remove F primers and put corresponding'
                   ' R primers on slot 3.')

    for primer_tube, pcr_strip_tube in zip(primer_tubes.wells(), [
            pcr_strips.wells_by_name()[well_name] for well_name in [
                'A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2', 'H2', 'A7', 'B7',
                'C7', 'D7', 'E7', 'F7', 'G7', 'H7', 'A11', 'B11'
            ]
    ]):
        p300.pick_up_tip()
        p300.aspirate(primer_volume, primer_tube)
        p300.air_gap(10)
        p300.dispense(primer_volume + 50, pcr_strip_tube)
        p300.air_gap()
        p300.drop_tip()
# =============================================================================
    protocol.set_rail_lights(False)
def run(protocol: protocol_api.ProtocolContext):
    tiprack = protocol.load_labware(TIPRACK_LOADNAME, TIPRACK_SLOT)
    pipette = protocol.load_instrument(
        PIPETTE_NAME, PIPETTE_MOUNT, tip_racks=[tiprack])

    test_labware = protocol.load_labware_from_definition(
        LABWARE_DEF,
        TEST_LABWARE_SLOT,
        LABWARE_LABEL,
    )

    num_cols = len(LABWARE_DEF.get('ordering', [[]]))
    num_rows = len(LABWARE_DEF.get('ordering', [[]])[0])
    total = num_cols * num_rows
    pipette.pick_up_tip()

    def set_speeds(rate):
        protocol.max_speeds.update({
            'X': (600 * rate),
            'Y': (400 * rate),
            'Z': (125 * rate),
            'A': (125 * rate),
        })

        speed_max = max(protocol.max_speeds.values())

        for instr in protocol.loaded_instruments.values():
            instr.default_speed = speed_max

    set_speeds(RATE)

    pipette.home()
    if(PIPETTE_NAME == 'p20_single_gen2' or PIPETTE_NAME == 'p300_single_gen2' or PIPETTE_NAME == 'p1000_single_gen2' or PIPETTE_NAME == 'p50_single' or PIPETTE_NAME == 'p10_single' or PIPETTE_NAME == 'p300_single' or PIPETTE_NAME == 'p1000_single'):
        if(total > 1):
            #testing with single channel
            well = test_labware.well('A1')
            all_4_edges = [
                [well._from_center_cartesian(x=-1, y=0, z=1), 'left'],
                [well._from_center_cartesian(x=1, y=0, z=1), 'right'],
                [well._from_center_cartesian(x=0, y=-1, z=1), 'front'],
                [well._from_center_cartesian(x=0, y=1, z=1), 'back']
            ]

            set_speeds(RATE)
            pipette.move_to(well.top())
            protocol.pause("If the position is accurate click 'resume.'")

            for edge_pos, edge_name in all_4_edges:
                set_speeds(RATE)
                edge_location = types.Location(point=edge_pos, labware=None)
                pipette.move_to(edge_location)
                protocol.pause("If the position is accurate click 'resume.'")

            #last well testing
            last_well = (num_cols) * (num_rows)
            well = test_labware.well(last_well-1)
            all_4_edges = [
                [well._from_center_cartesian(x=-1, y=0, z=1), 'left'],
                [well._from_center_cartesian(x=1, y=0, z=1), 'right'],
                [well._from_center_cartesian(x=0, y=-1, z=1), 'front'],
                [well._from_center_cartesian(x=0, y=1, z=1), 'back']
            ]
            for edge_pos, edge_name in all_4_edges:
                set_speeds(RATE)
                edge_location = types.Location(point=edge_pos, labware=None)
                pipette.move_to(edge_location)
                protocol.pause("If the position is accurate click 'resume.'")
            set_speeds(RATE)
            #test bottom of last well
            pipette.move_to(well.bottom())
            protocol.pause("If the position is accurate click 'resume.'")
            pipette.blow_out(well)
        else:
            #testing with single channel + 1 well labware
            well = test_labware.well('A1')
            all_4_edges = [
                [well._from_center_cartesian(x=-1, y=0, z=1), 'left'],
                [well._from_center_cartesian(x=1, y=0, z=1), 'right'],
                [well._from_center_cartesian(x=0, y=-1, z=1), 'front'],
                [well._from_center_cartesian(x=0, y=1, z=1), 'back']
            ]

            set_speeds(RATE)
            pipette.move_to(well.top())
            protocol.pause("If the position is accurate click 'resume.'")

            for edge_pos, edge_name in all_4_edges:
                set_speeds(RATE)
                edge_location = types.Location(point=edge_pos, labware=None)
                pipette.move_to(edge_location)
                protocol.pause("If the position is accurate click 'resume.'")

            #test bottom of first well
            well = test_labware.well('A1')
            pipette.move_to(well.bottom())
            protocol.pause("If the position is accurate click 'resume.'")
            pipette.blow_out(well)
    else:
        #testing for multichannel
        if(total == 96 or total == 384): #testing for 96 well plates and 384 first column
            #test first column
            well = test_labware.well('A1')
            all_4_edges = [
                [well._from_center_cartesian(x=-1, y=0, z=1), 'left'],
                [well._from_center_cartesian(x=1, y=0, z=1), 'right'],
                [well._from_center_cartesian(x=0, y=-1, z=1), 'front'],
                [well._from_center_cartesian(x=0, y=1, z=1), 'back']
            ]
            set_speeds(RATE)
            pipette.move_to(well.top())
            protocol.pause("If the position is accurate click 'resume.'")

            for edge_pos, edge_name in all_4_edges:
                set_speeds(RATE)
                edge_location = types.Location(point=edge_pos, labware=None)
                pipette.move_to(edge_location)
                protocol.pause("If the position is accurate click 'resume.'")

            #test last column
            if(total == 96):
                last_col = (num_cols * num_rows) - num_rows
                well = test_labware.well(last_col)
                all_4_edges = [
                    [well._from_center_cartesian(x=-1, y=0, z=1), 'left'],
                    [well._from_center_cartesian(x=1, y=0, z=1), 'right'],
                    [well._from_center_cartesian(x=0, y=-1, z=1), 'front'],
                    [well._from_center_cartesian(x=0, y=1, z=1), 'back']
                ]
                for edge_pos, edge_name in all_4_edges:
                    set_speeds(RATE)
                    edge_location = types.Location(point=edge_pos, labware=None)
                    pipette.move_to(edge_location)
                    protocol.pause("If the position is accurate click 'resume.'")
                set_speeds(RATE)
                #test bottom of last column
                pipette.move_to(well.bottom())
                protocol.pause("If the position is accurate click 'resume.'")
                pipette.blow_out(well)
            elif(total == 384):
                #testing for 384 well plates - need to hit well 369, last column
                well369 = (total) - (num_rows) + 1
                well = test_labware.well(well369)
                pipette.move_to(well.top())
                protocol.pause("If the position is accurate click 'resume.'")
                all_4_edges = [
                    [well._from_center_cartesian(x=-1, y=0, z=1), 'left'],
                    [well._from_center_cartesian(x=1, y=0, z=1), 'right'],
                    [well._from_center_cartesian(x=0, y=-1, z=1), 'front'],
                    [well._from_center_cartesian(x=0, y=1, z=1), 'back']
                ]
                for edge_pos, edge_name in all_4_edges:
                    set_speeds(RATE)
                    edge_location = types.Location(point=edge_pos, labware=None)
                    pipette.move_to(edge_location)
                    protocol.pause("If the position is accurate click 'resume.'")
                set_speeds(RATE)
                #test bottom of last column
                pipette.move_to(well.bottom())
                protocol.pause("If the position is accurate click 'resume.'")
                pipette.blow_out(well)
        elif(num_rows == 1 and total > 1 and LABWARE_DIMENSIONS >= 71.2):
            #for 1 row reservoirs - ex: 12 well reservoirs
            well = test_labware.well('A1')
            all_4_edges = [
                [well._from_center_cartesian(x=-1, y=1, z=1), 'left'],
                [well._from_center_cartesian(x=1, y=1, z=1), 'right'],
                [well._from_center_cartesian(x=0, y=0.75, z=1), 'front'],
                [well._from_center_cartesian(x=0, y=1, z=1), 'back']
            ]
            set_speeds(RATE)
            pipette.move_to(well.top())
            protocol.pause("If the position is accurate click 'resume.'")

            for edge_pos, edge_name in all_4_edges:
                set_speeds(RATE)
                edge_location = types.Location(point=edge_pos, labware=None)
                pipette.move_to(edge_location)
                protocol.pause("If the position is accurate click 'resume.'")
            #test last well
            well = test_labware.well(-1)
            all_4_edges = [
                [well._from_center_cartesian(x=-1, y=1, z=1), 'left'],
                [well._from_center_cartesian(x=1, y=1, z=1), 'right'],
                [well._from_center_cartesian(x=0, y=0.75, z=1), 'front'],
                [well._from_center_cartesian(x=0, y=1, z=1), 'back']
            ]
            set_speeds(RATE)

            for edge_pos, edge_name in all_4_edges:
                set_speeds(RATE)
                edge_location = types.Location(point=edge_pos, labware=None)
                pipette.move_to(edge_location)
                protocol.pause("If the position is accurate click 'resume.'")
                #test bottom of first well
            pipette.move_to(well.bottom())
            protocol.pause("If the position is accurate click 'resume.'")
            pipette.blow_out(well)


        elif(total == 1 and LABWARE_DIMENSIONS >= 71.2 ):
            #for 1 well reservoirs
            well = test_labware.well('A1')
            all_4_edges = [
                [well._from_center_cartesian(x=-1, y=1, z=1), 'left'],
                [well._from_center_cartesian(x=1, y=1, z=1), 'right'],
                [well._from_center_cartesian(x=0, y=0.75, z=1), 'front'],
                [well._from_center_cartesian(x=0, y=1, z=1), 'back']
            ]
            set_speeds(RATE)
            pipette.move_to(well.top())
            protocol.pause("If the position is accurate click 'resume.'")

            for edge_pos, edge_name in all_4_edges:
                set_speeds(RATE)
                edge_location = types.Location(point=edge_pos, labware=None)
                pipette.move_to(edge_location)
                protocol.pause("If the position is accurate click 'resume.'")
                #test bottom of first well
            pipette.move_to(well.bottom())
            protocol.pause("If the position is accurate click 'resume.'")
            pipette.blow_out(well)

        else:
            #for incompatible labwares
            protocol.pause("labware is incompatible to calibrate with a multichannel pipette")




    set_speeds(1.0)
    pipette.return_tip()
Example #17
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix from a 1.5 mL tube to a 96 wells plate;
    Adding barcodes from PCR strips to the 96 wells plate.
    """
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================
    ## For available labware see "labware/list_of_available_labware".       ##

    # pipette tips
    tips_20_1 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        8,  #deck position
        '20tips_1')  #custom name
    tips_20_2 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        11,  #deck position
        '20tips_2')  #custom name
    tips_20_3 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        9,  #deck position
        '20tips_3')  #custom name
    if MM_dispension_vol >= 17:
        tips_200 = protocol.load_labware(
            'opentrons_96_filtertiprack_200ul',  #labware definition
            10,  #deck position
            '200tips')  #custom name
    # Tube_racks & plates
    if PCR_tube == 'plate_96':
        PCR_1 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            4,  #deck position
            'PCR_plate_96')  #custom name
    elif PCR_tube == 'PCR_strips':
        #### !!! OPTION 1: ROBOT
        # PCR_1 = protocol.load_labware(
        #   'pcrstrips_96_wellplate_200ul',    #labware definition
        #   4,                                 #deck position
        #   'PCR_strips_1')                    #custom name
        # if PCR_racks >= 2:
        #     PCR_2 = protocol.load_labware(
        #           'pcrstrips_96_wellplate_200ul',    #labware definition
        #           5,                                 #deck position
        #           'PCR_strips_2')                      #custom name
        # if PCR_racks >= 3:
        #     PCR_3 = protocol.load_labware(
        #           'pcrstrips_96_wellplate_200ul',    #labware definition
        #           6,                                 #deck position
        #           'PCR_strips_3')                      #custom name
        #### !!! OPTION 2: SIMULATOR
        with open("labware/pcrstrips_96_wellplate_200ul/"
                  "pcrstrips_96_wellplate_200ul.json") as labware_file:
            labware_def_pcrstrips = json.load(labware_file)
        PCR_1 = protocol.load_labware_from_definition(
            labware_def_pcrstrips,  #variable derived from opening json
            4,  #deck position
            'PCR_strips_1')  #custom name
        if PCR_racks >= 2:
            PCR_2 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                5,  #deck position
                'PCR_strips_2')  #custom name
        if PCR_racks >= 3:
            PCR_3 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                6,  #deck position
                'PCR_strips_3')  #custom name

    if MastermixWater_tube == 'tube_1.5mL':
        MastermixWater = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labw def
            7,  #deck pos
            'MastermixWater')  #cust name
    elif MastermixWater_tube == 'tube_5mL':
        ##### !!! OPTION 1: ROBOT
        # MastermixWater = protocol.load_labware(
        #     'eppendorfscrewcap_15_tuberack_5000ul', #labware def
        #     7,                                     #deck position
        #     'MastermixWater')                            #custom name
        ##### !!! OPTION 2: SIMULATOR
        with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
                  "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
            labware_def_5mL = json.load(labware_file)
        MastermixWater = protocol.load_labware_from_definition(
            labware_def_5mL,  #variable derived from opening json
            7,  #deck position
            'MastermixWater')  #custom name

    if barcode_tube == 'plate_96':
        barcode_1 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            4,  #deck position
            'barcode_plate_96')  #custom name
    elif barcode_tube == 'PCR_strips':
        ##### !!! OPTION 1: ROBOT
        # barcode_1 = protocol.load_labware(
        #     'pcrstrips_96_wellplate_200ul',    #labware definition
        #     1,                                 #deck position
        #     'barcode_strips_1')                 #custom name
        # if barcode_racks >=2:
        #     barcode_2 = protocol.load_labware(
        #     'pcrstrips_96_wellplate_200ul',    #labware definition
        #     2,                                 #deck position
        #     'barcode_strips_2')                 #custom name
        # if barcode_racks >=3:
        #     barcode_3 = protocol.load_labware(
        #     'pcrstrips_96_wellplate_200ul',    #labware definition
        #     3,                                #deck position
        #     'barcode_strips_3')                 #custom name
        ##### !!! OPTION 2: SIMULATOR
        with open("labware/pcrstrips_96_wellplate_200ul/"
                  "pcrstrips_96_wellplate_200ul.json") as labware_file:
            labware_def_pcrstrips = json.load(labware_file)
        barcode_1 = protocol.load_labware_from_definition(
            labware_def_pcrstrips,  #variable derived from opening json
            1,  #deck position
            'barcode_strips_1')  #custom name
        if barcode_racks >= 2:
            barcode_2 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                2,  #deck position
                'barcode_strips_2')  #custom name
        if barcode_racks >= 3:
            barcode_3 = protocol.load_labware_from_definition(
                labware_def_pcrstrips,  #variable derived from opening json
                3,  #deck position
                'barcode_strips_3')  #custom name

    elif barcode_tube == 'tube_1.5mL':
        barcode_1 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labw def
            1,  #deck pos
            'barcode_rack_1')  #cust name
        if barcode_racks >= 2:
            barcode_2 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #l def
                2,  #d pos
                'barcode_rack_2')  #name
        if barcode_racks >= 3:
            barcode_3 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #l def
                3,  #d pos
                'barcode_rack_3')  #name

    # Pipettes
    p20 = protocol.load_instrument(
        'p20_single_gen2',  #instrument definition
        'left',  #mount position
        tip_racks=[tips_20_1, tips_20_2, tips_20_3])  #assigned tiprack
    if MM_dispension_vol >= 17:
        p300 = protocol.load_instrument(
            'p300_single_gen2',  #instrument definition
            'right',  #mount position
            tip_racks=[tips_200])  #assigned tiprack
# =============================================================================

# PREDIFINED VARIABLES=========================================================
# =============================================================================
#### MasterMix
    MM_aspiration_vol = MM_dispension_vol + (MM_dispension_vol / 100 * 2)
    ## The aspiration_vol is the volume (ul) that is aspirated from the    ##
    ## container.                                                          ##
    ##### Variables for volume tracking
    MM_start_height = vt.cal_start_height(MastermixWater_tube, MM_start_vol)
    ## Call start height calculation function from volume tracking module. ##
    MM_current_height = MM_start_height
    ## Set the current height to start height at the beginning of the      ##
    ## protocol.                                                           ##
    barcode_mix_vol = barcode_vol + 3
    ## barcode_mix_vol = volume for pipetting up and down                  ##

    #### Water
    ##### Variables for volume tracking
    w_start_height = vt.cal_start_height(MastermixWater_tube, w_start_vol)
    ## Call start height calculation function from volume tracking module. ##
    w_current_height = w_start_height
    ## Set the current height to start height at the beginning of the      ##
    ## protocol.                                                           ##

    # =============================================================================

    # SETTING LOCATIONS============================================================
    # =============================================================================
    ##### Setting starting tip
    if MM_dispension_vol >= 17:  ##
        p300.starting_tip = tips_200.well(starting_tip_p200)
    p20.starting_tip = tips_20_1.well(starting_tip_p20)
    ## The starting_tip is the location of first pipette tip in the box    ##

    ##### Tube locations                                                     ##
    MasterMix = MastermixWater[mastermix_source]
    ## Location of the tube with mastermix                                 ##
    water = MastermixWater[water_source]
    ## Location of the tube with water                                     ##

    #### Where should mastermix go                                           ##
    destination_wells = []
    if PCR_tube == 'plate_96':
        destination_wells = PCR_1.wells()
    elif PCR_tube == 'PCR_strips':
        PCR_columns = (([
            PCR_1.columns_by_name()[column_name]
            for column_name in strip_positions
        ]))
        if PCR_racks >= 2:
            PCR_columns_2 = (([
                PCR_2.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            PCR_columns = PCR_columns + PCR_columns_2
        if PCR_racks >= 3:
            PCR_columns_3 = (([
                PCR_3.columns_by_name()[column_name]
                for column_name in strip_positions
            ]))
            PCR_columns = PCR_columns + PCR_columns_3
        for column in PCR_columns:
            for well in column:
                destination_wells.append(well)
    ## Make a list with all 96 wells of the plate                          ##
    destination_wells = destination_wells[:number_of_samples]
    ## cuts off the list after a certain number of wells                   ##

    #### Where are the barcodes located
    barcode_wells = []
    ## Create an empty list to append wells to                             ##
    barcode_columns = (([
        barcode_1.columns_by_name()[column_name] for column_name in barcode_loc
    ]))
    if barcode_racks >= 2:
        barcode_columns2 = (([
            barcode_2.columns_by_name()[column_name]
            for column_name in barcode_loc
        ]))
        for column in barcode_columns2:
            barcode_columns.append(column)
    if barcode_racks >= 3:
        barcode_columns3 = (([
            barcode_3.columns_by_name()[column_name]
            for column_name in barcode_loc
        ]))
        for column in barcode_columns3:
            barcode_columns.append(column)
        ## Make a list of columns, this is a list of lists!                  ##
    for column in barcode_columns:
        for well in column:
            barcode_wells.append(well)
    ## Separate the columns into wells and append them to list             ##
    barcode_wells = barcode_wells[:number_of_samples]
    ## cuts off the list after a certain number of wells                   ##
    # =============================================================================

    ## ALIQUOTING MASTERMIX========================================================
    ## ============================================================================
    if MM_dispension_vol < 17:
        pipette = p20
    else:
        pipette = p300
    for i, well in enumerate(destination_wells):
        ## aliquot mix, for each well do the following:                        ##
        if i == 0:
            pipette.pick_up_tip()
            ## If we are at the first well, start by picking up a tip.     ##
        elif i % 16 == 0:
            pipette.drop_tip()
            pipette.pick_up_tip()
            ## Then, after every 8th well, drop tip and pick up new        ##

        current_height, pip_height, bottom_reached = vt.volume_tracking(
            MastermixWater_tube, MM_dispension_vol, MM_current_height)
        ## call volume_tracking function, obtain current_height,   ##
        ## pip_height and whether bottom_reached.                  ##

        if bottom_reached:
            aspiration_location = MasterMix.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
            ## If bottom is reached keep pipetting from bottom + 1        ##
        else:
            aspiration_location = MasterMix.bottom(pip_height)
            ## Set the location of where to aspirate from.                ##

        #### The actual aliquoting of mastermix                             ##
        pipette.aspirate(MM_aspiration_vol, aspiration_location)
        ## Aspirate the amount specified in aspiration_vol from the       ##
        ## location specified in aspiration_location.                     ##
        pipette.dispense(MM_dispension_vol, well)
        ## Dispense the amount specified in dispension_vol to the         ##
        ## location specified in well (so a new well every time the       ##
        ## loop restarts)                                                 ##
        pipette.dispense(10, aspiration_location)
        ## Alternative for blow-out, make sure the tip doesn't fill       ##
        ## completely when using a disposal volume by dispensing some     ##
        ## of the volume after each pipetting step. (blow-out to many     ##
        ## bubbles)                                                       ##
    pipette.drop_tip()
    # =============================================================================

    ## ADDING BARCODES FOR SAMPLES TO THE MIX=======================================
    ## ============================================================================
    for barcode_well, destination_well in zip(barcode_wells,
                                              destination_wells):
        ## Loop trough barcode_wells and destination_wells                     ##
        p20.pick_up_tip()
        p20.aspirate(barcode_vol, barcode_well)
        p20.dispense(barcode_vol, destination_well)
        p20.mix(3, barcode_mix_vol, destination_well)
        p20.dispense(10, destination_well)
        p20.drop_tip()
# =============================================================================

## ADDING VARIABLE VOLUME OF WATER=============================================
## ============================================================================
    for water_volume, destination_well in zip(water_µL_list,
                                              destination_wells):
        ## Loop through water_volumes and destination_well

        current_height, pip_height, bottom_reached = vt.volume_tracking(
            MastermixWater_tube, water_volume, w_current_height)
        ## call volume_tracking function, obtain current_height,   ##
        ## pip_height and whether bottom_reached.                  ##
        if bottom_reached:
            aspiration_location = water.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
            ## If bottom is reached keep pipetting from bottom + 1         ##
        else:
            aspiration_location = water.bottom(pip_height)
            ## Set the location of where to aspirate from.                 ##

        p20.pick_up_tip()
        p20.aspirate(water_volume, aspiration_location)
        ## Aspirate the amount specified in water_volume from the location ##
        ## specified in aspiration_location. (so a new volume every time   ##
        ## the loop restarts)                                              ##
        p20.dispense(water_volume, destination_well)
        ## Dispense the amount specified in water_volume to the            ##
        ## location specified in well (so a new well and volume every time ##
        ## the loop restarts)                                              ##
        water_mix_volume = water_volume + 3
        p20.mix(3, water_mix_volume, destination_well)
        ## After dispension, mix 3 times with water_volume +3              ##
        p20.dispense(10, destination_well)
        p20.drop_tip()
Example #18
0
def run(protocol: protocol_api.ProtocolContext):
    """
    During the qPCR (project_related/Dina/21june_qPCRs_DINA_EVE.py) we take
    sample, dilute it 100x (pipetting up-and-down 3x with 4.5uL) and then 
    directly transfer the dilution to the PCR plate. With the sample_mix, which
    was added to the plate 8x I saw a lot of variation in Cq values. I'm under
    the impression mixing was not sufficient. In this protocol I want to 
    compare some different mixing techniques, to see if that can be improved.
    """
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================
    ##### Loading labware
    tips_200 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        3,  #deck position
        'tips_200')  #custom name
    tips_20_1 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        10,  #deck position
        'tips_20')  #custom name
    tips_20_2 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        7,  #deck position
        'tips_20')  #custom name
    plate_96_qPCR = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',  #labware definition
        5,  #deck position
        'plate_96_qPCR')  #custom name

    # ##### !!! FOR ROBOT
    # sample_strips_1 = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',         #labware definition
    #     1,                                      #deck position
    #     'sample_strips_1')                      #custom name
    # dilution_strips = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',         #labware definition
    #     4,                                      #deck position
    #     'dilution_strips')                      #custom name
    # tubes_5mL = protocol.load_labware(
    #     'eppendorfscrewcap_15_tuberack_5000ul', #labware definition
    #     6,                                      #deck position
    #     'tubes_5mL')                            #custom name

    ####    !!! FOR SIMULATOR
    with open("labware/pcrstrips_96_wellplate_200ul/"
              "pcrstrips_96_wellplate_200ul.json") as labware_file:
        labware_def_pcrstrips = json.load(labware_file)
        sample_strips_1 = protocol.load_labware_from_definition(
            labware_def_pcrstrips,  #variable derived from opening json
            1,
            'sample_strips_1')
        dilution_strips = protocol.load_labware_from_definition(
            labware_def_pcrstrips,  #variable derived from opening json
            4,
            'dilution_strips')
    with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
              "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
        labware_def_5mL = json.load(labware_file)
        tubes_5mL = protocol.load_labware_from_definition(
            labware_def_5mL,  #variable derived from opening json
            6,
            '5mL_tubes')

    ##### Loading pipettes
    p300 = protocol.load_instrument(
        'p300_single_gen2',  #instrument definition
        'right',  #mount position
        tip_racks=[tips_200])  #assigned tiprack
    p20 = protocol.load_instrument(
        'p20_single_gen2',  #instrument definition
        'left',  #mount position
        tip_racks=[tips_20_1, tips_20_2])  #assigned tiprack

    # =============================================================================

    # VARIABLES TO SET#!!!=========================================================
    # =============================================================================
    start_vol_mix = 2178
    ## The start_vol_m is the volume (ul) of mix that is in the source    ##
    ## labware at the start of the protocol.                              ##
    start_vol_water = 5000
    ## The start_vol_w is the volume (ul) of water that is in the source  ##
    ## labware at the start of the protocol.                              ##
    ##!!! Fill up to above 5mL line                                       ##
    dispension_vol_mix = 22
    ## The dispension_vol_m is the volume (ul) of mastermix that needs to ##
    ## be aliquoted into the destination wells/tubes.                     ##
    dispension_vol_water = 148.5
    ## The dil_vol_w is the volume of water to be pipetted for the        ##
    ## dilution.                                                          ##
    sample_vol_dil = 1.5
    ## The dil_vol_s is the volume of sample to be pipetted for the       ##
    ## 100x dilution.                                                     ##
    sample_vol_pcr = 3
    ## The sample_vol is the volume (ul) of sample added to the PCR       ##
    ## reaction.                                                          ##
    p300.starting_tip = tips_200.well('A1')
    p20.starting_tip = tips_20_1.well('A1')
    ## The starting_tip is the location of first pipette tip in the box   ##

    #### Which wells/tubes are used
    mastermix = tubes_5mL['C1']
    H2O = ([
        tubes_5mL.wells_by_name()[well_name]
        for well_name in ['B1', 'B2', 'B3']
    ])
    sample = sample_strips_1['A1']

    ## where to put mastermix
    PCR_plate = []
    PCR_plate_columns = ([
        plate_96_qPCR.columns_by_name()[column_name] for column_name in
        ['1', '2', '3', '5', '6', '7', '8', '9', '10', '11']
    ])
    for column in PCR_plate_columns:
        for well in column:
            PCR_plate.append(well)

    for well in ([
            plate_96_qPCR.wells_by_name()[well_name]
            for well_name in ['G12', 'H12']
    ]):
        PCR_plate.append(well)
    ## where to put water for dilutions
    dilution_plate = dilution_strips.columns_by_name()['1']

    # =============================================================================

    # PREDIFINED VARIABLES=========================================================
    # =============================================================================
    container_mix = container_water = 'tube_5mL'

    ##### Variables for volume tracking
    start_height_mix = vt.cal_start_height(container_mix, start_vol_mix)
    start_height_water = vt.cal_start_height(container_water, start_vol_water)

    # =============================================================================

    # ALIQUOTING DILUTION WATER AND MASTERMIX======================================
    # =============================================================================

    aliquots = ['water', 'PCR_mix']
    ## what will be aliquoted in this protocol

    for aliquot in aliquots:
        if aliquot == 'PCR_mix':
            source = mastermix
            destination = PCR_plate
            current_height = start_height_mix
            container = container_mix
            dispension_vol = dispension_vol_mix

        elif aliquot == 'water':
            counter = 0  # how many tubes emptied
            source = H2O[counter]
            destination = dilution_plate
            current_height = start_height_water
            container = container_water
            dispension_vol = dispension_vol_water

        for i, well in enumerate(destination):
            ## aliquot mix in entire qPCR plate, for each well do the following:

            aspiration_vol = dispension_vol + (dispension_vol / 100 * 2)
            ## Set correct variables for volume_tracking

            if i == 0:
                p300.pick_up_tip()
                ## If we are at the first well, start by picking up a tip.##
            elif i % 8 == 0:
                p300.drop_tip()
                p300.pick_up_tip()
                ## Then, after every 8th well, drop tip and pick up new   ##

            current_height, pip_height, bottom_reached = vt.volume_tracking(
                container, dispension_vol, current_height)
            ## call volume_tracking function, obtain current_height,  ##
            ## pip_height and whether bottom_reached.                 ##

            if bottom_reached:
                if aliquot == 'water':
                    ## continue with next tube, reset vt
                    current_height = start_height_water
                    current_height, pip_height, bottom_reached = (
                        vt.volume_tracking(container, dispension_vol,
                                           current_height))
                    counter = counter + 1
                    source = H2O[counter]
                    aspiration_location = source.bottom(current_height)
                    protocol.comment("Continue with next tube of water")

                elif aliquot == 'PCR_mix':
                    aspiration_location = source.bottom(z=1)
                    protocol.comment("You've reached the bottom of the tube!")

            else:
                aspiration_location = source.bottom(pip_height)
                ## Set the location of where to aspirate from.            ##

            #### The actual aliquoting of mastermix
            p300.aspirate(aspiration_vol, aspiration_location)
            ## Aspirate the amount specified in aspiration_vol from the   ##
            ## location specified in aspiration_location.                 ##
            p300.dispense(dispension_vol, well)
            ## Dispense the amount specified in dispension_vol to the     ##
            ## location specified in well (looping through plate)         ##
            p300.dispense(10, aspiration_location)
            ## Alternative for blow-out, make sure the tip doesn't fill   ##
            ## completely when using a disposal volume by dispensing some ##
            ## of the volume after each pipetting step. (blow-out too many##
            ## bubbles)                                                   ##
        p300.drop_tip()
        ## when entire plate is full, drop tip                            ##
# =============================================================================

# DILUTING AND DISTRIBUTING SAMPLE MIX=========================================
# =============================================================================

    for mix_method in range(8):

        ## where to dilute
        dilution = dilution_plate[mix_method]

        ## set variables per mix_method
        if mix_method == 0:
            ## 1: Mixing 3x with sample_vol +3. Distribute in 24 wells
            mix_vol = sample_vol_dil + 3
            number_of_mixes = 3
            destination = PCR_plate[:24]
        elif mix_method == 1:
            ## 2: Mixing 5x with sample_vol + 3
            mix_vol = sample_vol_dil + 3
            number_of_mixes = 5
            destination = PCR_plate[24:32]
        elif mix_method == 2:
            ## 3: Mixing 7x with sample_vol + 3
            mix_vol = sample_vol_dil + 3
            number_of_mixes = 7
            destination = PCR_plate[32:40]
        elif mix_method == 3:
            ## 4: Mixing 10x with sample_vol + 3
            mix_vol = sample_vol_dil + 3
            number_of_mixes = 10
            destination = PCR_plate[40:48]
        elif mix_method == 4:
            ## 5: Mixing 3x with 20µL
            mix_vol = 20
            number_of_mixes = 3
            destination = PCR_plate[48:56]
        elif mix_method == 5:
            ## 6: Mixing 5x with 20µL
            mix_vol = 20
            number_of_mixes = 5
            destination = PCR_plate[56:64]
        elif mix_method == 6:
            ## 7: Mixing 7x with 20µL
            mix_vol = 20
            number_of_mixes = 7
            destination = PCR_plate[64:72]
        elif mix_method == 7:
            ## 8: Mixing 10x with 20µL
            mix_vol = 20
            number_of_mixes = 10
            destination = PCR_plate[72:80]

        #### diluting sample                                                ##
        p20.pick_up_tip()
        ## p20 picks up tip from location of specified starting_tip or    ##
        ## the following.                                                 ##
        p20.aspirate(sample_vol_dil, sample)
        ## aspirate sample_volume_dil = volume for dil. from sample_mix   ##
        p20.dispense(sample_vol_dil, dilution)
        ## dispense in dilution tube
        p20.mix(number_of_mixes, mix_vol, dilution)
        ## mix according to mix_method
        p20.dispense(10, dilution)
        ## instead of blow-out                                            ##
        p20.drop_tip()
        ## Drop tip in trashbin on 12.                                    ##

        #### Distribute from dilution to PCR plate                          ##
        for well in destination:
            p20.pick_up_tip()
            p20.aspirate(sample_vol_pcr, dilution)
            ## aspirate sample_vol_pcr from dilution                      ##
            p20.dispense(sample_vol_pcr, well)
            ## dispense into pcr_well                                     ##
            p20.mix(3, 20, well)
            ## Mix 3 times up and down with max pipette vol               ##
            p20.dispense(10, well)
            ## instead of blow-out.                                       ##
            p20.drop_tip()
Example #19
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Alliquoting MasterMix
    Adding samples from 1.5 mL tubes to PCR_strips or plate.
    different DNA volumes + water to add up
    """
# =============================================================================

# LOADING LABWARE AND PIPETTES=================================================
# =============================================================================
    ## For available labware see "labware/list_of_available_labware".        ##
    
    #pipette tips
    tips_200 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul', #labware definition
        9,                                  #deck position
        '200tips')                          #custom name
    
    tips_20_1 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        3,                                  #deck position
        '20tips_1')                         #custom name       
    tips_20_2 = protocol.load_labware(
        'opentrons_96_filtertiprack_20ul',  #labware definition
        6,                                 #deck position
        '20tips_2')                         #custom name

    # Tube_racks & plates
    sample_tubes_1 = protocol.load_labware(
        'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labware def
        1,                                                       #deck position
        'sample_tubes_1')                                        #custom name
    if sample_racks >= 2:
        sample_tubes_2 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labw def
            4,                                                       #deck pos
            'sample_tubes_2')                                        #cust name
    if sample_racks >= 3:
        sample_tubes_3 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labw def
            7,                                                       #deck pos
            'sample_tubes_3')                                        #cust name
    if sample_racks >= 4:
        sample_tubes_4 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labw def
            10,                                                      #deck pos
            'sample_tubes_4')                                        #cust name
   
    if PCR_tubes == 'plate_96': 
        PCR_1 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',    #labware definition
        2,                                  #deck position
        'plate_96')                         #custom name
    
    if PCR_tubes == 'PCR_strips':
   ### !!! OPTION 1: ROBOT         
        # PCR_1 = protocol.load_labware(
        #   'pcrstrips_96_wellplate_200ul',    #labware definition
        #   2,                                 #deck position
        #   'PCR_tube_1')                      #custom name
        # if PCR_racks >= 2:
        #     PCR_2 = protocol.load_labware(
        #           'pcrstrips_96_wellplate_200ul',    #labware definition
        #           5,                                 #deck position
        #           'PCR_tube_2')                      #custom name
        # if PCR_racks >= 3:
        #     PCR_3 = protocol.load_labware(
        #           'pcrstrips_96_wellplate_200ul',    #labware definition
        #           8,                                 #deck position
        #           'PCR_tube_3')                      #custom name
 
    ##### !!! OPTION 2: SIMULATOR         
        with open("labware/pcrstrips_96_wellplate_200ul/"
                    "pcrstrips_96_wellplate_200ul.json") as labware_file:
                  labware_def_pcrstrips = json.load(labware_file)
        PCR_1 = protocol.load_labware_from_definition( 
              labware_def_pcrstrips, #variable derived from opening json
              2,                     #deck position
              'PCR_tube_1')          #custom name
        if PCR_racks >= 2:
            PCR_2 = protocol.load_labware_from_definition( 
                  labware_def_pcrstrips, #variable derived from opening json
                  5,                     #deck position
                  'PCR_tube_2')          #custom name
        if PCR_racks >= 3:
            PCR_3 = protocol.load_labware_from_definition( 
                  labware_def_pcrstrips, #variable derived from opening json
                  8,                     #deck position
                  'PCR_tube_2')          #custom name


    ##### !!! OPTION 1: ROBOT
    # tubes_5mL = protocol.load_labware(
    #     'eppendorfscrewcap_15_tuberack_5000ul', #labware def
    #     11,                                     #deck position
    #     'tubes_5mL')                            #custom name 
   ##### !!! OPTION 2: SIMULATOR      
    with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
                "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
              labware_def_5mL = json.load(labware_file)
    tubes_5mL = protocol.load_labware_from_definition( 
        labware_def_5mL,   #variable derived from opening json
        11,                 #deck position
        'tubes_5mL')  #custom name 
    
    # Pipettes
    p20 = protocol.load_instrument(
        'p20_single_gen2',                  #instrument definition
        'left',                             #mount position
        tip_racks=[tips_20_1, tips_20_2])   #assigned tiprack
    p300 = protocol.load_instrument(
        'p300_single_gen2',                 #instrument definition
        'right',                            #mount position
        tip_racks=[tips_200])               #assigned tiprack    
# =============================================================================

# PREDIFINED VARIABLES=========================================================
# =============================================================================
    ##### Mastermix
    aspiration_vol = dispension_vol + (dispension_vol/100*2)
      ## The aspiration_vol is the volume (ul) that is aspirated from the    ##
      ## container.                                                          ##
    MM_start_height = vt.cal_start_height('tube_5mL', start_vol_MM)
      ## Call start height calculation function from volume tracking module. ##
    MM_current_height = MM_start_height
      ## Set the current height to start height at the beginning of the      ##
      ## protocol.                                                           ##
    
    ##### Water
    w_start_height = vt.cal_start_height('tube_5mL', start_vol_w)
      ## Call start height calculation function from volume tracking module. ##
    w_current_height = w_start_height
      ## Set the current height to start height at the beginning of the      ##
      ## protocol.                                                           ## 
# =============================================================================

# SETTING LOCATIONS============================================================
# =============================================================================
    ##### Setting starting tip                                               ##
    p300.starting_tip = tips_200.well(starting_tip_p200)
    p20.starting_tip = tips_20_1.well(starting_tip_p20)
      ## The starting_tip is the location of first pipette tip in the box    ##

    # Sample source wells
    sample_sources = []
      ## Create an empty list to append wells to.                            ##
    sample_sources = sample_tubes_1.wells()
    if sample_racks >= 2:
        sample_sources = sample_sources + sample_tubes_2.wells()
    if sample_racks >= 3:
        sample_sources = sample_sources + sample_tubes_3.wells()    
    if sample_racks >= 4:
        sample_sources = sample_sources + sample_tubes_4.wells()
    sample_sources = sample_sources[:number_of_samples]
    
    # Destination wells
    sample_destinations = []
      ## Create an empty list to append wells to.                            ##
    if PCR_tubes == 'plate_96':
        sample_destinations = PCR_1.wells()
    elif PCR_tubes == 'PCR_strips':
        PCR_columns = (
            ([PCR_1.columns_by_name()[column_name]
            for column_name in strip_positions]))        
        if PCR_racks >= 2:
            PCR_columns_2 = (
            ([PCR_2.columns_by_name()[column_name]
              for column_name in strip_positions]))
            PCR_columns = PCR_columns + PCR_columns_2
        if PCR_racks >= 3:
            PCR_columns_3 = (
            ([PCR_3.columns_by_name()[column_name]
              for column_name in strip_positions]))
            PCR_columns = PCR_columns + PCR_columns_3
        for column in PCR_columns:
            for well in column:
                sample_destinations.append(well)
                
    sample_destinations = sample_destinations[:number_of_samples]

    ##### Tube locations                                                     ##
    MasterMix = tubes_5mL[mastermix_source]
      ## Location of the 5mL tube with mastermix                             ##
    water = tubes_5mL[water_tube]       
      ## Location of the 5mL tube with water                                 ##

## ALIQUOTING MASTERMIX========================================================
## ============================================================================
    for i, well in enumerate(sample_destinations):
      ## aliquot mix, for each well do the following:                       ##
        if i == 0: 
            p300.pick_up_tip()
              ## If we are at the first well, start by picking up a tip.    ##
        elif i % 16 == 0:
            p300.drop_tip()
            p300.pick_up_tip()
              ## Then, after every 16th well, drop tip and pick up new       ##
    
        MM_current_height, pip_height, bottom_reached = vt.volume_tracking(
                'tube_5mL', dispension_vol, MM_current_height)
                  ## call volume_tracking function, obtain current_height,  ##
                  ## pip_height and whether bottom_reached.                 ##
        
        if bottom_reached:
            aspiration_location = MasterMix.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
              ## If bottom is reached keep pipetting from bottom + 1        ##
        else:
            aspiration_location = MasterMix.bottom(pip_height)
              ## Set the location of where to aspirate from.                ##

        #### The actual aliquoting of mastermix                             ##
        p300.aspirate(aspiration_vol, aspiration_location)
          ## Aspirate the amount specified in aspiration_vol from the       ##
          ## location specified in aspiration_location.                     ##
        p300.dispense(dispension_vol, well)
          ## Dispense the amount specified in dispension_vol to the         ##
          ## location specified in well (so a new well every time the       ##
          ## loop restarts)                                                 ##
        p300.dispense(10, aspiration_location)
          ## Alternative for blow-out, make sure the tip doesn't fill       ##
          ## completely when using a disposal volume by dispensing some     ##
          ## of the volume after each pipetting step. (blow-out to many     ##
          ## bubbles)                                                       ##
    p300.drop_tip()      
# =============================================================================

# ADDING SAMPLES AND WATER=====================================================
# =============================================================================
    ## Loop through source and destination wells
    for sample_tube, well, sample_vol in zip(
            sample_sources, sample_destinations, DNA_µL_list
            ):
        if sample_vol > 0:
            p20.pick_up_tip()
            p20.aspirate(sample_vol, sample_tube)
            p20.dispense(sample_vol, well)
            sample_mix_vol = sample_vol + 3
              ## mix_vol = volume for pipetting up and down                  ##
            p20.mix(3, sample_mix_vol, well)
            p20.dispense(10, well)
            p20.drop_tip()
        
        water_vol = max_DNA_volume - sample_vol
          ## volume of water needed to add a total of max_DNA_volume
        if water_vol > 0:
            
            w_current_height, pip_height, bottom_reached = vt.volume_tracking(
                    'tube_5mL', water_vol, w_current_height)
                   ## call volume_tracking function, obtain current_height,  ##
                   ## pip_height and whether bottom_reached.                 ##
            if bottom_reached:
                aspiration_location = water.bottom(z=1)
                protocol.comment("You've reached the bottom of the tube!")
                  ## If bottom is reached keep pipetting from bottom + 1     ##
            else:
                aspiration_location = water.bottom(pip_height)
                  ## Set the location of where to aspirate from.             ##
            
            p20.pick_up_tip()
            p20.aspirate(water_vol, aspiration_location)
            p20.dispense(water_vol, well)
            mix_vol = water_vol + 3
              ## mix_vol = volume for pipetting up and down                  ##
            p20.mix(3, mix_vol, well)
            p20.dispense(10, well)
            p20.drop_tip()
Example #20
0
def run(protocol: protocol_api.ProtocolContext):
    tiprack = protocol.load_labware(TIPRACK_LOADNAME, TIPRACK_SLOT)
    pipette = protocol.load_instrument(PIPETTE_NAME,
                                       PIPETTE_MOUNT,
                                       tip_racks=[tiprack])

    test_labware = protocol.load_labware_from_definition(
        LABWARE_DEF,
        TEST_LABWARE_SLOT,
        LABWARE_LABEL,
    )

    num_cols = len(LABWARE_DEF.get('ordering', [[]]))
    num_rows = len(LABWARE_DEF.get('ordering', [[]])[0])
    well_locs = uniq(
        ['A1', '{}{}'.format(chr(ord('A') + num_rows - 1), str(num_cols))])

    pipette.pick_up_tip()

    def set_speeds(rate):
        protocol.max_speeds.update({
            'X': (600 * rate),
            'Y': (400 * rate),
            'Z': (125 * rate),
            'A': (125 * rate),
        })

        speed_max = max(protocol.max_speeds.values())

        for instr in protocol.loaded_instruments.values():
            instr.default_speed = speed_max

    set_speeds(RATE)

    for slot in CALIBRATION_CROSS_SLOTS:
        coordinate = CALIBRATION_CROSS_COORDS[slot]
        location = types.Location(point=types.Point(**coordinate),
                                  labware=None)
        pipette.move_to(location)
        protocol.pause(
            f"Confirm {PIPETTE_MOUNT} pipette is at slot {slot} calibration cross"
        )

    pipette.home()
    protocol.pause(f"Place your labware in Slot {TEST_LABWARE_SLOT}")

    for well_loc in well_locs:
        well = test_labware.well(well_loc)
        all_4_edges = [[well._from_center_cartesian(x=-1, y=0, z=1), 'left'],
                       [well._from_center_cartesian(x=1, y=0, z=1), 'right'],
                       [well._from_center_cartesian(x=0, y=-1, z=1), 'front'],
                       [well._from_center_cartesian(x=0, y=1, z=1), 'back']]

        set_speeds(RATE)
        pipette.move_to(well.top())
        protocol.pause("Moved to the top of the well")

        for edge_pos, edge_name in all_4_edges:
            set_speeds(SLOWER_RATE)
            edge_location = types.Location(point=edge_pos, labware=None)
            pipette.move_to(edge_location)
            protocol.pause(f'Moved to {edge_name} edge')

        set_speeds(RATE)
        pipette.move_to(well.bottom())
        protocol.pause("Moved to the bottom of the well")

        pipette.blow_out(well)

    set_speeds(1.0)
    pipette.return_tip()
Example #21
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix from a 5 mL tube to a 96 wells plate;
    Adding primers from PCR strips (with 10 uM primer F&R primer mix) to
    the 96 wells plate.
    """
# =============================================================================


# LOADING LABWARE AND PIPETTES=================================================
# =============================================================================
    ## For available labware see "labware/list_of_available_labware".       ##
    
    # pipette tips
    if dispension_vol > 19:
        tips_200 = protocol.load_labware(
            'opentrons_96_filtertiprack_200ul', #labware definition
            2,                                  #deck position
            '200tips')                          #custom name
        tips_20_1 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  #labware definition
            7,                                  #deck position
            '20tips_1')                         #custom name       
        tips_20_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  #labware definition
            10,                                 #deck position
            '20tips_2')                         #custom name
        tips_20 = [tips_20_1, tips_20_2]
    else:
        tips_20_1 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  #labware definition
            2,                                  #deck position
            '20tips_1')                         #custom name   
        tips_20_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  #labware definition
            7,                                  #deck position
            '20tips_2')                         #custom name       
        tips_20_3 = protocol.load_labware(
            'opentrons_96_filtertiprack_20ul',  #labware definition
            10,                                 #deck position
            '20tips_3')                         #custom name       
        tips_20 = [tips_20_1, tips_20_2, tips_20_3]
    # Tube_racks & plates
    plate_96 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',        #labware definition
        6,                                      #deck position
        'plate_96')                             #custom name     
    if mastermix_tube_type == 'tube_1.5mL':
        mastermix_tube = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
            3,
            'mastermix_tube')
   # ##### !!! OPTION 1: ROBOT      
    # if mastermix_tube_type == 'tube_5mL': 
    #     mastermix_tube = protocol.load_labware(
    #         'eppendorfscrewcap_15_tuberack_5000ul',#labware def
    #         3,                                     #deck position
    #         'mastermix_tube')                      #custom name          
    # primer_strips_1 = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',    #labware definition
    #     4,                                 #deck position
    #     'primer_strips_1')                 #custom name
    # if primer_racks >=2:
    #     primer_strips_2 = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',    #labware definition
    #     1,                                 #deck position
    #     'primer_strips_2')                 #custom name   
    # if primer_racks >=3:
    #     primer_strips_3 = protocol.load_labware(
    #     'pcrstrips_96_wellplate_200ul',    #labware definition
    #     11,                                #deck position
    #     'primer_strips_3')                 #custom name               
   ##### !!! OPTION 2: SIMULATOR      
    if mastermix_tube_type == 'tube_5mL': 
        with open("labware/eppendorfscrewcap_15_tuberack_5000ul/"
                    "eppendorfscrewcap_15_tuberack_5000ul.json") as labware_file:
                  labware_def_5mL = json.load(labware_file)
        mastermix_tube = protocol.load_labware_from_definition( 
            labware_def_5mL,   #variable derived from opening json
            3,                 #deck position
            'mastermix_tube')  #custom name 
    with open("labware/pcrstrips_96_wellplate_200ul/"
              "pcrstrips_96_wellplate_200ul.json") as labware_file:
            labware_def_pcrstrips = json.load(labware_file)
    primer_strips_1 = protocol.load_labware_from_definition( 
        labware_def_pcrstrips, #variable derived from opening json
        4,                     #deck position
        'primer_strips_1')     #custom name  
    if primer_racks >=2:
        primer_strips_2 = protocol.load_labware_from_definition( 
            labware_def_pcrstrips, #variable derived from opening json
            1,                     #deck position
            'primer_strips_2')     #custom name
    if primer_racks >=3:
        primer_strips_3 = protocol.load_labware_from_definition( 
            labware_def_pcrstrips, #variable derived from opening json
            11,                    #deck position
            'primer_strips_3')     #custom name                            
    
    # Pipettes
    if dispension_vol > 19:
        p300 = protocol.load_instrument(
            'p300_single_gen2',             #instrument definition
            'right',                        #mount position
            tip_racks=[tips_200])           #assigned tiprack
    p20 = protocol.load_instrument(
        'p20_single_gen2',                  #instrument definition
        'left',                             #mount position
        tip_racks=tips_20)                  #assigned tiprack
# =============================================================================

# PREDIFINED VARIABLES=========================================================
# =============================================================================
    aspiration_vol = dispension_vol + (dispension_vol/100*2)
      ## The aspiration_vol is the volume (ul) that is aspirated from the   ##
      ## container.                                                         ##
    ##### Variables for volume tracking
    start_height = vt.cal_start_height(mastermix_tube_type, start_vol)
      ## Call start height calculation function from volume tracking module.##
    current_height = start_height
      ## Set the current height to start height at the beginning of the     ##
      ## protocol.                                                          ##
    primer_mix_vol = primer_vol + 3
      ## primer_mix_vol = volume for pipetting up and down                  ##
# =============================================================================

# SETTING LOCATIONS============================================================
# =============================================================================
    ##### Setting starting tip                                              ##
    if dispension_vol > 19:
        p300.starting_tip = tips_200.well(starting_tip_p200)
    p20.starting_tip = tips_20_1.well(starting_tip_p20)
      ## The starting_tip is the location of first pipette tip in the box   ##
    
    ##### Tube locations                                                    ##
    MasterMix = mastermix_tube[mastermix_source]
      ## Location of the 5mL tube with mastermix                            ##
    
    #### Where should mastermix go                                          ##
    number_of_wells = number_of_primers
      ##How many wells do need to be filled with mastermix                  ##
    sample_wells = []
    for well in plate_96.wells():
        sample_wells.append(well)
      ## Make a list with all 96 wells of the plate                         ##
    sample_wells = sample_wells[:number_of_wells]
      ## cuts off the list after a certain number of wells                  ##
    standard_wells = [] 
    if number_std_series > 0:
        std_series_columns = (
        [plate_96.columns_by_name()[column_name] for column_name in
         ['12', '11', '10']])
        std_series_columns = std_series_columns[:number_std_series]
        ## reserve a column at the end of the plate for every std_series
        for column in std_series_columns:
            column = column[:length_std_series]
            for well in column:
                standard_wells.append(well)
          ## cut off the columns after a certain std_series length
    MasterMixAliquots = sample_wells + standard_wells
    
    #### Where are the primers located
    primer_wells = []
      ## Create an empty list to append wells to                            ##
    primer_columns = (
        ([primer_strips_1.columns_by_name()[column_name] 
          for column_name in primer_loc])) 
    if primer_racks >= 2:
        primer_columns2 = (
            ([primer_strips_2.columns_by_name()[column_name] 
              for column_name in primer_loc]))
        for column in primer_columns2:
            primer_columns.append(column)
    if primer_racks >= 3:
        primer_columns3 = (
            ([primer_strips_3.columns_by_name()[column_name] 
              for column_name in primer_loc]))
        for column in primer_columns3:
            primer_columns.append(column)
        ## Make a list of columns, this is a list of lists!                 ##
    
    for column in primer_columns:
        for well in column:
            primer_wells.append(well)
    primer_wells = primer_wells[:number_of_primers]
      ## Separate the columns into wells and append them to list            ##
# =============================================================================

## ALIQUOTING MASTERMIX========================================================
## ============================================================================
    if dispension_vol > 19:
        pipette = p300
    else:
        pipette = p20
    for i, well in enumerate(MasterMixAliquots):
      ## aliquot mix, for each well do the following:                       ##
        if i == 0: 
            pipette.pick_up_tip()
              ## If we are at the first well, start by picking up a tip.    ##
        elif i % 8 == 0:
            pipette.drop_tip()
            pipette.pick_up_tip()
              ## Then, after every 8th well, drop tip and pick up new       ##
    
        current_height, pip_height, bottom_reached = vt.volume_tracking(
                mastermix_tube_type, dispension_vol, current_height)
                  ## call volume_tracking function, obtain current_height,  ##
                  ## pip_height and whether bottom_reached.                 ##
        
        if bottom_reached:
            aspiration_location = MasterMix.bottom(z=1)
            protocol.comment("You've reached the bottom of the tube!")
              ## If bottom is reached keep pipetting from bottom + 1        ##
        else:
            aspiration_location = MasterMix.bottom(pip_height)
              ## Set the location of where to aspirate from.                ##

        #### The actual aliquoting of mastermix                             ##
        pipette.aspirate(aspiration_vol, aspiration_location)
          ## Aspirate the amount specified in aspiration_vol from the       ##
          ## location specified in aspiration_location.                     ##
        pipette.dispense(dispension_vol, well)
          ## Dispense the amount specified in dispension_vol to the         ##
          ## location specified in well (so a new well every time the       ##
          ## loop restarts)                                                 ##
        pipette.dispense(10, aspiration_location)
          ## Alternative for blow-out, make sure the tip doesn't fill       ##
          ## completely when using a disposal volume by dispensing some     ##
          ## of the volume after each pipetting step. (blow-out to many     ##
          ## bubbles)                                                       ##
    pipette.drop_tip()      
# =============================================================================        

## ADDING PRIMERS FOR SAMPLES TO THE MIX=======================================
## ============================================================================
    for primer_well, sample_well in zip(primer_wells, sample_wells):
      ## Loop trough primer_wells and sample_wells                          ##
        p20.pick_up_tip()
        p20.aspirate(primer_vol, primer_well)
        p20.dispense(primer_vol, sample_well)
        p20.mix(3, primer_mix_vol, sample_well)
        p20.dispense(10, sample_well)
        p20.drop_tip()
# =============================================================================    
    
## ADDING PRIMERS FOR STD SERIES TO THE MIX====================================
## ============================================================================   
    for well in standard_wells:
        p20.pick_up_tip()
        p20.aspirate(primer_vol, primer_wells[-1])
          ## use last primer pair for NTC and std series
        p20.dispense(primer_vol, well)
        p20.mix(3, primer_mix_vol, well)
        p20.dispense(10, well)
        p20.drop_tip()