-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor how well position numbers are calculate to be Fluent-trough compatible #65
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dc2075f
Remove unused code
michaelosthege c792003
Move tests of EVO-specific trough pipetting to EVO-specific tests suite
michaelosthege 802b970
Add functions for calculating model-specific well position numbers
michaelosthege 8aa9891
Refactor `BaseWorklist` methods to use model-specific well position g…
michaelosthege 1765f3c
Deprecate `Labware.positions`
michaelosthege 8563ef2
Fix missing space in deprecation message
michaelosthege 5e16a59
Bump version to 1.10.0
michaelosthege File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from robotools.evotools.types import Labwares, Tip, int_to_tip | ||
from robotools.evotools.utils import get_well_position | ||
from robotools.evotools.worklist import EvoWorklist, Worklist | ||
from robotools.worklists.exceptions import InvalidOperationError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
|
||
from robotools import Labware, Trough | ||
from robotools.evotools import utils | ||
|
||
|
||
def test_get_well_position(): | ||
plate = Labware("plate", 3, 4, min_volume=0, max_volume=50) | ||
assert utils.get_well_position(plate, "A01") == 1 | ||
assert utils.get_well_position(plate, "B01") == 2 | ||
assert utils.get_well_position(plate, "B04") == 11 | ||
|
||
trough = Trough("trough", 2, 3, min_volume=0, max_volume=50) | ||
assert utils.get_well_position(trough, "A01") == 1 | ||
assert utils.get_well_position(trough, "B01") == 2 | ||
assert utils.get_well_position(trough, "A02") == 3 | ||
assert utils.get_well_position(trough, "A03") == 5 | ||
|
||
with pytest.raises(ValueError, match="not an alphanumeric well ID"): | ||
utils.get_well_position(trough, "A-3") | ||
|
||
# Currently not implemented at the Labware level: | ||
# megaplate = Labware("mplate", 50, 3, min_volume=0, max_volume=50) | ||
# assert utils.get_well_position(megaplate, "AA2") == 51 | ||
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from robotools.fluenttools.utils import get_well_position | ||
from robotools.fluenttools.worklist import FluentWorklist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
|
||
from robotools import Labware, Trough | ||
from robotools.fluenttools import utils | ||
|
||
|
||
def test_get_well_position(): | ||
plate = Labware("plate", 3, 4, min_volume=0, max_volume=50) | ||
assert utils.get_well_position(plate, "A01") == 1 | ||
assert utils.get_well_position(plate, "B01") == 2 | ||
assert utils.get_well_position(plate, "B04") == 11 | ||
|
||
trough = Trough("trough", 2, 3, min_volume=0, max_volume=50) | ||
assert utils.get_well_position(trough, "A01") == 1 | ||
assert utils.get_well_position(trough, "B01") == 1 | ||
assert utils.get_well_position(trough, "A02") == 2 | ||
assert utils.get_well_position(trough, "A03") == 3 | ||
|
||
with pytest.raises(ValueError, match="not an alphanumeric well ID"): | ||
utils.get_well_position(trough, "🧨") | ||
|
||
# Currently not implemented at the Labware level: | ||
# megaplate = Labware("mplate", 50, 3, min_volume=0, max_volume=50) | ||
# assert utils.get_well_position(megaplate, "AA2") == 51 | ||
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Generic utility functions.""" | ||
import re | ||
|
||
from robotools.liquidhandling import Labware | ||
|
||
_WELLID_MATCHER = re.compile(r"^([a-zA-Z]+?)(\d+?)$") | ||
"""Compiled RegEx for matching well row & column from alphanumeric IDs.""" | ||
|
||
|
||
def get_well_position(labware: Labware, well: str) -> int: | ||
"""Calculate the EVO-style well position from the alphanumeric ID.""" | ||
# Extract row & column number from the alphanumeric ID | ||
m = _WELLID_MATCHER.match(well) | ||
if m is None: | ||
raise ValueError(f"This is not an alphanumeric well ID: '{well}'.") | ||
row = m.group(1) | ||
column = int(m.group(2)) | ||
|
||
c = labware.column_ids.index(column) | ||
|
||
# The Fluent does NOT count rows inside troughs! | ||
if labware.is_trough: | ||
return 1 + c | ||
|
||
# Therefore the row number is only relevant for non-trough labware. | ||
row = well[0] | ||
r = labware.row_ids.index(row) | ||
return 1 + c * labware.n_rows + r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.