-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsynthesis.py
140 lines (80 loc) · 3.07 KB
/
synthesis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import os
os.system("systemctl stop opentrons-robot-server")
# In[3]:
import opentrons.execute
import json
import pandas as pd
protocol = opentrons.execute.get_protocol_api('2.18')
CUSTOM_LABWARE_PATH = "./labware/"
protocol.home()
# In[4]:
protocol.set_rail_lights(True)
# In[5]:
# load all the labware modules
with open(CUSTOM_LABWARE_PATH+'20mlscintillation_12_wellplate_18000ul.json') as labware_file:
stock_def = json.load(labware_file)
stocks = protocol.load_labware_from_definition(stock_def, location=1)
synthesized_plate = protocol.load_labware(
load_name="corning_96_wellplate_360ul_flat",
location=2)
dropcast_plate = protocol.load_labware(
load_name="corning_96_wellplate_360ul_flat",
location=3)
with open(CUSTOM_LABWARE_PATH+'agilent_6_reservoir_47000ul.json') as labware_file:
reservoir_def = json.load(labware_file)
reservoir = protocol.load_labware_from_definition(reservoir_def, location=5)
tiprack = protocol.load_labware(
load_name="opentrons_96_tiprack_300ul",
location=7)
pipette = protocol.load_instrument(
instrument_name="p300_single_gen2",
mount="right",
tip_racks=[tiprack]
)
# In[7]:
synthesized_plate.set_offset(x=0.00, y=0.70, z=0.00)
dropcast_plate.set_offset(x=0.00, y=0.70, z=0.00)
tiprack.set_offset(x=0.50, y=1.00, z=0.00)
reservoir.set_offset(x=0.00, y=0.00, z=0.00)
# In[8]:
TIPS = ["A1", "A2", "A3", "A4", "A5"]
def dispense_stock_into_well(stock_id, volume, well):
print("Dispensing Stock %d of %.2f volume into well %s..."%(stock_id+1, volume, well.well_name), end="\r", flush=True)
pipette.pick_up_tip(tiprack[TIPS[stock_id]])
pipette.aspirate(volume, stocks[TIPS[stock_id]])
pipette.dispense(volume, well)
pipette.mix(2, 100, reservoir["A3"],rate=2)
pipette.blow_out(reservoir["A5"].top())
pipette.drop_tip(tiprack[TIPS[stock_id]])
return
# In[10]:
# import pandas as pd
# samples = pd.read_csv("samples.csv").to_numpy()
import numpy as np
samples = np.array([[100, 200], [15, 10]])
for i in range(samples.shape[0]):
dispense_stock_into_well(0, samples[i,0], synthesized_plate.wells()[i])
dispense_stock_into_well(1, samples[i,1], synthesized_plate.wells()[i])
# In[15]:
def dropcast(volume, source_well, destination_well):
print("Dropcasting %.2f volume of %s into well %s..."%(volume,
source_well.well_name,
destination_well.well_name), end="\r", flush=True)
if not pipette.has_tip:
pipette.pick_up_tip(tiprack["A5"])
pipette.aspirate(volume, source_well)
pipette.dispense(volume, destination_well)
pipette.mix(2, 100, reservoir["A3"],rate=2)
pipette.blow_out(reservoir["A5"].top())
# In[16]:
for i in range(samples.shape[0]):
dropcast(100, synthesized_plate.wells()[i], dropcast_plate.wells()[i])
# In[17]:
pipette.drop_tip(tiprack["A5"])
# In[19]:
protocol.home()
protocol.set_rail_lights(False)
# In[ ]: