Skills › Research & Science › Bioinformatics & life science
pylabrobot
Vendor-agnostic lab automation framework. Use when controlling multiple equipment types (Hamilton, Tecan, Opentrons, plate readers, pumps) or needing unified programming across different vendors. Best for complex workflows, multi-vendor setups, simulation. For Opentrons-only protocols with official API, opentrons-integration may be simpler.
Tools: pylabrobot,numpy,pandas
The full skill
—
name: pylabrobot
description: Vendor-agnostic lab automation framework. Use when controlling multiple equipment types (Hamilton, Tecan, Opentrons, plate readers, pumps) or needing unified programming across different vendors. Best for complex workflows, multi-vendor setups, simulation. For Opentrons-only protocols with official API, opentrons-integration may be simpler.
license: MIT license
metadata:
skill-author: K-Dense Inc.
—
# PyLabRobot
## Overview
PyLabRobot is a hardware-agnostic, pure Python Software Development Kit for automated and autonomous laboratories. Use this skill to control liquid handling robots, plate readers, pumps, heater shakers, incubators, centrifuges, and other laboratory automation equipment through a unified Python interface that works across platforms (Windows, macOS, Linux).
## When to Use This Skill
Use this skill when:
– Programming liquid handling robots (Hamilton STAR/STARlet, Opentrons OT-2, Tecan EVO)
– Automating laboratory workflows involving pipetting, sample preparation, or analytical measurements
– Managing deck layouts and laboratory resources (plates, tips, containers, troughs)
– Integrating multiple lab devices (liquid handlers, plate readers, heater shakers, pumps)
– Creating reproducible laboratory protocols with state management
– Simulating protocols before running on physical hardware
– Reading plates using BMG CLARIOstar or other supported plate readers
– Controlling temperature, shaking, centrifugation, or other material handling operations
– Working with laboratory automation in Python
## Core Capabilities
PyLabRobot provides comprehensive laboratory automation through six main capability areas, each detailed in the references/ directory:
### 1. Liquid Handling (`references/liquid-handling.md`)
Control liquid handling robots for aspirating, dispensing, and transferring liquids. Key operations include:
– **Basic Operations**: Aspirate, dispense, transfer liquids between wells
– **Tip Management**: Pick up, drop, and track pipette tips automatically
– **Advanced Techniques**: Multi-channel pipetting, serial dilutions, plate replication
– **Volume Tracking**: Automatic tracking of liquid volumes in wells
– **Hardware Support**: Hamilton STAR/STARlet, Opentrons OT-2, Tecan EVO, and others
### 2. Resource Management (`references/resources.md`)
Manage laboratory resources in a hierarchical system:
– **Resource Types**: Plates, tip racks, troughs, tubes, carriers, and custom labware
– **Deck Layout**: Assign resources to deck positions with coordinate systems
– **State Management**: Track tip presence, liquid volumes, and resource states
– **Serialization**: Save and load deck layouts and states from JSON files
– **Resource Discovery**: Access wells, tips, and containers through intuitive APIs
### 3. Hardware Backends (`references/hardware-backends.md`)
Connect to diverse laboratory equipment through backend abstraction:
– **Liquid Handlers**: Hamilton STAR (full support), Opentrons OT-2, Tecan EVO
– **Simulation**: ChatterboxBackend for protocol testing without hardware
– **Platform Support**: Works on Windows, macOS, Linux, and Raspberry Pi
– **Backend Switching**: Change robots by swapping backend without rewriting protocols
### 4. Analytical Equipment (`references/analytical-equipment.md`)
Integrate plate readers and analytical instruments:
– **Plate Readers**: BMG CLARIOstar for absorbance, luminescence, fluorescence
– **Scales**: Mettler Toledo integration for mass measurements
– **Integration Patterns**: Combine liquid handlers with analytical equipment
– **Automated Workflows**: Move plates between devices automatically
### 5. Material Handling (`references/material-handling.md`)
Control environmental and material handling equipment:
– **Heater Shakers**: Hamilton HeaterShaker, Inheco ThermoShake
– **Incubators**: Inheco and Thermo Fisher incubators with temperature control
– **Centrifuges**: Agilent VSpin with bucket positioning and spin control
– **Pumps**: Cole Parmer Masterflex for fluid pumping operations
– **Temperature Control**: Set and monitor temperatures during protocols
### 6. Visualization & Simulation (`references/visualization.md`)
Visualize and simulate laboratory protocols:
– **Browser Visualizer**: Real-time 3D visualization of deck state
– **Simulation Mode**: Test protocols without physical hardware
– **State Tracking**: Monitor tip presence and liquid volumes visually
– **Deck Editor**: Graphical tool for designing deck layouts
– **Protocol Validation**: Verify protocols before running on hardware
## Quick Start
To get started with PyLabRobot, install the package and initialize a liquid handler:
“`python
# Install PyLabRobot
# uv pip install pylabrobot
# Basic liquid handling setup
from pylabrobot.liquid_handling import LiquidHandler
from pylabrobot.liquid_handling.backends import STAR
from pylabrobot.resources import STARLetDeck
# Initialize liquid handler
lh = LiquidHandler(backend=STAR(), deck=STARLetDeck())
await lh.setup()
# Basic operations
await lh.pick_up_tips(tip_rack["A1:H1f:T2e9f,# Analytical Equipment in PyLabRobot
## Overview
PyLabRobot integrates with analytical equipment including plate readers, scales, and other measurement devices. This allows automated workflows that combine liquid handling with analytical measurements.
## Plate Readers
### BMG CLARIOstar (Plus)
The BMG Labtech CLARIOstar and CLARIOstar Plus are microplate readers that measure absorbance, luminescence, and fluorescence.
#### Hardware Setup
**Physical Connections:**
1. IEC C13 power cord to mains power
2. USB-B cable to computer (with security screws on device end)
3. Optional: RS-232 port for plate stacking units
**Communication:**
– Serial connection through FTDI/USB-A at firmware level
– Cross-platform support (Windows, macOS, Linux)
#### Software Setup
“`python
from pylabrobot.plate_reading import PlateReader
from pylabrobot.plate_reading.clario_star_backend import CLARIOstarBackend
# Create backend
backend = CLARIOstarBackend()
# Initialize plate reader
pr = PlateReader(
name="CLARIOstar",
backend=backend,
size_x=0.0, # Physical dimensions not critical for plate readers
size_y=0.0,
size_z=0.0
)
# Setup (initializes device)
await pr.setup()
# When done
await pr.stop()
“`
#### Basic Operations
**Opening and Closing:**
“`python
# Open loading tray
await pr.open()
# (Load plate manually or robotically)
# Close loading tray
await pr.close()
“`
**Temperature Control:**
“`python
# Set temperature (in Celsius)
await pr.set_temperature(37)
# Note: Reaching temperature is slow
# Set temperature early in protocol
“`
**Reading Measurements:**
“`python
# Absorbance reading
data = await pr.read_absorbance(wavelength=450) # nm
# Luminescence reading
data = await pr.read_luminescence()
# Fluorescence reading
data = await pr.read_fluorescence(
excitation_wavelength=485, # nm
emission_wavelength=535 # nm
)
“`
#### Data Format
Plate reader methods return array data:
“`python
import numpy as np
# Read absorbance
data = await pr.read_absorbance(wavelength=450)
# data is typically a 2D array (8×12 for 96-well plate)
print(f"Data shape: {data.shape}")
print(f"Well A1: {data[0][0]}")
print(f"Well H12: {data[7][11]}")
# Convert to DataFrame for easier handling
import pandas as pd
df = pd.DataFrame(data)
“`
#### Integration with Liquid Handler
Combine plate reading with liquid handling:
“`python
from pylabrobot.liquid_handling import LiquidHandler
from pylabrobot.liquid_handling.backends import STAR
from pylabrobot.resources import STARLetDeck
from pylabrobot.plate_reading import PlateReader
from pylabrobot.plate_reading.clario_star_backend import CLARIOstarBackend
# Initialize liquid handler
lh = LiquidHandler(backend=STAR(), deck=STARLetDeck())
await lh.setup()
# Initialize plate reader
pr = PlateReader(name="CLARIOstar", backend=CLARIOstarBackend())
await pr.setup()
# Set temperature early
await pr.set_temperature(37)
try:
# Prepare samples with liquid handler
tip_rack = TIP_CAR_480_A00(name="tips")
reagent_plate = Cos_96_DW_1mL(name="reagents")
assay_plate = Cos_96_DW_1mL(name="assay")
lh.deck.assign_child_resource(tip_rack, rails=1)
lh.deck.assign_child_resource(reagent_plate, rails=10)
lh.deck.assign_child_resource(assay_plate, rails=15)
# Transfer samples
await lh.pick_up_tips(tip_rack["A1:H1:T3290,# Hardware Backends in PyLabRobot
## Overview
PyLabRobot uses a backend abstraction system that allows the same protocol code to run on different liquid handling robots and platforms. Backends handle device-specific communication while the `LiquidHandler` frontend provides a unified interface.
## Backend Architecture
### How Backends Work
1. **Frontend**: `LiquidHandler` class provides high-level API
2. **Backend**: Device-specific class handles hardware communication
3. **Protocol**: Same code works across different backends
“`python
# S