Skip to content

Commit

Permalink
fixes some template issues for flex
Browse files Browse the repository at this point in the history
  • Loading branch information
abestroka committed Nov 20, 2024
1 parent 089da32 commit ed81874
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requirements = {"robotType": #robotType#}
1 change: 1 addition & 0 deletions ot2_driver/protopiler/protocol_templates/trash.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deck[#location#] = protocol.load_trash_bin(#location#)
24 changes: 22 additions & 2 deletions ot2_driver/protopiler/protopiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def load_config(
self.config = ProtocolConfig.from_yaml(config_path)

self.load_resources(self.config.resources)
self.requirements = self.config.requirements
self.metadata = self.config.metadata
self.resource_manager = ResourceManager(
self.config.equipment, self.resource_file
Expand Down Expand Up @@ -448,6 +449,19 @@ def yaml_to_protocol(
header = header.replace("#metadata#", "")
protocol.append(header)

reqs = open((self.template_dir / "requirements.template")).read()
if self.requirements is not None:
rtype = self.requirements['robotType']
reqs = reqs.replace("#robotType#", f'"{rtype}"')

# else:
# reqs = reqs.replace("#robotType#", f'"Flex"')

protocol.append(reqs)




# load labware and pipette
protocol.append(
"\n ################\n # load labware #\n ################"
Expand All @@ -456,6 +470,7 @@ def yaml_to_protocol(
labware_block = open((self.template_dir / "load_labware.template")).read()
module_block = open((self.template_dir / "load_module.template")).read()
offset_block = open((self.template_dir / "labware_offset.template")).read()
trash_block = open((self.template_dir / "trash.template")).read()
# TODO: think of some better software design for accessing members of resource manager
for location, name in self.resource_manager.location_to_labware.items():
match = False
Expand All @@ -474,8 +489,11 @@ def yaml_to_protocol(
match = True

if not match:
labware_command = labware_block.replace("#name#", f'"{name}"')
labware_command = labware_command.replace("#location#", f'"{location}"')
if name == 'trash':
labware_command = trash_block.replace("#location#", f'"{location}"')
else:
labware_command = labware_block.replace("#name#", f'"{name}"')
labware_command = labware_command.replace("#location#", f'"{location}"')

protocol.append(labware_command)

Expand Down Expand Up @@ -507,6 +525,8 @@ def yaml_to_protocol(
)
protocol.append(pipette_command)


#TODO: if flex, add trash location
# execute commands
protocol.append(
"\n ####################\n # execute commands #\n ####################"
Expand Down
53 changes: 29 additions & 24 deletions ot2_driver/protopiler/test_configs/flex_test.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
equipment:
- name: nest_96_wellplate_2ml_deep
location: "1"
location: "2"
alias: plate
offset: [0, 1.7, 3.9]
- name: opentrons_flex_96_tiprack_200ul
location: "9"
- name: opentrons_flex_96_tiprack_50ul
location: "11"
offset: [0.5, 0.9, -0.3]
# - name: flex_1channel_1000
- name: flex_1channel_50
mount: left
# - name: flex_8channel_1000
# mount: right
- name: flex_8channel_1000
mount: right
- name: trash
location: "4"

commands:
# - name: test
# command: transfer
# source: 1:A1
# aspirate_clearance: 2
# destination: 1:A4
# dispense_clearance: 2
# volume: [10, 10, 10]
# mix_cycles: 0
# mix_volume: 0
# drop_tip: [false, false, true]

- name: test
command: multi_transfer
multi_source: 1:[[A1, B1, C1], [A2, B2, C2], [A3, B3, C3]]
multi_aspirate_clearance: 1
multi_destination: 1:[[A4, B4, C4], [A5, B5, C5], [A6, B6, C6]]
multi_dispense_clearance: 1
multi_volume: 10
command: transfer
source: 2:A1
aspirate_clearance: 2
destination: 2:A4
dispense_clearance: 2
volume: [10, 10, 10]
mix_cycles: 0
mix_volume: 0
drop_tip: [false, false, true]

# - name: test
# command: multi_transfer
# multi_source: 1:[[A1, B1, C1], [A2, B2, C2], [A3, B3, C3]]
# multi_aspirate_clearance: 1
# multi_destination: 1:[[A4, B4, C4], [A5, B5, C5], [A6, B6, C6]]
# multi_dispense_clearance: 1
# multi_volume: 10

metadata:
protocolName: Flex test
author: Abe astroka@anl.gov
description: testing flex protocol generation
apiLevel: "2.12"
apiLevel: "2.18"

requirements:
robotType: Flex

0 comments on commit ed81874

Please sign in to comment.