def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting Accustart toughmix with EvaGreen added from a 5 mL tube to a 
     96-wells plate; 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) or
    1.5mL tubes (with 10 uM F or 10 uM R) to 96-wells plate (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
        '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
        5,  #deck position
        'tips_20')  #custom name
    plate_96 = protocol.load_labware('biorad_96_wellplate_200ul_pcr', 4,
                                     'plate_96')
    primer_tubes = protocol.load_labware(
        'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',  #labware def
        1,  #deck position
        'primer_tubes')  #custom name
    ##### !!! OPTION 1: ROBOT
    tubes_5mL = protocol.load_labware(
        'eppendorfscrewcap_15_tuberack_5000ul',  #labware def
        2,  #deck position
        '5mL_tubes')  #custom name
    primer_strips = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',  #labware definition
        7,  #deck position
        'primer strips')  #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
    #          2,                 #deck position
    #          '5mL_tubes')       #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 = protocol.load_labware_from_definition(
    #      labware_def_pcrstrips, #variable derived from opening json
    #      7,                     #deck position
    #      'primer_strips')       #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_1, tips_20_2])  #assigned tiprack
    # =============================================================================

    # ==========================VARIABLES TO SET#!!!===============================
    # =============================================================================
    start_vol = 2226
    ## The start_vol is the volume (ul) that is in the source labware at  ##
    ## the start of the protocol.                                         ##
    dispension_vol = 42
    ## The dispension_vol is the volume (ul) that needs to be aliquoted   ##
    ## into the destination wells/tubes.                                  ##
    primer_vol_label = 3
    ## The primer_vol_label is the volume (ul) of barcoded F&R primer that##
    ## needs to be added to the reactions that get a barcode.             ##
    primer_vol = 1.5
    ## The primer_vol is the volume (ul) of NON barcoded F or R primer    ##
    ## that needs to be added to the reactions that do NOT get a barcode. ##
    p300.starting_tip = tips_200.well('A2')
    p20.starting_tip = tips_20_1.well('A1')
    ## The starting_tip is the location of first pipette tip in the box   ##
    # =============================================================================

    # ==========================PREDIFINED VARIABLES===============================
    # =============================================================================
    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'   	##
    aspiration_vol = dispension_vol + (dispension_vol / 100 * 2)
    ## The aspiration_vol is the volume (ul) that is aspirated from the   ##
    ## container.                                                         ##
    # ==========================creating mix well list=============================
    ## This is a list with wells in plate_96 that should be filled with mastermix##
    mastermix = []
    ## Create an empty list to append wells to for the mastermix wells.   ##
    mm_columns = ([
        plate_96.columns_by_name()[column_name]
        for column_name in ['1', '2', '3', '4', '5', '6']
    ])
    for column in mm_columns:
        for well in column:
            mastermix.append(well)
    ## Separate the columns into wells and append them to the empty       ##
    ## mastermix wells list                                               ##
# ======================create list for labeled primers========================
## This is a list with the wells in primer_strips where the primers should  ##
## be pipetted from. This list is used to pipette the labeled primers       ##
## to the corresponding wells in plate_96 (automatically first ~3.5 columns)##
    labeled_primers = []
    ## Create an empty list to append wells to for the primer wells.      ##
    labeled_primer_columns = ([
        primer_strips.columns_by_name()[column_name]
        for column_name in ['2', '7']
    ])
    ## Make a list of columns for the primers, this is a list of lists!   ##
    for column in labeled_primer_columns:
        for well in column:
            labeled_primers.append(well)
    ## Separate the columns into wells and append them to the empty primer##
    ## wells list                                                         ##
    labeled_primer_wells = ([
        primer_strips.wells_by_name()[well_name]
        for well_name in ['A11', 'B11', 'C11', 'D11', 'E11']
    ])
    ## Make a list of the remaining primer wells.                         ##
    for well in labeled_primer_wells:
        labeled_primers.append(well)
    ## Append the wells to the list of primer wells.                      ##
# =======================create list for unlabeled primers=====================
## This is a list with the wells in plate_96, that should be filled with    ##
## unlabeled primers (so the fish samples, NTCs and the std dilution series)##
## --> for the wells that do not get labeled primer                         ##
    unlabeled_primer_dest = []
    ## Create an empty list to append the wells where the unlabeled       ##
    ## primers should go.                                                 ##
    unlabeled_primer_wells = ([
        plate_96.wells_by_name()[well_name]
        for well_name in ['F3', 'G3', 'H3']
    ])
    for well in unlabeled_primer_wells:
        unlabeled_primer_dest.append(well)
    unlabeled_primer_columns = ([
        plate_96.columns_by_name()[column_name]
        for column_name in ['4', '5', '6']
    ])
    for column in unlabeled_primer_columns:
        for well in column:
            unlabeled_primer_dest.append(well)
# =============================================================================
##### 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 = tubes_5mL['C1'].bottom(z=1)  #!!!
            protocol.comment("You've reached the bottom!")
        else:
            aspiration_location = tubes_5mL['C1'].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 LABELED PRIMERS=============================
    # =============================================================================
    ## For the columns in both the source (primers) and the destination:        ##
    ## loop trough the wells in those columns.                                  ##
    for primer_tube, mix_tube in zip(labeled_primers, mastermix):
        p20.pick_up_tip()
        p20.aspirate(primer_vol_label, primer_tube)
        ## primer_mix_vol = volume for pipetting up and down                ##
        primer_mix_vol = primer_vol_label + 3
        p20.mix(3, primer_mix_vol, mix_tube)
        ## primer_dispense_vol = volume to dispense that was mixed          ##
        primer_dispense_vol = primer_mix_vol + 3
        p20.dispense(primer_dispense_vol, mix_tube)
        p20.drop_tip()
# =============================================================================

# ==========================ADDING UNLABELED PRIMERS===========================
# =============================================================================
## For the wells in unlabeld_primer_dest (the wells with unlabeled primers) do:
##FORWARD
    for well in unlabeled_primer_dest:
        p20.pick_up_tip()
        p20.aspirate(primer_vol, primer_tubes['A1'])
        ## primer_mix_vol = volume for pipetting up and down            ##
        primer_mix_vol = primer_vol + 3
        p20.mix(3, primer_mix_vol, well)
        ## primer_dispense_vol = volume to dispense that was mixed      ##
        primer_dispense_vol = primer_mix_vol + 3
        p20.dispense(primer_dispense_vol, well)
        p20.drop_tip()
    ##REVERSE
    for well in unlabeled_primer_dest:
        p20.pick_up_tip()
        p20.aspirate(primer_vol, primer_tubes['B1'])
        ## primer_mix_vol = volume for pipetting up and down            ##
        primer_mix_vol = primer_vol + 3
        p20.mix(3, primer_mix_vol, well)
        ## primer_dispense_vol = volume to dispense that was mixed      ##
        primer_dispense_vol = primer_mix_vol + 3
        p20.dispense(primer_dispense_vol, well)
        p20.drop_tip()
Esempio n. 2
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix from a 5 mL tube to a 96 wells plate;
    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)
    the 96 wells plate.
    """
# =============================================================================


# ======================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
        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           
    
    # Tube_racks & plates
    plate_96 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',    #labware definition
        6,                                  #deck position
        'plate_96')                         #custom name     
   ##### !!! OPTION 1: ROBOT      
    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
    primer_strips_2 = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',    #labware definition
        1,                                 #deck position
        'primer_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
    #     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  
    # primer_strips_2 = protocol.load_labware_from_definition( 
    #     labware_def_pcrstrips, #variable derived from opening json
    #     1,                     #deck position
    #     'primer_strips_2')     #custom name                            
    
    # 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 = 2520 
      ## The start_vol is the volume (ul) that is in the source labware at  ##
      ## the start of the protocol.                                         ##
    dispension_vol = 42 
      ## The dispension_vol is the volume (ul) that needs to be aliquoted   ##
      ## into the destination wells/tubes.                                  ##
    primer_vol = 3 
      ## The primer_vol is the volume (ul) of primer added to the PCR       ##
      ## reaction.                                                          ##
    p300.starting_tip = tips_200.well('F2')
    p20.starting_tip = tips_20_1.well('H8')
      ## 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']
    std_dilution_primer = primer_strips_2['B11']
# Mastermix destination wells==================================================
    mastermix = []
      ## Create an empty list to append wells to                            ##
    mastermix_columns = (
        [plate_96.columns_by_name()[column_name] for column_name in
         ['1', '2', '3', '4', '5']]
        )
      ## Make a list of columns, 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 list            ##
    mastermix_wells = (
        [plate_96.wells_by_name()[well_name] for well_name in
         ['A6', 'B6',
          'A11', 'B11', 'C11', 'D11', 'E11', 'F11',
          'A12', 'B12', 'C12', 'D12', 'E12', 'F12']]
        )
      ## Make a list of separate wells                                      ## 
    for well in mastermix_wells:
        mastermix.append(well)
      ## Append the wells to the list                                       ## 
# Primer source tubes==========================================================
    primers = []
      ## Create an empty list to append wells to                            ##
    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']] 
        )
      ## Make a list of columns, 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 list            ##                                       
    primer_wells = (
        [primer_strips_2.wells_by_name()[well_name] for well_name in
         ['A11', 'B11']]
        ) 
      ## Make a list of separate wells                                      ## 
    for well in primer_wells:
        primers.append(well)
      ## Append the wells to the list                                       ##
# Primer destinations - standard dilution series===============================
    std_primer_dests = []
      ## Create an empty list to append the destination wells to.           ##
    std_wells = (
        [plate_96.wells_by_name()[well_name] for well_name in
         ['A11', 'B11', 'C11', 'D11', 'E11', 'F11',
          'A12', 'B12', 'C12', 'D12', 'E12', 'F12']]
        )
      ## make a list of the primer wells                                     ##
    for well in std_wells:
        std_primer_dests.append(well)
# =============================================================================


# ==========================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 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 a new one.    ##
        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, the pip_height and calculates the          ##
          ## delta_height of the liquid after the next aspiration step.     ##
        if bottom_reached: 
            aspiration_location = mastermix_source.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 TO SAMPLES===========================
# =============================================================================
    ## 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()
# =============================================================================


# ===================ADDING PRIMERS TO STD DILUTION SERIES=====================
# =============================================================================
    ## For the columns in both the source (primers) and the destination     ##
    ## (mix): loop trough the wells in those columns.                       #
    for well in std_primer_dests:
        p20.pick_up_tip()
        p20.aspirate(primer_vol, std_dilution_primer)
        p20.dispense(primer_vol, well)
        primer_mix_vol = primer_vol + 3
        ## primer_mix_vol = volume for pipetting up and down                ##
        p20.mix(3, primer_mix_vol, well)
        p20.dispense(10, well)
        p20.drop_tip()
Esempio n. 3
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                                              ##


# =============================================================================
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
    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

    # Tube_racks & plates
    plate_96 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',  #labware definition
        6,  #deck position
        'plate_96')  #custom name
    ##### !!! OPTION 1: ROBOT
    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
# 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
    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
    # =============================================================================

    # 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.                                                          ##
    primer_mix_vol = primer_vol + 3
    ## primer_mix_vol = volume for pipetting up and down                  ##
    # =============================================================================

    # 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 = 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========================================================
    ## ============================================================================
    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 % 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, 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 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[41])
        ## use specific primer pair for std series
        p20.dispense(primer_vol, well)
        p20.mix(3, primer_mix_vol, well)
        p20.dispense(10, well)
        p20.drop_tip()
def run(protocol: protocol_api.ProtocolContext):
    """
    aliquoting a specific volume from 15mL tubes to 96 wells plates
    """
    # =============================================================================

    # VARIABLES TO SET#!!!=========================================================
    # =============================================================================
    number_of_plates = 4
    ## How many plates you want filled? (max 6 for now)
    volume = 50
    ## How much volume (µL) to aliquot?
    reagent_volume = 13000
    ## How much volume (µL) in 15mL tubes (all the same volume)
    starting_tip_p200 = 'F12'
    # =============================================================================

    # CALCULATED VARIABLES=========================================================
    # =============================================================================
    necessary_volume = volume * (number_of_plates * 96)
    ## How much water is needed for per sample
    number_of_tubes = math.ceil((necessary_volume + 2000) / reagent_volume)
    ## How many tubes of 15mL are needed (2mL extra)
    # =============================================================================

    # LOADING LABWARE AND PIPETTES=================================================
    # =============================================================================
    ##### Loading labware
    tips_200_1 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        10,  #deck position
        'tips_200_1')  #custom name
    tips_200_2 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',  #labware definition
        11,  #deck position
        'tips_200_2')  #custom name

    tubes_15mL = protocol.load_labware(
        'opentrons_15_tuberack_falcon_15ml_conical',  #labware definition
        7,  #deck position
        'tubes_15mL')  #custom name

    plate_96_1 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',  #labware definition
        1,  #deck position
        'plate_96_1')  #custom name
    if number_of_plates >= 2:
        plate_96_2 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            2,  #deck position
            'plate_96_2')  #custom name
    if number_of_plates >= 3:
        plate_96_3 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            3,  #deck position
            'plate_96_3')  #custom name
    if number_of_plates >= 4:
        plate_96_4 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            4,  #deck position
            'plate_96_4')  #custom name
    if number_of_plates >= 5:
        plate_96_5 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            5,  #deck position
            'plate_96_5')  #custom name
    if number_of_plates >= 6:
        plate_96_6 = protocol.load_labware(
            'biorad_96_wellplate_200ul_pcr',  #labware definition
            6,  #deck position
            'plate_96_6')  #custom name

    ##### Loading pipettes
    p300 = protocol.load_instrument(
        'p300_single_gen2',  #instrument definition
        'right',  #mount position
        tip_racks=[tips_200_1, tips_200_2])  #assigned tiprack
    # =============================================================================

    # SETTING LOCATIONS#!!!========================================================
    # =============================================================================
    ##### Setting starting tip
    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
    reagent = []
    for well in tubes_15mL.wells():
        reagent.append(well)
    reagent = reagent[:number_of_tubes]

    aliquots = []
    for well in plate_96_1.wells():
        aliquots.append(well)
    if number_of_plates > 1:
        for well in plate_96_2.wells():
            aliquots.append(well)
    if number_of_plates > 2:
        for well in plate_96_3.wells():
            aliquots.append(well)
    if number_of_plates > 3:
        for well in plate_96_4.wells():
            aliquots.append(well)
    if number_of_plates > 4:
        for well in plate_96_5.wells():
            aliquots.append(well)
    if number_of_plates > 5:
        for well in plate_96_6.wells():
            aliquots.append(well)
    ## Add all wells of all plates to a list                              ##

# MESSAGE AT THE START=========================================================
# =============================================================================
    protocol.pause("I need " + str(number_of_tubes) +
                   " 15mL tubes. Filled to " + reagent_volume +
                   " µL with reagent.")
    # =============================================================================

    # TURN RAIL LIGHT ON===========================================================
    # =============================================================================
    protocol.set_rail_lights(True)
    # =============================================================================

    # ALIQUOTING ==================================================================
    # =============================================================================
    ##### Variables for volume tracking and aliquoting
    counter = 0  # to count how many tubes already emptied
    source = reagent[counter]
    destination = aliquots
    start_height = vt.cal_start_height('tube_15mL', reagent_volume)
    current_height = start_height
    container = 'tube_15mL'

    ##### aliquoting
    for i, well in enumerate(destination):
        ## aliquot in the correct wells, 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 % 24 == 0:
            p300.drop_tip()
            p300.pick_up_tip()
            ## Then, after every 24th well, drop tip and pick up new      ##

        current_height, pip_height, bottom_reached = vt.volume_tracking(
            container, volume, 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, volume, current_height))
            counter = counter + 1
            source = reagent[counter]
            aspiration_location = source.bottom(current_height)
            protocol.comment("Continue with tube " + str(counter + 1) +
                             " of reagent")

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

        #### The actual aliquoting
        p300.aspirate(volume, aspiration_location)
        ## Aspirate the set volume from the source                        ##
        p300.dispense(volume + 10, well)
        ## dispense the set volume + extra to avoid drops in the well     ##
        p300.dispense(10, aspiration_location)
        ## Alternative for blow-out                                       ##

    p300.drop_tip()
    ## when entire plate is full, drop tip                                ##
    # =============================================================================

    # TURN RAIL LIGHT OFF==========================================================
    # =============================================================================
    protocol.set_rail_lights(False)


# =============================================================================
Esempio n. 6
0
def run(protocol: protocol_api.ProtocolContext):
    """
    general protocol for multiple qPCRs of a batch. 
    Samples will be diluted. 
    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.
    First aliquot water for diluting samples into a 96_wells plate.
    The source = 3 5mL tubes. Use volume tracking, which resets after every
    tube. 
    Then aliquoting Phusion PCRmix with EvaGreen added from a 5 mL tube to a 
    96-wells plate; use volume tracking.
    After that, dilute samples 100x and add to PCR mix.
    Also include a standard sample mix (dilute one time but 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 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',  #labware definition
        4,  #deck position
        'plate_96_dil')  #custom name

    ##### !!! FOR ROBOT
    sample_strips_1 = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',  #labware definition
        1,  #deck position
        'sample_strips_1')  #custom name
    sample_strips_2 = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',  #labware definition
        2,  #deck position
        'sample_strips_2')  #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')
    #         sample_strips_2 = protocol.load_labware_from_definition(
    #         labware_def_pcrstrips, #variable derived from opening json
    #         2,
    #         'sample_strips_2')
    # 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#!!!=========================================================
    # =============================================================================
    number_of_samples = 80
    ## How many samples will you include in this PCR                      ##
    number_std_series = 0
    ## How many dilution series do you want to include in this PCR        ##
    start_vol_mix = 2134
    ## 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('H3')
    p20.starting_tip = tips_20_1.well('A10')
    ## 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_mix = sample_strips_2['H12']

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

    # 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)

    ##### Location determination for different steps
    columns_odd = ['1', '3', '5', '7', '9', '11']
    columns_all = [
        '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'
    ]

    ## Where the samples are located                                      ##
    samples = []
    sample_columns = (([
        sample_strips_1.columns_by_name()[column_name]
        for column_name in columns_odd
    ]) + ([
        sample_strips_2.columns_by_name()[column_name]
        for column_name in columns_odd
    ]))
    for column in sample_columns:
        for well in column:
            samples.append(well)
    ## makes a list of all wells in 2 full plates of PCR strips           ##
    samples = samples[:number_of_samples]
    ## cuts off the list after certain number of samples                  ##

    ## Where the samples go in the PCR plate                              ##
    sample_dest = []
    sample_dest_columns = ([
        plate_96_qPCR.columns_by_name()[column_name]
        for column_name in columns_all[number_std_series + 1:]
    ])
    ## skip columns for dilution series and 1 column for sample_mix       ##
    for column in sample_dest_columns:
        for well in column:
            sample_dest.append(well)
    ## makes a list of all wells after dilution series and sample_mix     ##
    sample_dest = sample_dest[:number_of_samples]
    ## cuts off the list after a certain number of samples                ##

    ## 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                                                               ##
# =============================================================================

# ALIQUOTING DILUTION WATER AND MASTERMIX======================================
# =============================================================================
    number_of_mix_wells = number_of_samples + 8 + (number_std_series * 8)
    ## number of wells in the plate, mastermix will be aliquoted to       ##
    ## number_of_samples + 8x sample_mix for uniforming over PCRs         ##
    ## + 8 wells per dilution series                                      ##

    PCR_plate = plate_96_qPCR.wells()
    PCR_plate = PCR_plate[:number_of_mix_wells]
    dilution_plate = plate_96_dil.wells()
    dilution_plate = dilution_plate[:number_of_samples + 1]
    ## How many wells do need to be filled depends on the number of       ##
    ## samples and dilution series. (+1 is for sample_mix                 ##

    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 SAMPLES============================================
# =============================================================================
    for sample, dilution_well, pcr_well in zip(samples, dilution_plate,
                                               sample_dest):
        ## Combine each sample with a dilution_well and a destination well    ##
        p20.pick_up_tip()
        ## p20 picks up tip from location of specified starting_tip       ##
        ## or following                                                   ##
        p20.aspirate(sample_vol_dil, sample)
        ## aspirate sample_volume_dil = volume for dilution from sample   ##
        p20.dispense(sample_vol_dil, dilution_well)
        ## dispense sample_volume_dil = volume for dilution into dil_well ##
        mix_vol = sample_vol_dil + 3
        ## Set volume for mixing up and down.                             ##
        for i in range(3):
            p20.aspirate(mix_vol, dilution_well)
            p20.dispense(mix_vol, dilution_well)
            ## Mix 3 times up and down with sample volume +3.             ##
        p20.aspirate(sample_vol_pcr, dilution_well)
        ## aspirate sample_vol_mix = volume for in mastermix from dil_well##
        p20.dispense(sample_vol_pcr, pcr_well)
        ## dispense sample_vol_mix = volume for in mastermix into pcr_well##
        mix_vol = sample_vol_pcr + 3
        ## Set volume for mixing up and down.                             ##
        for i in range(3):
            p20.aspirate(mix_vol, pcr_well)
            p20.dispense(mix_vol, pcr_well)
            ## Mix 3 times up and down with sample volume +3.             ##
        sample_dispense = mix_vol + 3
        ## Set extra dispension volume after mixing to mix volume +3.     ##
        p20.dispense(sample_dispense, pcr_well)
        ## Dispese the mix volume + 3 in the well.                        ##
        p20.drop_tip()
        ## Drop tip in trashbin on 12.                                    ##

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

#### diluting sample mix.                                               ##
    p20.pick_up_tip()
    ## p20 picks up tip from location of specified starting_tip or        ##
    ## the following.                                                     ##
    p20.aspirate(sample_vol_dil, sample_mix)
    ## aspirate sample_volume_dil = volume for dil. from sample_mix       ##
    p20.dispense(sample_vol_dil, dilution_plate[-1])
    ## dispense sample_volume_dil = volume for dilution into dil_well     ##
    mix_vol = sample_vol_dil + 3
    ## Set volume for mixing up and down.                                 ##
    for i in range(3):
        p20.aspirate(mix_vol, dilution_plate[-1])
        p20.dispense(mix_vol, dilution_plate[-1])
        ## Mix 3 times up and down with sample volume +3.                 ##
    p20.drop_tip()

    #### Distribute from dilution plate to entire column in PCR plate       ##
    for well in sample_mix_dest:
        p20.pick_up_tip()
        p20.aspirate(sample_vol_pcr, dilution_plate[-1])
        ## aspirate sample_vol_pcr = volume for in mastermix from dil_well##
        p20.dispense(sample_vol_pcr, well)
        ## dispense sample_vol_mix = volume for in mastermix into pcr_well##
        mix_vol = sample_vol_pcr + 3
        ## Set volume for mixing up and down.                             ##
        for i in range(3):
            p20.aspirate(mix_vol, well)
            p20.dispense(mix_vol, well)
            ## Mix 3 times up and down with sample volume +3.             ##
        sample_dispense = mix_vol + 3
        ## Set extra dispension volume after mixing to mix volume +3.     ##
        p20.dispense(sample_dispense, well)
        ## Dispese the mix volume + 3 in the well.                        ##
        p20.drop_tip()
Esempio n. 7
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Pipette 30uL of water from a 5mL tube to 12 PCR strips.
    Using a new tip for every step so that we can check if there is no big
    difference between volumes from different pipette tip locations.
    """
    # =============================================================================

    # ======================LOADING LABWARE AND PIPETTES===========================
    # =============================================================================
    ## For available labware see "labware/list_of_available_labware".       ##
    # Pipette tips
    ##### !!! OPTION 1: ROBOT
    tip_one_300 = protocol.load_labware(
        'tipone_96_tiprack_300ul',  #labware definition
        1,  #deck position
        '300tips')  #custom name
    ##### !!! OPTION 2: SIMULATOR
    # with open("labware/tipone_96_tiprack_300ul/"
    #             "tipone_96_tiprack_300ul.json") as labware_file:
    #           labware_def_tips = json.load(labware_file)
    # tip_one_300 = protocol.load_labware_from_definition(
    #     labware_def_tips,   #variable derived from opening json
    #     1,                  #deck position
    #     '300tips')          #custom name

    # Tube_racks & plates
    ##### !!! OPTION 1: ROBOT
    source_tube = protocol.load_labware(
        'eppendorfscrewcap_15_tuberack_5000ul',  #labware def
        2,  #deck position
        'source_tube')  #custom name
    strips_1 = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',  #labware definition
        7,  #deck position
        'strips_1')  #custom name
    strips_2 = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',  #labware definition
        4,  #deck position
        'strips_2')  #custom name
    strips_3 = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',  #labware definition
        8,  #deck position
        'strips_3')  #custom name
    strips_4 = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',  #labware definition
        5,  #deck position
        'strips_4')  #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)
    # source_tube = protocol.load_labware_from_definition(
    #     labware_def_5mL,          #variable derived from opening json
    #     2,                        #deck position
    #     'source_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)
    # strips_1 = protocol.load_labware_from_definition(
    #     labware_def_pcrstrips,    #variable derived from opening json
    #     7,                        #deck position
    #     'strips_1')               #custom name
    # strips_2 = protocol.load_labware_from_definition(
    #     labware_def_pcrstrips,    #variable derived from opening json
    #     4,                        #deck position
    #     'strips_2')               #custom name
    # strips_3 = protocol.load_labware_from_definition(
    #     labware_def_pcrstrips,    #variable derived from opening json
    #     8,                        #deck position
    #     'strips_3')               #custom name
    # strips_4 = protocol.load_labware_from_definition(
    #     labware_def_pcrstrips,    #variable derived from opening json
    #     5,                        #deck position
    #     'strips_4')               #custom name

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

    # ==========================VARIABLES TO SET#!!!===============================
    # =============================================================================
    start_vol = 3000
    ## The start_vol is the volume (ul) that is in the source labware at  ##
    ## the start of the protocol.                                         ##
    dispension_vol = 30
    ## The dispension_vol is the volume (ul) that needs to be aliquoted   ##
    ## into the destination wells/tubes.                                  ##
    p300.starting_tip = tip_one_300.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'   	##
    source = source_tube['C1']
    # Destination wells============================================================
    destinations = []
    ## Create an empty list to append wells to                            ##
    destination_columns = ([
        strips_1.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ] + [
        strips_2.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ] + [
        strips_3.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ] + [
        strips_4.columns_by_name()[column_name]
        for column_name in ['2', '7', '11']
    ])
    ## Make a list of columns, this is a list of lists!                   ##
    for column in destination_columns:
        for well in column:
            destinations.append(well)
# =============================================================================

# ==========================PREDIFINED VARIABLES===============================
# =============================================================================
    aspiration_vol = dispension_vol
    ## 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==================================
    # =============================================================================
    ## 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 well in destinations:
        ## Name all the wells in the plate 'well', for all these do:            ##
        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, the pip_height and calculates the          ##
        ## delta_height of the liquid after the next aspiration step.     ##
        if bottom_reached:
            aspiration_location = source.bottom(z=1)  #!!!
            protocol.comment("You've reached the bottom!")
        else:
            aspiration_location = 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.drop_tip()


# =============================================================================
Esempio n. 8
0
def run(protocol: protocol_api.ProtocolContext):
    """
    Aliquoting mastermix from a 5 mL tube to a 96 wells plate or tube strips
    Then adding sample in a fixed volume
    Samples can be in strips, plate or 1.5mL tubes
    """
# =============================================================================


# 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
    if sample_vol > 17:
        tips_200_2 = protocol.load_labware(
            'opentrons_96_filtertiprack_200ul', #labware definition
           8,                                  #deck position
           '200tips_2')                          #custom name
    else:
        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
            9,                                 #deck position
            '20tips_2')                         #custom name   

    # Tube_racks & plates
    if PCR_tubes == 'plate_96': 
        PCR_tube_1 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',    #labware definition
        4,                                  #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
        4,                                 #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
                6,                                 #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_tube_1 = protocol.load_labware_from_definition( 
        #     labware_def_pcrstrips, #variable derived from opening json
        #     4,                     #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
        #         6,                     #deck position
        #         'PCR_tube_3')          #custom name      

    if sample_tubes == 'plate_96': 
        sample_tube_1 = protocol.load_labware(
        'biorad_96_wellplate_200ul_pcr',    #labware definition
        1,                                  #deck position
        'sample_plate_96')                         #custom name

    if sample_tubes == 'PCR_strips':
   ##### !!! OPTION 1: ROBOT         
        sample_tube_1 = protocol.load_labware(
        'pcrstrips_96_wellplate_200ul',    #labware definition
        1,                                 #deck position
        'sample_tube_1')                      #custom name
        if sample_racks >= 2:
            sample_tube_2 = protocol.load_labware(
                'pcrstrips_96_wellplate_200ul',    #labware definition
                2,                                 #deck position
                'sample_tube_2')                      #custom name
        if sample_racks >= 3:
            sample_tube_3 = protocol.load_labware(
                'pcrstrips_96_wellplate_200ul',    #labware definition
                3,                                 #deck position
                'sample_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)
        # sample_tube_1 = protocol.load_labware_from_definition( 
        #     labware_def_pcrstrips, #variable derived from opening json
        #     1,                     #deck position
        #     'sample_tube_1')       #custom name
        # if sample_racks >= 2:
        #     sample_tube_2 = protocol.load_labware_from_definition( 
        #         labware_def_pcrstrips, #variable derived from opening json
        #         2,                     #deck position
        #         'sample_tube_2')       #custom name           
        # if sample_racks >= 3:
        #     sample_tube_3 = protocol.load_labware_from_definition( 
        #         labware_def_pcrstrips, #variable derived from opening json
        #         3,                     #deck position
        #         'sample_tube_3')       #custom name

    if sample_tubes == 'tubes_1.5mL':
        sample_tube_1 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
            1,
            'sample_tube_1')
        if sample_racks >= 2:
            sample_tube_2 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                2,
                'sample_tube_2')           
        if sample_racks >= 3:
            sample_tube_3 = protocol.load_labware(
                'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',
                3,
                'sample_tube_3')               

    ##### !!! OPTION 1: ROBOT
    mastermix_tube = protocol.load_labware(
        'eppendorfscrewcap_15_tuberack_5000ul', #labware def
        7,                                      #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
    #     7,                 #deck position
    #     'mastermix_tube')  #custom name 


    # Pipettes
    if sample_vol > 17:
       tip_racks = [tips_200, tips_200_2]
    else:
        tip_racks = [tips_200]
    p300 = protocol.load_instrument(
        'p300_single_gen2',                 #instrument definition
        'right',                            #mount position
        tip_racks)               #assigned tiprack
    if sample_vol <= 17:
        p20 = protocol.load_instrument(
            'p20_single_gen2',                  #instrument definition
            'left',                             #mount position
            tip_racks=[tips_20_1, tips_20_2])   #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)
    if sample_vol <= 17:
        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_samples + number_of_NTCs
      ##How many wells do need to be filled with mastermix                  ##
    MasterMixAliquots = []
    if PCR_tubes == 'plate_96':
        MasterMixAliquots = PCR_tube_1.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
        for column in PCR_columns:
            for well in column:
                MasterMixAliquots.append(well)
      ## Make a list with all wells for PCR                                 ##
    sample_destinations = MasterMixAliquots[:number_of_samples]
    MasterMixAliquots = MasterMixAliquots[:number_of_wells]
      ## cuts off the list after a certain number of wells                  ##
    
    # Sample source wells
    sample_sources = []
      ## Create an empty list to append wells to.                           ##
    if sample_tubes == 'plate_96' or sample_tubes == 'tubes_1.5mL':
        sample_sources = sample_tube_1.wells()
        if sample_racks >= 2:
            sample_sources = sample_sources + sample_tube_2.wells()
            if sample_racks >= 3:
                sample_sources = sample_sources + sample_tube_3.wells()    
    elif sample_tubes == 'PCR_strips':
        sample_columns = (
            ([sample_tube_1.columns_by_name()[column_name]
            for column_name in sample_strip_positions]))
        if sample_racks >= 2:
            sample_columns_2 = (
            ([sample_tube_2.columns_by_name()[column_name]
              for column_name in sample_strip_positions]))
            sample_columns = sample_columns + sample_columns_2
        if sample_racks >= 3:
            sample_columns_3 = (
            ([sample_tube_3.columns_by_name()[column_name]
              for column_name in sample_strip_positions]))
            sample_columns = sample_columns + sample_columns_3
        for column in sample_columns:
            for well in column:
                sample_sources.append(well)
    sample_sources = sample_sources[:number_of_samples]    
   
# =============================================================================

## 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()      
# =============================================================================        

## ADDING SAMPLE===============================================================
## ============================================================================
    if sample_vol <= 17:
        pipette = p20
    else:
        pipette = p300
    for sample_tube, well in zip(
            sample_sources, sample_destinations):
        pipette.pick_up_tip()
        pipette.aspirate(sample_vol, sample_tube)
        pipette.dispense(sample_vol, well)
        sample_mix_vol = sample_vol + 3
          ## primer_mix_vol = volume for pipetting up and down              ##
        pipette.mix(3, sample_mix_vol, well)
        pipette.dispense(10, well)
        pipette.drop_tip()        
    
# =============================================================================
Esempio n. 9
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()
Esempio n. 10
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. Also a test with multiple mix 
    methods did not give satisfactory results. In this protocol I want to 
    compare 100x diluting with 2x 10x diluting with manually mixing.
    """
    # =============================================================================

    # 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 = 1012
    ## 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 = 1000
    ## 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_water1 = 148.5
    ## The dil_vol_w is the volume of water to be pipetted for the        ##
    ## dilution.                                                          ##
    dispension_vol_water2 = 18
    ## The dil_vol_w is the volume of water to be pipetted for the        ##
    ## dilution.                                                          ##
    sample_vol_dil1 = 1.5
    ## The dil_vol_s is the volume of sample to be pipetted for the       ##
    ## 100x dilution.                                                     ##
    sample_vol_dil2 = 2
    ## 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('D5')
    p20.starting_tip = tips_20_1.well('A5')
    ## 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', '3', '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 [
                'A5', 'B5', 'C5', 'D5', 'E5', 'A7', 'B7', 'C7', 'D7', 'E7',
                'A9', 'B9', 'C9', 'D9', 'E9', 'G12', 'H12'
            ]
    ]):
        PCR_plate.append(well)

    ## where to put water for dilutions
    dilution_plate = dilution_strips.columns_by_name()['1']
    dilution_plate1 = []
    dilution_plate2 = []
    for well in ([
            dilution_strips.wells_by_name()[well_name]
            for well_name in ['A1', 'B1']
    ]):
        dilution_plate1.append(well)
    for well in ([
            dilution_strips.wells_by_name()[well_name]
            for well_name in ['C1', 'D1', 'E1', 'F1', 'G1', 'H1']
    ]):
        dilution_plate2.append(well)

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

# 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 = ['water1', 'water2', '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 == 'water1':
            counter = 0  # how many tubes emptied
            source = H2O[counter]
            destination = dilution_plate1
            current_height = start_height_water
            container = container_water
            dispension_vol = dispension_vol_water1
        elif aliquot == 'water2':
            source = H2O[counter]
            destination = dilution_plate2
            dispension_vol = dispension_vol_water2

        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(5):

        ## where to dilute
        dilution = dilution_plate[mix_method]

        ## set variables per mix_method
        if mix_method == 0:
            ## 1: 100x dilution, mixing 20µL 3x
            number_of_mixes = 3
            destination = plate_96_qPCR.columns_by_name()['1']
            sample_vol_dil = sample_vol_dil1
        elif mix_method == 1:
            ## 2: 100x dultion, mixing 20µL 10x
            number_of_mixes = 10
            destination = plate_96_qPCR.columns_by_name()['3']
            sample_vol_dil = sample_vol_dil1
        elif mix_method == 2:
            ## 3: 2x (10x dilution, mixing 20µL 3x)
            number_of_mixes = 3
            destination = ([
                plate_96_qPCR.wells_by_name()[well_name]
                for well_name in ['A5', 'B5', 'C5', 'D5', 'E5']
            ])
            sample_vol_dil = sample_vol_dil2
        elif mix_method == 3:
            ## 4: 2x (10x dilution, mixing 20µL 5x)
            number_of_mixes = 5
            destination = ([
                plate_96_qPCR.wells_by_name()[well_name]
                for well_name in ['A7', 'B7', 'C7', 'D7', 'E7']
            ])
            sample_vol_dil = sample_vol_dil2
        elif mix_method == 4:
            ## 5: 2x (10x dilution, mixing 20µL 10x)
            number_of_mixes = 10
            destination = ([
                plate_96_qPCR.wells_by_name()[well_name]
                for well_name in ['A9', 'B9', 'C9', 'D9', 'E9']
            ])
            sample_vol_dil = sample_vol_dil2

        #### 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, 20, dilution)
        ## mix according to mix_method
        p20.dispense(10, dilution)
        ## instead of blow-out                                            ##

        ## second dilution step
        if mix_method == 2 or mix_method == 3 or mix_method == 4:
            p20.aspirate(sample_vol_dil, dilution)
            ## aspirate sample_volume_dil = volume for dil. from sample   ##

            ## destinations for second dilution step
            if mix_method == 2:
                dilution = dilution_strips.wells_by_name()['F1']
            elif mix_method == 3:
                dilution = dilution_strips.wells_by_name()['G1']
            elif mix_method == 4:
                dilution = dilution_strips.wells_by_name()['H1']

            p20.dispense(sample_vol_dil, dilution)
            ## dispense in dilution tube
            p20.mix(number_of_mixes, 20, dilution)
            ## mix according to mix_method
            p20.dispense(10, dilution)
            ## instead of blow-out                                        ##

        #### Distribute from dilution to PCR plate                          ##
        for well in destination:
            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()
        ## Drop tip in trashbin on 12.                                ##

    ## distribute manually mixed sample
    p20.pick_up_tip()

    for well in plate_96_qPCR.columns_by_name()['11']:
        dilution = dilution_strips.wells_by_name()['A5']
        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()
Esempio n. 11
0
def run(protocol: protocol_api.ProtocolContext):
    """
    aliquoting a specific volume from 50mL tubes to 1.5mL tubes
    Maximum 144 aliquots (6 racks)
    """
# =============================================================================

# VARIABLES TO SET#!!!=========================================================
# =============================================================================
    number_of_tubes = 1 
      ## How many tubes you want to aliquot from? 
    volume = 180      ## How much volume (µL) to aliquot
    starting_tip_p200 = 'C7'
    start_volume = 48000 # How much volume is in each source tube
    # make sure all source tubes have the same volume
    number_of_aliquots = 144 # How many destination tubes you want filled
        # Max 6 racks = 144 tubes
        # If you want to aliquot the entire source:
        # number_of_aliquots = "EmptySourceTubes"
# =============================================================================

# CALCULATED VARIABLES=========================================================
# =============================================================================
    total_volume = start_volume * number_of_tubes
      ## How many µL are available
    if number_of_aliquots == "EmptySourceTubes":
        number_of_aliquots = int(total_volume / volume)
      ## How many aliquots can be made
    number_of_racks = math.ceil(number_of_aliquots / 24)
      ## How many 1.5mL tube racks do you need
    if number_of_racks > 6:
        number_of_aliquots = 144
        number_of_racks = 6
      ## max number of aliquots
    number_of_full_pipettings = math.floor(volume / 200)
      ## How many times you need to pipette with p300 max volume
    rest_volume = volume - (number_of_full_pipettings * 200)
# =============================================================================


# LOADING LABWARE AND PIPETTES=================================================
# =============================================================================
    ##### Loading labware
    tips_200 = protocol.load_labware(
        'opentrons_96_filtertiprack_200ul',         #labware definition
        10,                                         #deck position
        'tips_200')                                 #custom name
    tubes_50mL = protocol.load_labware(
        'opentrons_6_tuberack_falcon_50ml_conical', #labware definition
        7,                                          #deck position
        'tubes_50mL')                               #custom name
    tubes_1mL_1 = protocol.load_labware(
        'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',   #labwaredef
        4,                                                          #deck pos
        'tubes_1.5mL1')                                             #cust name
    if number_of_racks > 1:
        tubes_1mL_2 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labw def
            5,                                                       #deck pos
            'tubes_1.5mL2')                                          #cust name
    if number_of_racks > 2:
        tubes_1mL_3 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labw def
            6,                                                       #deck pos
            'tubes_1.5mL3')                                          #cust name    
    if number_of_racks > 3:
        tubes_1mL_4 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labw def
            1,                                                       #deck pos
            'tubes_1.5mL4')                                          #cust name    
    if number_of_racks > 4:
        tubes_1mL_5 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labw def
            2,                                                       #deck pos
            'tubes_1.5mL5')                                          #cust name
    if number_of_racks > 5:
        tubes_1mL_6 = protocol.load_labware(
            'opentrons_24_tuberack_eppendorf_1.5ml_safelock_snapcap',#labw def
            3,                                                       #deck pos
            'tubes_1.5mL6')                                          #cust name

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


# 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   ##
    
    ##### Setting tube locations
    reagent = []
    for well in tubes_50mL.wells():
        reagent.append(well)
    reagent = reagent[:number_of_tubes]
    
    aliquots = []
    for well in tubes_1mL_1.wells():
        aliquots.append(well)
    if number_of_racks > 1:
        for well in tubes_1mL_2.wells():
            aliquots.append(well)
    if number_of_racks > 2:
        for well in tubes_1mL_3.wells():
            aliquots.append(well)
    if number_of_racks > 3:
        for well in tubes_1mL_4.wells():
            aliquots.append(well)
    if number_of_racks > 4:
        for well in tubes_1mL_5.wells():
            aliquots.append(well)
    if number_of_racks > 5:
        for well in tubes_1mL_6.wells():
            aliquots.append(well)
      ## Add all wells of all complete racks to a list
    
    aliquots = aliquots[:number_of_aliquots]
      ## cuts off after calculated number of aliquots    
# =============================================================================


# MESSAGE AT THE START=========================================================
# =============================================================================
    protocol.pause("I need "+ str(number_of_racks) + " racks, with a total of "
                   + str(number_of_aliquots) + " 1.5mL tubes.") 
# =============================================================================      

# TURN RAIL LIGHT ON===========================================================
# =============================================================================
    protocol.set_rail_lights(True)   
# =============================================================================  
      

# ALIQUOTING ==================================================================    
# =============================================================================
##### Variables for volume tracking and aliquoting
    counter = 0 # to count how many tubes already emptied
    source = reagent[counter]
    destination = aliquots
    start_height = vt.cal_start_height('tube_50mL', start_volume)
    current_height = start_height
    container = 'tube_50mL'


    ##### Pipette a certain times 200µL
    for i, well in enumerate(destination):
      ## aliquot water in the correct wells, 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 % 24 == 0:
            p300.drop_tip()
            p300.pick_up_tip()
              ## Then, after every 24th well, drop tip and pick up new      ##
        
        for i in range(number_of_full_pipettings): 
          ## Pipette 200µL for predefined number of times
            current_height, pip_height, bottom_reached = vt.volume_tracking(
                container, 200, 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, 200, current_height))
                counter = counter + 1
                source = reagent[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.            ##

            #### The actual aliquoting
            p300.aspirate(200, aspiration_location)
              ## Aspirate the amount specified in aspiration_vol from the   ##
              ## location specified in aspiration_location.                 ##
            p300.dispense(200, well.top(z = - 10))
              ## 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)                                                   ##
        
        ##### Pipette rest volume
        if rest_volume > 0:
            current_height, pip_height, bottom_reached = vt.volume_tracking(
                    container, rest_volume, 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, rest_volume, current_height))
                counter = counter + 1
                source = reagent[counter]
                aspiration_location = source.bottom(current_height)
                protocol.comment(
                "Continue with tube " + str(counter) + " of water")
       
            else:
                aspiration_location = source.bottom(pip_height)
                  ## Set the location of where to aspirate from.            ##
    
            #### The actual aliquoting of mastermix
            p300.aspirate(rest_volume, aspiration_location)
              ## Aspirate the amount specified in aspiration_vol from the   ##
              ## location specified in aspiration_location.                 ##
            p300.dispense(rest_volume, well.top(z = - 10))
              ## 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                                ##
# =============================================================================


# TURN RAIL LIGHT OFF==========================================================
# =============================================================================
    protocol.set_rail_lights(False)   
# =============================================================================