mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 13:01:12 +00:00
Add workflow upload func.
This commit is contained in:
0
test/workflow/__init__.py
Normal file
0
test/workflow/__init__.py
Normal file
186
test/workflow/example_bio.json
Normal file
186
test/workflow/example_bio.json
Normal file
@@ -0,0 +1,186 @@
|
||||
{
|
||||
"workflow": [
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_1",
|
||||
"targets": "Liquid_2",
|
||||
"asp_vol": 66.0,
|
||||
"dis_vol": 66.0,
|
||||
"asp_flow_rate": 94.0,
|
||||
"dis_flow_rate": 94.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_2",
|
||||
"targets": "Liquid_3",
|
||||
"asp_vol": 58.0,
|
||||
"dis_vol": 96.0,
|
||||
"asp_flow_rate": 94.0,
|
||||
"dis_flow_rate": 94.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_4",
|
||||
"targets": "Liquid_2",
|
||||
"asp_vol": 85.0,
|
||||
"dis_vol": 170.0,
|
||||
"asp_flow_rate": 94.0,
|
||||
"dis_flow_rate": 94.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_4",
|
||||
"targets": "Liquid_2",
|
||||
"asp_vol": 63.333333333333336,
|
||||
"dis_vol": 170.0,
|
||||
"asp_flow_rate": 94.0,
|
||||
"dis_flow_rate": 94.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_2",
|
||||
"targets": "Liquid_3",
|
||||
"asp_vol": 72.0,
|
||||
"dis_vol": 150.0,
|
||||
"asp_flow_rate": 94.0,
|
||||
"dis_flow_rate": 94.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_4",
|
||||
"targets": "Liquid_2",
|
||||
"asp_vol": 85.0,
|
||||
"dis_vol": 170.0,
|
||||
"asp_flow_rate": 94.0,
|
||||
"dis_flow_rate": 94.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_4",
|
||||
"targets": "Liquid_2",
|
||||
"asp_vol": 63.333333333333336,
|
||||
"dis_vol": 170.0,
|
||||
"asp_flow_rate": 94.0,
|
||||
"dis_flow_rate": 94.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_2",
|
||||
"targets": "Liquid_3",
|
||||
"asp_vol": 72.0,
|
||||
"dis_vol": 150.0,
|
||||
"asp_flow_rate": 94.0,
|
||||
"dis_flow_rate": 94.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_2",
|
||||
"targets": "Liquid_3",
|
||||
"asp_vol": 20.0,
|
||||
"dis_vol": 20.0,
|
||||
"asp_flow_rate": 7.6,
|
||||
"dis_flow_rate": 7.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_5",
|
||||
"targets": "Liquid_2",
|
||||
"asp_vol": 6.0,
|
||||
"dis_vol": 12.0,
|
||||
"asp_flow_rate": 7.6,
|
||||
"dis_flow_rate": 7.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_5",
|
||||
"targets": "Liquid_2",
|
||||
"asp_vol": 10.666666666666666,
|
||||
"dis_vol": 12.0,
|
||||
"asp_flow_rate": 7.599999999999999,
|
||||
"dis_flow_rate": 7.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "transfer_liquid",
|
||||
"action_args": {
|
||||
"sources": "Liquid_2",
|
||||
"targets": "Liquid_6",
|
||||
"asp_vol": 12.0,
|
||||
"dis_vol": 10.0,
|
||||
"asp_flow_rate": 7.6,
|
||||
"dis_flow_rate": 7.6
|
||||
}
|
||||
}
|
||||
],
|
||||
"reagent": {
|
||||
"Liquid_6": {
|
||||
"slot": 1,
|
||||
"well": [
|
||||
"A2"
|
||||
],
|
||||
"labware": "elution plate"
|
||||
},
|
||||
"Liquid_1": {
|
||||
"slot": 2,
|
||||
"well": [
|
||||
"A1",
|
||||
"A2",
|
||||
"A4"
|
||||
],
|
||||
"labware": "reagent reservoir"
|
||||
},
|
||||
"Liquid_4": {
|
||||
"slot": 2,
|
||||
"well": [
|
||||
"A1",
|
||||
"A2",
|
||||
"A4"
|
||||
],
|
||||
"labware": "reagent reservoir"
|
||||
},
|
||||
"Liquid_5": {
|
||||
"slot": 2,
|
||||
"well": [
|
||||
"A1",
|
||||
"A2",
|
||||
"A4"
|
||||
],
|
||||
"labware": "reagent reservoir"
|
||||
},
|
||||
"Liquid_2": {
|
||||
"slot": 4,
|
||||
"well": [
|
||||
"A2"
|
||||
],
|
||||
"labware": "TAG1 plate on Magnetic Module GEN2"
|
||||
},
|
||||
"Liquid_3": {
|
||||
"slot": 12,
|
||||
"well": [
|
||||
"A1"
|
||||
],
|
||||
"labware": "Opentrons Fixed Trash"
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
test/workflow/example_bio_graph.png
Normal file
BIN
test/workflow/example_bio_graph.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 148 KiB |
63
test/workflow/example_prcxi.json
Normal file
63
test/workflow/example_prcxi.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"steps_info": [
|
||||
{
|
||||
"step_number": 1,
|
||||
"action": "transfer_liquid",
|
||||
"parameters": {
|
||||
"source": "sample supernatant",
|
||||
"target": "antibody-coated well",
|
||||
"volume": 100
|
||||
}
|
||||
},
|
||||
{
|
||||
"step_number": 2,
|
||||
"action": "transfer_liquid",
|
||||
"parameters": {
|
||||
"source": "washing buffer",
|
||||
"target": "antibody-coated well",
|
||||
"volume": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"step_number": 3,
|
||||
"action": "transfer_liquid",
|
||||
"parameters": {
|
||||
"source": "washing buffer",
|
||||
"target": "antibody-coated well",
|
||||
"volume": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"step_number": 4,
|
||||
"action": "transfer_liquid",
|
||||
"parameters": {
|
||||
"source": "washing buffer",
|
||||
"target": "antibody-coated well",
|
||||
"volume": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"step_number": 5,
|
||||
"action": "transfer_liquid",
|
||||
"parameters": {
|
||||
"source": "TMB substrate",
|
||||
"target": "antibody-coated well",
|
||||
"volume": 100
|
||||
}
|
||||
}
|
||||
],
|
||||
"labware_info": [
|
||||
{"reagent_name": "sample supernatant", "material_name": "96深孔板", "positions": 1},
|
||||
{"reagent_name": "washing buffer", "material_name": "储液槽", "positions": 2},
|
||||
{"reagent_name": "TMB substrate", "material_name": "储液槽", "positions": 3},
|
||||
{"reagent_name": "antibody-coated well", "material_name": "96 细胞培养皿", "positions": 4},
|
||||
{"reagent_name": "", "material_name": "300μL Tip头", "positions": 5},
|
||||
{"reagent_name": "", "material_name": "300μL Tip头", "positions": 6},
|
||||
{"reagent_name": "", "material_name": "300μL Tip头", "positions": 7},
|
||||
{"reagent_name": "", "material_name": "300μL Tip头", "positions": 8},
|
||||
{"reagent_name": "", "material_name": "300μL Tip头", "positions": 9},
|
||||
{"reagent_name": "", "material_name": "300μL Tip头", "positions": 10},
|
||||
{"reagent_name": "", "material_name": "300μL Tip头", "positions": 11},
|
||||
{"reagent_name": "", "material_name": "300μL Tip头", "positions": 13}
|
||||
]
|
||||
}
|
||||
BIN
test/workflow/example_prcxi_graph.png
Normal file
BIN
test/workflow/example_prcxi_graph.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 140 KiB |
BIN
test/workflow/example_prcxi_graph_20251022_1359.png
Normal file
BIN
test/workflow/example_prcxi_graph_20251022_1359.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
35
test/workflow/merge_workflow.py
Normal file
35
test/workflow/merge_workflow.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
ROOT_DIR = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT_DIR) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT_DIR))
|
||||
|
||||
import pytest
|
||||
|
||||
from unilabos.workflow.convert_from_json import (
|
||||
convert_from_json,
|
||||
normalize_steps as _normalize_steps,
|
||||
normalize_labware as _normalize_labware,
|
||||
)
|
||||
from unilabos.workflow.common import draw_protocol_graph_with_ports
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"protocol_name",
|
||||
[
|
||||
"example_bio",
|
||||
# "bioyond_materials_liquidhandling_1",
|
||||
"example_prcxi",
|
||||
],
|
||||
)
|
||||
def test_build_protocol_graph(protocol_name):
|
||||
data_path = Path(__file__).with_name(f"{protocol_name}.json")
|
||||
|
||||
graph = convert_from_json(data_path, workstation_name="PRCXi")
|
||||
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M")
|
||||
output_path = data_path.with_name(f"{protocol_name}_graph_{timestamp}.png")
|
||||
draw_protocol_graph_with_ports(graph, str(output_path))
|
||||
print(graph)
|
||||
Reference in New Issue
Block a user