Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EVOware pipetting commands #21

Merged
merged 54 commits into from
Jan 25, 2023
Merged
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
73c20d7
add evo_aspirate() and evo_aspirate_well()
Y0dler Jan 16, 2023
3a14947
add evo_dispense() and evo_dispense_well()
Y0dler Jan 16, 2023
1ede648
add _prepare_evo_aspirate_dispense_parameters(
Y0dler Jan 16, 2023
b8ad4dc
add Evoware pippeting command code string generation, co-authored by
Y0dler Jan 16, 2023
811b2df
change encoding of save()
Y0dler Jan 16, 2023
539c457
add _prepare_evo_wash_parameters()
Y0dler Jan 16, 2023
324a89c
add import transform
Y0dler Jan 16, 2023
5a774de
apply pre-commit changes
Y0dler Jan 16, 2023
df2bbe8
fix typing.Tuple[] error
Y0dler Jan 16, 2023
90d0860
fix typing.List[] errors
Y0dler Jan 16, 2023
4242079
extract _int_to_tip() method
Y0dler Jan 17, 2023
2c6fc50
remove evo_transfer() for the time being
Y0dler Jan 17, 2023
524b8c7
apply pre-commit changes again
Y0dler Jan 17, 2023
2f40fc7
to_hex changes
Y0dler Jan 17, 2023
953e54a
fix evo_get_selection() doc string
Y0dler Jan 17, 2023
fe4e738
Update robotools/evotools/__init__.py
Y0dler Jan 17, 2023
3d77266
Update robotools/evotools/__init__.py
Y0dler Jan 17, 2023
d8ab5cf
add more criteria to _prepare_aspirate_dispense_parameters()
Y0dler Jan 17, 2023
81f44b0
add tests of _prepare_evo_aspirate_dispense_parameters()
Y0dler Jan 17, 2023
b9ca7cd
pre-commit
Y0dler Jan 17, 2023
0916e11
fix controlling type of tips error
Y0dler Jan 18, 2023
7193f2e
fix next tip type testing error
Y0dler Jan 18, 2023
c54d397
add test for wells in _prepare_evo_aspirate_dispense_parameters()
Y0dler Jan 19, 2023
2f07e92
force keyword arguments in _prepare_evo_wash_parameters()
Y0dler Jan 19, 2023
1db7135
correct error message
Y0dler Jan 19, 2023
e31169f
add test for well argument check
Y0dler Jan 19, 2023
6b18b7e
add comment
Y0dler Jan 19, 2023
932a029
add numerous tests
Y0dler Jan 19, 2023
30f3e3a
minor changes
Y0dler Jan 19, 2023
00f3243
apply pre-commit changes
Y0dler Jan 19, 2023
45d87b3
Update robotools/evotools/__init__.py
Y0dler Jan 19, 2023
9114334
remove None tests
Y0dler Jan 19, 2023
49d724d
Update robotools/tests.py
Y0dler Jan 19, 2023
82cfe02
use pytest to match specific error messages
Y0dler Jan 19, 2023
1947ef6
fix some error messages etc
Y0dler Jan 19, 2023
62c6612
exchange args for kwargs
Y0dler Jan 19, 2023
8bc36da
increase starting volume of plate
Y0dler Jan 19, 2023
4259e53
fix evo_aspirate() and evo_dispense() regarding wells and volumes
Y0dler Jan 19, 2023
fc7f5df
fix kwargs of evo_aspirate_wells and dispense
Y0dler Jan 19, 2023
40bca7a
exchange positional for keyword arguments
Y0dler Jan 19, 2023
88dca51
fix wrong keyword denomination
Y0dler Jan 19, 2023
81a3d53
apply pre-commit
Y0dler Jan 19, 2023
ed61b04
fix iterate over tuple error
Y0dler Jan 19, 2023
66ffa49
fix volume calculation in evo_aspirate_well and dispense
Y0dler Jan 20, 2023
94265e5
fix comparison of test_evo_aspirate and dispense
Y0dler Jan 20, 2023
8e753ec
fixing evo_aspirate and dispense as well as their tests
Y0dler Jan 20, 2023
5708c86
pre-commit
Y0dler Jan 20, 2023
7ac2a3d
fix further errors in tests
Y0dler Jan 23, 2023
d0821ec
pre-commit
Y0dler Jan 23, 2023
ac14c31
apply rounding to volume of aspirate/dispense
Y0dler Jan 23, 2023
b89997f
pre-commit
Y0dler Jan 23, 2023
dfb39a6
Update robotools/evotools/__init__.py
Y0dler Jan 24, 2023
1d2c034
Apply suggestions from code review
Y0dler Jan 24, 2023
91cfd04
Apply suggestions from code review
Y0dler Jan 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add Evoware pippeting command code string generation, co-authored by
Martin Beiss <[email protected]>
Y0dler committed Jan 25, 2023
commit b8ad4dc2765c0e505bc9c8147bf889ed98b068bb
85 changes: 85 additions & 0 deletions robotools/evotools/__init__.py
Original file line number Diff line number Diff line change
@@ -448,6 +448,91 @@ def _partition_by_column(
)
return column_groups

def toHex(
dec : int
):
"""Method from stackoverflow to convert decimal to hex.
"""
digits = "0123456789ABCDEF"
x = (dec % 16)
rest = dec // 16
if (rest == 0):
return digits[x]
return toHex(rest) + digits[x]

def evo_make_selection_array(
rows:int,
columns:int,
wells: numpy.ndarray
):
"""Translate well IDs to a numpy array with 1s (selected) and 0s (not selected).
Parameters
----------
rows : int
Number of rows of target labware object
cols : int
Number of columns of target labware object
wells : List[str]
Selected wells by well IDs as strings (e.g. ["A01", "B01"])
Returns
-------
selection_array : numpy.ndarray
Numpy array in labware dimensions with selected wells as 1 and others as 0
"""
# create array with a shape beffiting the labware dimensions
selection_array = numpy.zeros((rows, columns))
# get a dictionary with the "coordinates" of well IDs (A01, B01 etc) as tuples
well_index_dict = transform.make_well_index_dict(rows, columns)
# insert 1s for all selected wells
for well in wells:
selection_array[well_index_dict[well]] = 1
return selection_array

def evo_get_selection(rows:int, cols:int, selected):
"""Function to generate the code string for the well selection of pipetting actions in EvoWare scripts (.esc).
Adapted from the C++ function detailed in the EvoWare manual to Python by Martin Beyß (except the test at the end).
Parameters
----------
selected : numpy.ndarray
Numpy array in labware dimensions with selected wells as 1 and others as 0 (from evo_make_selection_array)
rows : int
Number of rows of target labware object
cols : int
Number of columns of target labware object
Returns
-------
selection : str
Code string for well selection of pipetting actions in EvoWare scripts (.esc)
"""
# apply bit mask with 7 bits, adapted from function detailed in EvoWare manual
selection = f"0{toHex(cols)}{rows:02d}"
bit_counter = 0
bit_mask = 0
for x in range(cols):
for y in range(rows):
if selected[y,x] == 1:
bit_mask |= 1<<bit_counter
bit_counter += 1
if bit_counter > 6:
selection += chr(bit_mask + 48)
bit_counter = 0
bit_mask = 0
if bit_counter > 0:
selection += chr(bit_mask + 48)

# check if wells from more than one column are selected and raise Exception if so
check = 0
for column in selected.transpose():
if sum(column) >= 1:
check+=1
if check >= 2:
raise Exception("Wells from more than one column are selected.\nSelect only wells from one column per pipetting action.")

return selection

class Worklist(list):
"""Context manager for the creation of Worklists."""