Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ class CalculatedPlateInfo(PlateInfo):
def create(data: SeriesData) -> CalculatedPlateInfo:
formula = data[str, "Formula"]

name = assert_not_none(
search(r"^([^=]*)=", formula),
msg="Unable to find expected formula name for calculated results section.",
).group(1)
# Standard formulas embed the name before an '=' (e.g.
# "Calc 1: General = (X / Y) * Z where ..."). Some formulas are a plain
# description with no '=' (e.g. "Calc 1: OD450 direct absorbance value at
# 450 nm"), in which case the whole formula string is the name.
formula_name_match = search(r"^([^=]*)=", formula)
name = formula_name_match.group(1) if formula_name_match else formula

plate_number, barcode = PlateInfo.get_plate_number_and_barcode(data)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,20 +345,27 @@ def test_create_calculated_plate_info_with_no_formula() -> None:
CalculatedPlateInfo.create(data)


def test_create_calculated_plate_info_with_invalid_formula() -> None:
def test_create_calculated_plate_info_with_formula_without_name() -> None:
# Some formulas are a plain description with no "name =" prefix; the whole
# formula string is used as the name.
data = SeriesData(
pd.Series(
{
"Plate": "dummy",
"Measured height": "0",
"Formula": "invalid formula",
"Formula": "Calc 1: OD450 direct absorbance value at 450 nm",
"Measurement date": "10/13/2022 3:08:06 PM",
}
)
)
msg = "Unable to find expected formula name for calculated results section."
with pytest.raises(AllotropeConversionError, match=msg):
CalculatedPlateInfo.create(data)
calculated_plate_info = CalculatedPlateInfo.create(data)
assert (
calculated_plate_info.name == "Calc 1: OD450 direct absorbance value at 450 nm"
)
assert (
calculated_plate_info.formula
== "Calc 1: OD450 direct absorbance value at 450 nm"
)


def test_create_basic_assay_info() -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Plate information
Plate,Repeat,Barcode,Measured height,Chamber temperature at start,Chamber temperature at end,Humidity at start,Humidity at end,Ambient temperature at start,Ambient temperature at end,Formula,Measurement date,
1,1,"=""""",N/A,N/A,N/A,N/A,N/A,N/A,N/A,Calc 1: General = (X / Y) * Z where X = AC HTRF Laser [Eu](1) channel 1 window 1 Y = AC HTRF Laser [Eu](1) channel 2 window 1 Z = 10000,10/13/2022 3:08:06 PM,
1,1,"=""""",N/A,N/A,N/A,N/A,N/A,N/A,N/A,Calc 1: HTRF ratio value for AC HTRF Laser [Eu],10/13/2022 3:08:06 PM,

Background information
Plate,Label,Result,Signal,Flashes/Time,Meastime,MeasInfo,
1,AC HTRF Laser [Eu],0,162,50,00:00:00.000,De=1st Ex=Top Em=Top Wdw=1 (14),
1,AC HTRF Laser [Eu],0,260,50,00:00:00.000,De=2nd Ex=Top Em=Top Wdw=1 (142),

Calculated results: Calc 1: General = (X / Y) * Z where X = AC HTRF Laser [Eu](1) channel 1 window 1 Y = AC HTRF Laser [Eu](1) channel 2 window 1 Z = 10000
Calculated results: Calc 1: HTRF ratio value for AC HTRF Laser [Eu]
,01,02,03,04,05,06,07,08,09,10,11,12,
A,3912.12920565,3923.92517971,3948.45245355,,3933.03506298,4061.92827247,3996.61746992,,,,,,
B,2385.72193555,2384.42487617,2396.10683014,,2390.61028269,2396.68321027,2424.70697585,,,,,,
Expand Down Expand Up @@ -119,8 +119,8 @@ H,- ,- ,- , ,- ,- ,- , , , , ,
Calculations:
Plate,,,,1
Formula index,,,,Calc 1
Formula name,,,,General
Formula,,,,(X / Y) * Z where X = AC HTRF Laser [Eu](1) channel 1 window 1 Y = AC HTRF Laser [Eu](1) channel 2 window 1 Z = 10000
Formula name,,,,HTRF ratio value for AC HTRF Laser [Eu]
Formula,,,,HTRF ratio value for AC HTRF Laser [Eu]

Auto export parameters:
Export format,,,,Plate2
Expand Down
Loading
Loading