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 @@ -391,7 +391,7 @@ def iter_standard_curve_calc_docs(

def iter_relative_standard_curve_calc_docs(
well_items: list[WellItem],
r_sample: str,
r_sample: str | None,
r_target: str | None,
) -> Iterator[CalculatedDocument]:
# Y-Intercept, Slope, Quantity, Amp score, Cq confidence,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@
)


def _has_valid_rq_values(reader: DesignQuantstudioReader) -> bool:
"""Return True if the RQ Replicate Group Result sheet contains at least one
non-null Rq value.

When all Rq values are null or nan (e.g. the reference calibrator sample
was not processed or all wells undetermined), the reference sample cannot be
inferred and RQ-derived calculated data documents must be skipped.
"""
sheet = reader.get_non_empty_sheet_or_none("RQ Replicate Group Result")
if sheet is None or "Rq" not in sheet.columns:
return False
return bool(sheet["Rq"].notna().any())


class RelativeStandardCurveCreator(Creator):
PLUGIN_REGEX: ClassVar[str] = r"Relative Quantification"
EXPECTED_SHEETS: ClassVar[list[str]] = [
Expand All @@ -34,8 +48,12 @@ def create(cls, reader: DesignQuantstudioReader) -> Data:
wells = RelativeStandardCurveWellList.create(reader, header)
well_items = wells.get_well_items()

r_sample = Result.get_reference_sample(reader)
r_target = Result.get_reference_target(reader)
if not _has_valid_rq_values(reader):
r_sample = None
r_target = None
else:
r_sample = Result.get_reference_sample(reader)
r_target = Result.get_reference_target(reader)

return Data(
header,
Expand Down
Loading
Loading