Skip to content

Commit 1b64a09

Browse files
feat: Beckman Vi-Cell Blu - Added get_unread data to parser (#1023)
Co-authored-by: Nathan Stender <nathan.stender@benchling.com>
1 parent 7b08e19 commit 1b64a09

6 files changed

Lines changed: 822 additions & 56 deletions

File tree

src/allotropy/allotrope/schema_mappers/adm/cell_counting/rec/_2024/_09/cell_counting.py

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ class Measurement:
107107
sample_custom_info: dict[str, Any] | None = None
108108
custom_info: dict[str, Any] | None = None
109109

110+
# Custom information documents
111+
device_control_custom_info: dict[str, Any] | None = None
112+
image_processing_custom_info: dict[str, Any] | None = None
113+
data_processing_custom_info: dict[str, Any] | None = None
114+
processed_data_custom_info: dict[str, Any] | None = None
115+
110116

111117
@dataclass(frozen=True)
112118
class MeasurementGroup:
@@ -223,21 +229,23 @@ def _get_technique_document(
223229
def _get_measurement_document(
224230
self, measurement: Measurement, metadata: Metadata
225231
) -> MeasurementDocument:
232+
device_control_doc = DeviceControlDocumentItem(
233+
device_type=metadata.device_type,
234+
detection_type=metadata.detection_type,
235+
sample_volume_setting=quantity_or_none(
236+
TQuantityValueMicroliter,
237+
measurement.sample_volume_setting,
238+
),
239+
)
240+
device_control_doc = add_custom_information_document(
241+
device_control_doc, measurement.device_control_custom_info or {}
242+
)
226243
measurement_document = MeasurementDocument(
227244
measurement_time=self.get_date_time(measurement.timestamp),
228245
measurement_identifier=measurement.measurement_identifier,
229246
sample_document=self._get_sample_document(measurement),
230247
device_control_aggregate_document=DeviceControlAggregateDocument(
231-
device_control_document=[
232-
DeviceControlDocumentItem(
233-
device_type=metadata.device_type,
234-
detection_type=metadata.detection_type,
235-
sample_volume_setting=quantity_or_none(
236-
TQuantityValueMicroliter,
237-
measurement.sample_volume_setting,
238-
),
239-
)
240-
]
248+
device_control_document=[device_control_doc]
241249
),
242250
processed_data_aggregate_document=self._get_processed_data_aggregate_document(
243251
measurement
@@ -247,12 +255,16 @@ def _get_measurement_document(
247255
),
248256
image_aggregate_document=ImageAggregateDocument(
249257
image_document=[
250-
ImageDocumentItem(
251-
experimental_data_identifier=measurement.experimental_data_identifier
258+
add_custom_information_document(
259+
ImageDocumentItem(
260+
experimental_data_identifier=measurement.experimental_data_identifier
261+
),
262+
measurement.image_processing_custom_info or {},
252263
)
253264
],
254265
)
255266
if measurement.experimental_data_identifier
267+
or measurement.image_processing_custom_info
256268
else None,
257269
)
258270
return add_custom_information_document(
@@ -322,20 +334,23 @@ def _get_processed_data_aggregate_document(
322334
TQuantityValueUnitless, measurement.debris_index
323335
),
324336
}
325-
data_processing_document = DataProcessingDocument(
326-
cell_type_processing_method=measurement.cell_type_processing_method,
327-
minimum_cell_diameter_setting=quantity_or_none(
328-
TQuantityValueMicrometer,
329-
measurement.minimum_cell_diameter_setting,
330-
),
331-
maximum_cell_diameter_setting=quantity_or_none(
332-
TQuantityValueMicrometer,
333-
measurement.maximum_cell_diameter_setting,
334-
),
335-
cell_density_dilution_factor=quantity_or_none(
336-
TQuantityValueUnitless,
337-
measurement.cell_density_dilution_factor,
337+
data_processing_document = add_custom_information_document(
338+
DataProcessingDocument(
339+
cell_type_processing_method=measurement.cell_type_processing_method,
340+
minimum_cell_diameter_setting=quantity_or_none(
341+
TQuantityValueMicrometer,
342+
measurement.minimum_cell_diameter_setting,
343+
),
344+
maximum_cell_diameter_setting=quantity_or_none(
345+
TQuantityValueMicrometer,
346+
measurement.maximum_cell_diameter_setting,
347+
),
348+
cell_density_dilution_factor=quantity_or_none(
349+
TQuantityValueUnitless,
350+
measurement.cell_density_dilution_factor,
351+
),
338352
),
353+
measurement.data_processing_custom_info or {},
339354
)
340355
processed_data_document = ProcessedDataDocumentItem(
341356
processed_data_identifier=measurement.processed_data_identifier,
@@ -389,7 +404,8 @@ def _get_processed_data_aggregate_document(
389404
return ProcessedDataAggregateDocument(
390405
processed_data_document=[
391406
add_custom_information_document(
392-
processed_data_document, custom_document
407+
processed_data_document,
408+
custom_document | (measurement.processed_data_custom_info or {}),
393409
)
394410
]
395411
)

src/allotropy/parsers/beckman_vi_cell_blu/vi_cell_blu_structure.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,28 @@ def create_measurement_group(data: SeriesData) -> MeasurementGroup:
5353
average_viable_cell_circularity=data.get(
5454
float, "Average viable circularity"
5555
),
56+
device_control_custom_info=data.get_custom_keys(
57+
{"Wash", "Mixing cycles", "Aspiration cycles"}
58+
),
59+
image_processing_custom_info=data.get_custom_keys(
60+
{"Images", "Images for analysis"}
61+
),
62+
data_processing_custom_info=data.get_custom_keys(
63+
{
64+
"Decluster degree",
65+
"Minimum circularity",
66+
"Viable spot area (%)",
67+
"Viable spot brightness (%)",
68+
"Cell sharpness",
69+
"Average background intensity",
70+
"Bubble count",
71+
"Cluster count",
72+
}
73+
),
74+
processed_data_custom_info=data.get_custom_keys(
75+
{"Average cells per image"}
76+
),
77+
custom_info=data.get_unread(),
5678
)
5779
],
5880
)

tests/parsers/beckman_vi_cell_blu/testdata/Beckman_Vi-Cell-BLU_different_mu_character.json

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
"device control document": [
1111
{
1212
"device type": "brightfield imager (cell counter)",
13-
"detection type": "brightfield"
13+
"detection type": "brightfield",
14+
"custom information document": {
15+
"Wash": "Normal Wash",
16+
"Aspiration cycles": 3.0,
17+
"Mixing cycles": 3.0
18+
}
1419
}
1520
]
1621
},
@@ -32,6 +37,16 @@
3237
"maximum cell diameter setting": {
3338
"value": 30.0,
3439
"unit": "µm"
40+
},
41+
"custom information document": {
42+
"Bubble count": 0.0,
43+
"Minimum circularity": 0.1,
44+
"Cluster count": 0.0,
45+
"Decluster degree": "Medium",
46+
"Viable spot brightness (%)": 50.0,
47+
"Viable spot area (%)": 5.0,
48+
"Average background intensity": 134.0,
49+
"Cell sharpness": 7.0
3550
}
3651
},
3752
"viability (cell counter)": {
@@ -69,12 +84,25 @@
6984
"average viable cell circularity": {
7085
"value": 0.88,
7186
"unit": "(unitless)"
87+
},
88+
"custom information document": {
89+
"Average cells per image": 21.0
7290
}
7391
}
7492
]
7593
},
7694
"sample document": {
7795
"sample identifier": "CLB001"
96+
},
97+
"image aggregate document": {
98+
"image document": [
99+
{
100+
"custom information document": {
101+
"Images": 100.0,
102+
"Images for analysis": 100.0
103+
}
104+
}
105+
]
78106
}
79107
}
80108
]
@@ -88,7 +116,7 @@
88116
"file name": "Beckman_Vi-Cell-BLU_different_mu_character.csv",
89117
"UNC path": "tests/parsers/beckman_vi_cell_blu/testdata/Beckman_Vi-Cell-BLU_different_mu_character.csv",
90118
"ASM converter name": "allotropy_beckman_coulter_vi_cell_blu",
91-
"ASM converter version": "0.1.69",
119+
"ASM converter version": "0.1.97",
92120
"software name": "Vi-Cell BLU"
93121
},
94122
"device system document": {

0 commit comments

Comments
 (0)