-
Notifications
You must be signed in to change notification settings - Fork 4
Template for building stations
The developed code has been structured as a step by step process, using a python dictionary, and relies on previously defined custom functions (see functions.py). They include multiple parameters in order to customise the pipetting action, as each reactive has different physical properties. Coping with different physical properties has been achieved with the definition of a general class where parameters are defined in order to modify the pipetting action. At the same time, a template has been generated according to the defined structure in order to ease the protocol writing. Currently, custom functions need to be defined inside the "run" function in each protocol. This is a limitation from the OT2 core code.
Import libraries
import math
from opentrons.types import Point
from opentrons import protocol_api
import time
import os
import numpy as np
from timeit import default_timer as timer
import json
from datetime import datetime
import csv
# metadata
metadata = {
'protocolName': 'Template station',
'author': 'José Luis Villanueva (jlvillanueva@clinic.cat)',
'source': 'Hospital Clínic Barcelona',
'apiLevel': '2.0',
'description': 'This is a simple station that can be used as template'
}
'''
'technician': '$technician',
'date': '$date'
'''`
Define variables Variables can be defined externally. The first code section would prompt the user to feed in multiple parameters of the task being performed such as the number of samples, run ID, user name, reactive to be used, well geometrical shape, among others.
#Defined variables
##################
NUM_SAMPLES = 10
air_gap_vol = 5 # Define air gap volume
air_gap_sample = 2 # Define air gap volume for samples (smaller)
run_id = 'test' # Logs will be stored in the OT2 robot in a folder with this name
# Tune variables
volume_mmix = 20 # Volume of transfered master mix
volume_sample = 5 # Volume of the sample
volume_mmix_available = (NUM_SAMPLES * 1.1 * volume_mmix) # Total volume needed
diameter_screwcap = 8.25 # Diameter of the screwcap
temperature = 10 # Temperature of temp module
volume_cone = 50 # Volume in ul that fit in the screwcap cone
x_offset = [0,0]
# Calculated variables
area_section_screwcap = (np.pi * diameter_screwcap**2) / 4
h_cone = (volume_cone * 3 / area_section_screwcap)
num_cols = math.ceil(NUM_SAMPLES / 8) # Columns we are working on
Calculated variables
Dictionary of steps Already inside the run section, a dictionary where the list of steps being run is defined. We will navigate this dictionary during the protocol, using it to save the time log. Only steps with the execute == True will be processed. This is interesting for debugging or resuming runs in a certain point after a problem.
Reagents The following step contains the reactive and custom function definitions, where reactives are defined as classes and will include details on how to deal with them when pipetting, while the custom functions are fully parametrised in order to achieve flexibility and adaption to pipetting techniques such as rinsing, picking offsets and touching the edges of a well with the tip to avoid droplet formation.
Define labware and pipettes The next section would read all the labware definitions for the used equipment within the robot and depending on the type of labware, reactive and volumes will been to get slightly adapted to the needs of the protocol.
Executing the actual steps Once all definitions have been made, blocks of steps would loop within cells or columns as defined by the user.
Write logs and exit Finally, a time log output would be generated from the definitions dictionary and output to a directory.