Skip to content

Commit c8212d6

Browse files
fix: MSD Methodical Mind - support wells larger than 192 wells correctly (#1009)
1 parent f9dc797 commit c8212d6

5 files changed

Lines changed: 17013 additions & 19 deletions

File tree

src/allotropy/parsers/methodical_mind/methodical_mind_structure.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from collections import defaultdict
44
from dataclasses import dataclass
55
from pathlib import Path
6+
import re
67
from typing import Any
78

89
import pandas as pd
@@ -18,8 +19,6 @@
1819
from allotropy.parsers.utils.pandas import SeriesData
1920
from allotropy.parsers.utils.uuids import random_uuid_str
2021

21-
WELL_LABELS = ["A", "B", "C", "D", "E", "F", "G", "H"]
22-
2322

2423
@dataclass(frozen=True)
2524
class Header:
@@ -38,6 +37,10 @@ def create(data: SeriesData) -> Header:
3837
)
3938

4039

40+
def _is_valid_well_label(label: str) -> bool:
41+
return bool(re.match("[A-Z]+", label))
42+
43+
4144
@dataclass(frozen=True)
4245
class PlateData:
4346
measurement_time: str
@@ -56,7 +59,7 @@ def create(
5659
) -> PlateData:
5760
well_plate_id = header[str, "Barcode1"].strip("<>")
5861
unique_well_labels = [
59-
label for label in data.index.unique() if label in WELL_LABELS
62+
label for label in data.index.unique() if _is_valid_well_label(label)
6063
]
6164
spot_id = header.get(int, "SpotID")
6265
well_data = [
@@ -70,7 +73,7 @@ def create(
7073
for row_name in unique_well_labels
7174
for row_index, (_, row) in enumerate(data.loc[[row_name]].iterrows())
7275
for col_name, value in row.items()
73-
if row_name in WELL_LABELS
76+
if _is_valid_well_label(row_name)
7477
# Only include if the measurement is not an empty string, this skips blank entries for non-visible
7578
# measurements.
7679
if str(value).strip()

0 commit comments

Comments
 (0)