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 Filter #342

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions pylabrobot/filters/RetroFilterV4/RetroFilterV4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Retro Filter V4

<img src="RetroFilterV4.png" width="800" />

Designed for flow cytometry prep.
Comment on lines +1 to +5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall i move this to the docs so it's on the website? i would add it under liquid handling in the user guide


## Usage Instructions

1. Lay **40–80 µm filter cloth** between the upper and lower portions.
2. Snap the filter assembly shut.
3. Lay scissors flush against the top-bottom interface.
4. **Cut the filter cloth close** to the printed parts to avoid any excess that could obstruct robotic handling.
5. The filter is ready for **single-use**.

> **Tip**: For a reusable filtration assembly, purchase **80 µm steel mesh** from Component Supply.


### [OnShape doc](https://cad.onshape.com/documents/c9c3cf6b64034d54f966eda5/w/fed83636389b833df37c2dac/e/80426a2258abe186fc00e172?renderMode=0&uiState=6768d74c1ea3896154236237)


<p align="left">
<img src="../../docs/img/used_by/retrobio.webp" alt="RetroBio Logo" width="100"/>
</p>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Empty file added pylabrobot/filters/__init__.py
Empty file.
78 changes: 78 additions & 0 deletions pylabrobot/filters/filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
from typing import Optional, Union

from pylabrobot.liquid_handling.liquid_handler import LiquidHandler
from pylabrobot.resources.carrier import ResourceHolder
from pylabrobot.resources.coordinate import Coordinate
from pylabrobot.resources.plate import Lid, Plate


Comment on lines +1 to +8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanna put this file in pylabrobot/resources/filter.py?

class Filter(Lid):
"""Filter for plates for use in filtering cells before flow cytometry."""

filter_dispense_offset = Coordinate(
0, 0, 7
) # height to pipette through filter (required pressure on filter)

def __init__(
self,
name: str,
size_x: float,
size_y: float,
size_z: float,
nesting_z_height: float,
category: str = "filter",
model: Optional[str] = None,
):
super().__init__(
name=name,
size_x=size_x,
size_y=size_y,
size_z=size_z,
category=category,
model=model,
nesting_z_height=nesting_z_height,
)

async def move_filter(
self, lh: LiquidHandler, to_dest: Union[Plate, ResourceHolder], arm: str = "core", **kwargs
):
"""move filter from CarrierSite to a Plate using core grippers (faster) or iSWAP (slower)"""
await lh.move_lid(
lid=self,
to=to_dest,
use_arm=arm,
pickup_distance_from_top=15,
core_grip_strength=20,
return_core_gripper=True,
**kwargs,
)

async def dispense_through_filter(
self, indices: list[int], volume: float, lh: LiquidHandler, **disp_kwargs
):
assert isinstance(self.parent, Plate), "Filter must be placed on a plate to be pipetted."

offsets = disp_kwargs.get("offsets", self.filter_dispense_offset)
if not isinstance(offsets, Coordinate):
raise ValueError("Offsets must be a Coordinate.")

defaults = {
"offsets": [offsets + self.filter_dispense_offset] * len(indices)
if isinstance(offsets, Coordinate)
else [offsets] * len(indices),
"transport_air_volume": 5,
"swap_speed": 100,
"minimum_traverse_height_at_beginning_of_a_command": self.parent.get_absolute_location(
"c", "c", "t"
).z
+ 20,
"min_z_endpos": self.parent.get_absolute_location("c", "c", "t").z + 20,
}

disp_params = {**defaults, **{k: v for k, v in disp_kwargs.items() if k in defaults}}

await lh.dispense([self.parent[i][0] for i in indices], [volume] * len(indices), **disp_params)


def RetroFilterv4(name: str) -> Filter:
return Filter(name=name, size_x=129, size_y=88, size_z=19.7, nesting_z_height=2)
17 changes: 13 additions & 4 deletions pylabrobot/liquid_handling/liquid_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
Strictness,
get_strictness,
)
from pylabrobot.filters.filter import Filter
from pylabrobot.machines.machine import Machine, need_setup_finished
from pylabrobot.plate_reading import PlateReader
from pylabrobot.resources import (
Expand Down Expand Up @@ -777,8 +778,12 @@ async def aspirate(

# Checks
for resource in resources:
if isinstance(resource.parent, Plate) and resource.parent.has_lid():
raise ValueError("Aspirating from a well with a lid is not supported.")
if (
isinstance(resource.parent, Plate)
and resource.parent.has_lid()
and not isinstance(resource.parent.lid, Filter)
):
raise ValueError("Aspirating from a well with a non-filter lid is not supported.")
Comment on lines +781 to +786
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about making Filter inherit from Resource directly rather than Lid so that this check is not necessary?


self._make_sure_channels_exist(use_channels)
assert len(resources) == len(vols) == len(offsets) == len(flow_rates) == len(liquid_height)
Expand Down Expand Up @@ -1000,8 +1005,12 @@ async def dispense(
raise BlowOutVolumeError("Blowout volume is larger than aspirated volume")

for resource in resources:
if isinstance(resource.parent, Plate) and resource.parent.has_lid():
raise ValueError("Dispensing to plate with lid")
if (
isinstance(resource.parent, Plate)
and resource.parent.has_lid()
and not isinstance(resource.parent.lid, Filter)
):
raise ValueError("Aspirating from a well with a non-filter lid is not supported.")

assert len(vols) == len(offsets) == len(flow_rates) == len(liquid_height)

Expand Down
Loading