pythonLab is a universal, extendable and safe language for laboratory processes. It utilizes pythons syntax to define comprehensive workflows including loops and conditionals. This makes it all human/machine readable/writeable.
Project description
pythonLab
This is the specification and development repository of pythonLab, a universal, extendable and safe language for laboratory processes. Since this process language needs many characteristics of a programming language, like conditions (if ...), loops (for/while), variables, etc. we do not want to re-invent the wheel twice but rather use the python syntax, which is very popular in science.
Also processes are defined in python, they are not excecuted but parsed into directed graphs
Examples
Simple linear workflow
Show code
protocol_path = "protocols/evacuation_speroids.lhc"
self.robot_arm.move(cont, self.dispenser)
self.dispenser.run_protocol(labware=cont, protocol=protocol_path)
This process is parsed into the following workflow graph:
Show graph
Implicit movements for reagents and multi labware steps
Show code
bravo_positions = [4, 6, 7, 8]
for i in range(len(growth_plates)):
self.robot_arm.move(cont, target_loc=self.pipetter, lidded=False, position=bravo_positions[i])
self.pipetter.executeProtocol(growth_plates[0], protocol=sup_rem_protocol, duration=200,
reagents=growth_plates[1:],
self.pipetter.executeProtocol(growth_plates, protocol=lysis_protocol, duration=240,
reagents=[self.lysis_buffer],
reagent_pos=[3])
for cont in growth_plates:
self.robot_arm.move(cont, self.incubator2, lidded=True)
The reagent plates in reagents=[...] are moved to and from the liquid handler implicitly:
Show graph
Simple for-loop
Show code
for plate in self.target_plates:
self.robot_arm.move(plate, self.echo, role="destination", read_barcode=True, lidded=False)
self.echo.execute_transfer_protocol(self.source_plate, plate, protocol)
self.robot_arm.move(plate, self.hotel2, lidded=True)
This process is parsed into the following workflow graph:
Show graph
Single conditional
Show code
def is_acceptable(answer) -> bool:
return answer.Response.value >= 5
cont = self.containers[0]
self.robot_arm.move(cont, self.human)
answer = self.human.request_number(cont, message="assign quality score")
acceptable = self.is_acceptable(answer)
if acceptable:
self.robot_arm.move(cont, self.incubator1)
else:
self.robot_arm.move(cont, self.hotel1)
This process is parsed into the following workflow graph:
Show graph
Nested for-loop and timing comstraints
Show code
meas_time = 65
meas_points = [0, 5, 15, 30]
for cont in self.containers:
self.robot_arm.move(cont, self.reader)
self.reader.single_read(cont, method="protocol", label=f"read_{cont.name}_{0}")
for i in range(1, len(meas_points)):
self.robot_arm.move(cont, self.incubator1)
self.incubator1.incubate(cont, duration=10, temperature=295, shaking_frequency=400)
self.robot_arm.move(cont, self.reader)
wait = 60*(meas_points[i] - meas_points[i-1]) - meas_time
self.reader.single_read(cont, method="protocol", label=f"read_{cont.name}_{i}",
relations=[("min_wait", f"read_{cont.name}_{i-1}", [wait]),
("max_wait", f"read_{cont.name}_{i-1}", [wait+20])
]
)
self.robot_arm.move(cont, self.hotel)
This process is parsed into the following workflow graph:
Show graph
Nested for-loop with conditional and break
Show code
# cultured plates in incubator 37°, 200rpm, 45-90 min until aver_OD is >= 0.4.
for cont in cultured_plates:
for j in range(3):
self.robot_arm.move(cont, target_loc=self.reader2, lidded=False)
od = self.reader2.single_read(cont, method=od_600)
if j < max_cult_intervals - 1:
aver_od = self.compute_average(od)
if aver_od > 0.4:
break
else:
# incubate for another interval
self.robot_arm.move(cont, target_loc=self.incubator2, lidded=True)
self.incubator2.incubate(cont, duration=cult_time_interval, temperature=cult_temp,
shaking_frequency=cult_shaking_freq)
self.robot_arm.move(cont, target_loc=self.pipetter, lidded=False, position=3)
This process is parsed into the following workflow graph:
Show graph
Key (desired) Features
- easy and simple to learn and write (close to simple English)
- clear, human readable syntax
- machine readable and writeable syntax
- universal - applicable for most laboratory operations
- transferable from one lab to another
- Turing-complete, including conditions and loops
- easy extendible - prepared for the constant development of science
- close to real laboratory work
- vendor independent
- safe to execute
- converter from other lab description languages to pythonLab easy to implement
Applications of pythonLab
- general lab processes, common in any natural sciences lab (very broad application)
- description of lab automation workflows
- workflows on the lab devices (e.g. HPLC processes - sometimes also called 'methods', plate reader processes etc.)
- data evaluation workflows
Architecture of pythonLab
pythonLab processes are denoted in a python like syntax, but they are not directly executed by a python interpreter. They are rather parsed into a workflow graph, which can be used by a Scheduler to calculate an optimal schedule (=order of execution). This order of execution might be different from the initial notation. An Orchestrator executes then the schedule and supervises the device communication, e.g. to SiLA servers/devices.
Specification
Please find a draft of the pythonLab specification in docs/specification (very early stage !).
Very briefly, the generic lab description language should have many features a common programming language has and following the desired Turning-completeness, like:
- variables (x = value)
- conditions (if, else, ...)
- loops (for ... while ....)
- functions / methods and subroutines
- modules
- namespaces and versions for unique addressing of a process step
- (at a later stage of language development: object orientation)
!! This is a proposal - we would like to discuss it with a wide range of scientist to find the best common ground
Documentation
The pythonLab Documentation can be found in docs
Why python ?
Python is a programming language that is very common in modern scientific laboratories and covers all the desired characteristics we expect of a user-friendly lab process programming language.
The syntax is very simple, and intuitive to learn. Syntax validation comes for free: the python interpreter already does it.
Standardisation of a minimal set of functionally will be achieved by standardised packages provided by this site (or any publicly available site). Defined namespaces and versioning allow unique addressing of a process step. e safe execution environment.
Related projects
Here is an incomplete list of related OpenSource projects - please let us know, if we missed a relevant project.
Autoprotocoll
- Syntax: JSON based
- (-) not Turing complete
- (-) hard to write and read by humans
LabOP
- Syntax: RDF / python
- (-) not Turing complete (?)
- (-) hard to write and read by humans
RoboLiq
- Syntax: yaml / Javascript
- (-) not Turing complete
- (-) hard to write and read by humans
- (-) design not clearly specified
Repository Maintainer:
- Stefan Maak (stefan.maak@uu.se)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uupythonlab-0.2.12.tar.gz.
File metadata
- Download URL: uupythonlab-0.2.12.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cc7fa86e9386ce5225a7eb2ff30e3c01ed7887f5d0da3be019df242fb04f228
|
|
| MD5 |
5244d582ad8a264a8ce2bb5666e3b4e5
|
|
| BLAKE2b-256 |
b380bb68f7603e21a11da4a4ea0d0dff2b67a692c6306989d466236909c6b77b
|
File details
Details for the file uupythonlab-0.2.12-py3-none-any.whl.
File metadata
- Download URL: uupythonlab-0.2.12-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ecf6991c132c478970929cd9174278c9f5065916995bfb0ec7a6dfe567a64aa
|
|
| MD5 |
15ff93b16a5191d13551375fd07f941c
|
|
| BLAKE2b-256 |
9c86b17b202957e56bbfcf5dbeafbe456416cc75bc34d08f733a988e4e5b1eb1
|