From e99c452efdd1543aac06ef440bd5ece7745de83a Mon Sep 17 00:00:00 2001 From: NoahKleinschmidt Date: Thu, 14 Apr 2022 19:21:47 +0200 Subject: [PATCH 1/2] Calibrator.pipe now only optionally raises errors --- qpcr/__init__.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/qpcr/__init__.py b/qpcr/__init__.py index 5843705..04b3cfd 100644 --- a/qpcr/__init__.py +++ b/qpcr/__init__.py @@ -3014,7 +3014,7 @@ def dilution( self, step : float or np.ndarray or tuple = None ): return dilution - def pipe( self, assay : Assay, remove_calibrators : bool = True ): + def pipe( self, assay : Assay, remove_calibrators : bool = True, ignore_uncalibrated : bool = False ): """ A wrapper for calibrate / assign. @@ -3029,6 +3029,14 @@ def pipe( self, assay : Assay, remove_calibrators : bool = True ): remove_calibrators : bool If calibrators are present in the assay alongside other groups, remove the calibrator replicates after assignment or efficiency calculation. + ignore_uncalibrated : bool + If `True` assays that could neither be newly calibrated nor be assigned an existing + efficiency will be ignored. Otherwise, and error will be raised. + + Returns + ------- + assay : qpcr.Assay + The now calibrated `qpcr.Assay`. """ if self._eff_dict != {}: # first try to assign (will leave the assay unchanged if nothing is found) @@ -3039,13 +3047,18 @@ def pipe( self, assay : Assay, remove_calibrators : bool = True ): try: assay = self.calibrate( assay, remove_calibrators = remove_calibrators ) except: - aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + if not ignore_uncalibrated: + aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + else: + aw.SoftWarning("Calibrator:cannot_process_assay", id = assay.id() ) else: try: assay = self.calibrate( assay, remove_calibrators = remove_calibrators ) except: - aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) - + if not ignore_uncalibrated: + aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + else: + aw.SoftWarning("Calibrator:cannot_process_assay", id = assay.id() ) return assay def calibrate( self, assay : Assay, remove_calibrators : bool = True ): From 20bab064c44a9e9034ac1a0bf88983ab7260cde8 Mon Sep 17 00:00:00 2001 From: NoahKleinschmidt Date: Thu, 14 Apr 2022 19:25:34 +0200 Subject: [PATCH 2/2] update docs --- docs/index.html | 73 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/docs/index.html b/docs/index.html index a939398..c8af3ac 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3180,7 +3180,7 @@

Getting started

return dilution - def pipe( self, assay : Assay, remove_calibrators : bool = True ): + def pipe( self, assay : Assay, remove_calibrators : bool = True, ignore_uncalibrated : bool = False ): """ A wrapper for calibrate / assign. @@ -3195,6 +3195,14 @@

Getting started

remove_calibrators : bool If calibrators are present in the assay alongside other groups, remove the calibrator replicates after assignment or efficiency calculation. + ignore_uncalibrated : bool + If `True` assays that could neither be newly calibrated nor be assigned an existing + efficiency will be ignored. Otherwise, and error will be raised. + + Returns + ------- + assay : qpcr.Assay + The now calibrated `qpcr.Assay`. """ if self._eff_dict != {}: # first try to assign (will leave the assay unchanged if nothing is found) @@ -3205,13 +3213,18 @@

Getting started

try: assay = self.calibrate( assay, remove_calibrators = remove_calibrators ) except: - aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + if not ignore_uncalibrated: + aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + else: + aw.SoftWarning("Calibrator:cannot_process_assay", id = assay.id() ) else: try: assay = self.calibrate( assay, remove_calibrators = remove_calibrators ) except: - aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) - + if not ignore_uncalibrated: + aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + else: + aw.SoftWarning("Calibrator:cannot_process_assay", id = assay.id() ) return assay def calibrate( self, assay : Assay, remove_calibrators : bool = True ): @@ -6176,7 +6189,7 @@

Parameters

return dilution - def pipe( self, assay : Assay, remove_calibrators : bool = True ): + def pipe( self, assay : Assay, remove_calibrators : bool = True, ignore_uncalibrated : bool = False ): """ A wrapper for calibrate / assign. @@ -6191,6 +6204,14 @@

Parameters

remove_calibrators : bool If calibrators are present in the assay alongside other groups, remove the calibrator replicates after assignment or efficiency calculation. + ignore_uncalibrated : bool + If `True` assays that could neither be newly calibrated nor be assigned an existing + efficiency will be ignored. Otherwise, and error will be raised. + + Returns + ------- + assay : qpcr.Assay + The now calibrated `qpcr.Assay`. """ if self._eff_dict != {}: # first try to assign (will leave the assay unchanged if nothing is found) @@ -6201,13 +6222,18 @@

Parameters

try: assay = self.calibrate( assay, remove_calibrators = remove_calibrators ) except: - aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + if not ignore_uncalibrated: + aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + else: + aw.SoftWarning("Calibrator:cannot_process_assay", id = assay.id() ) else: try: assay = self.calibrate( assay, remove_calibrators = remove_calibrators ) except: - aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) - + if not ignore_uncalibrated: + aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + else: + aw.SoftWarning("Calibrator:cannot_process_assay", id = assay.id() ) return assay def calibrate( self, assay : Assay, remove_calibrators : bool = True ): @@ -7041,7 +7067,7 @@

Returns

-def pipe(self, assay: Assay, remove_calibrators: bool = True) +def pipe(self, assay: Assay, remove_calibrators: bool = True, ignore_uncalibrated: bool = False)

A wrapper for calibrate / assign.

@@ -7055,12 +7081,20 @@

Parameters

remove_calibrators : bool
If calibrators are present in the assay alongside other groups, remove the calibrator replicates after assignment or efficiency calculation.
+
ignore_uncalibrated : bool
+
If True assays that could neither be newly calibrated nor be assigned an existing +efficiency will be ignored. Otherwise, and error will be raised.
+ +

Returns

+
+
assay : Assay
+
The now calibrated Assay.
Expand source code -
def pipe( self, assay : Assay, remove_calibrators : bool = True ):
+
def pipe( self, assay : Assay, remove_calibrators : bool = True, ignore_uncalibrated : bool = False ):
     """
     A wrapper for calibrate / assign.
 
@@ -7075,6 +7109,14 @@ 

Parameters

remove_calibrators : bool If calibrators are present in the assay alongside other groups, remove the calibrator replicates after assignment or efficiency calculation. + ignore_uncalibrated : bool + If `True` assays that could neither be newly calibrated nor be assigned an existing + efficiency will be ignored. Otherwise, and error will be raised. + + Returns + ------- + assay : qpcr.Assay + The now calibrated `qpcr.Assay`. """ if self._eff_dict != {}: # first try to assign (will leave the assay unchanged if nothing is found) @@ -7085,13 +7127,18 @@

Parameters

try: assay = self.calibrate( assay, remove_calibrators = remove_calibrators ) except: - aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + if not ignore_uncalibrated: + aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + else: + aw.SoftWarning("Calibrator:cannot_process_assay", id = assay.id() ) else: try: assay = self.calibrate( assay, remove_calibrators = remove_calibrators ) except: - aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) - + if not ignore_uncalibrated: + aw.HardWarning("Calibrator:cannot_process_assay", id = assay.id() ) + else: + aw.SoftWarning("Calibrator:cannot_process_assay", id = assay.id() ) return assay