From 5b233c905bc307b8cab552748d547661a8dd911d Mon Sep 17 00:00:00 2001 From: rkouakou06 Date: Wed, 27 May 2026 14:30:23 +0200 Subject: [PATCH 1/5] Add "R Squared" column to calibration data --- ms_reader/extract.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ms_reader/extract.py b/ms_reader/extract.py index af083f9..9b0e296 100644 --- a/ms_reader/extract.py +++ b/ms_reader/extract.py @@ -65,7 +65,7 @@ def __init__(self, data, calrep=None, metadata=None, met_class="CM"): columns = [ "Compound", "Sample_Name", "Area", "Response Ratio", "Sample Type", "Calculated Amt", "Theoretical Amt", - "Excluded", "%Diff" + "Excluded", "%Diff", "R Squared" ] self.data = self.data[columns].copy() self._replace_nf() @@ -379,6 +379,7 @@ def _generate_minmax_calib(self): {"min": "LLOQ", "max": "ULOQ"}, axis=1 ) + min_max_calib["R Squared"] = self.calib_data.groupby("Compound")["R Squared"].first() self.calib_data = min_max_calib self.excel_tables.append( ("Calibration", self.calib_data) From c2382b8cfd9582ffb57b34c105bf8addee085cb7 Mon Sep 17 00:00:00 2001 From: rkouakou06 Date: Wed, 27 May 2026 14:30:40 +0200 Subject: [PATCH 2/5] Add ms_reader cache and egg-info directories to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index ae05cdb..e7d00bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /venv/ /.idea/ /test_pypi_token.txt +ms_reader/__pycache__/ +ms_reader.egg-info/ +tests/__pycache__/ \ No newline at end of file From 6a23cd5c1da703289d3d1002fb23b7c758df2325 Mon Sep 17 00:00:00 2001 From: rkouakou06 Date: Wed, 27 May 2026 14:45:41 +0200 Subject: [PATCH 3/5] Update version to 1.9.0 and add changelog entry for "R Squared" column in calibration tab --- CHANGELOG.md | 8 ++++++++ ms_reader/__init__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08d459c..879e6fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.9.0] - 2026-05-27 + +### Addition + +Added a "R Squared" column in the calibration tab of the output file, taken directly from the Skyline input file. + +# Changelog + ## [1.8.1] - 2026-02-02 ### Changed diff --git a/ms_reader/__init__.py b/ms_reader/__init__.py index 2d986fc..0a0a43a 100644 --- a/ms_reader/__init__.py +++ b/ms_reader/__init__.py @@ -1 +1 @@ -__version__ = "1.8.1" +__version__ = "1.9.0" From 04de0fe5a5d7e01f954a55af38cc5f7dd7ac31f5 Mon Sep 17 00:00:00 2001 From: rkouakou06 Date: Mon, 1 Jun 2026 10:05:15 +0200 Subject: [PATCH 4/5] Add handling for "R Squared" column in Extractor class for skyline input --- ms_reader/extract.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ms_reader/extract.py b/ms_reader/extract.py index 9b0e296..f66eb62 100644 --- a/ms_reader/extract.py +++ b/ms_reader/extract.py @@ -65,8 +65,14 @@ def __init__(self, data, calrep=None, metadata=None, met_class="CM"): columns = [ "Compound", "Sample_Name", "Area", "Response Ratio", "Sample Type", "Calculated Amt", "Theoretical Amt", - "Excluded", "%Diff", "R Squared" + "Excluded", "%Diff" ] + + # Only for skyline input + self.r_squared = None # If R Squared column is present, it is stored in a separate df to be added to the calibration table at the end of the process, + if "R Squared" in self.data.columns: + self.r_squared = self.data.groupby("Compound")["R Squared"].first() + self.data = self.data[columns].copy() self._replace_nf() self._split_dataframes() @@ -379,7 +385,9 @@ def _generate_minmax_calib(self): {"min": "LLOQ", "max": "ULOQ"}, axis=1 ) - min_max_calib["R Squared"] = self.calib_data.groupby("Compound")["R Squared"].first() + # If R Squared column is present (skyline), add it to the calibration table + if self.r_squared is not None: + min_max_calib["R Squared"] = self.r_squared self.calib_data = min_max_calib self.excel_tables.append( ("Calibration", self.calib_data) From 68c5db5d97d360078b96f6549b713a7f8842ea76 Mon Sep 17 00:00:00 2001 From: rkouakou06 Date: Mon, 1 Jun 2026 16:23:35 +0200 Subject: [PATCH 5/5] Refactor data type handling in Extractor class to ensure proper object types --- ms_reader/extract.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ms_reader/extract.py b/ms_reader/extract.py index f66eb62..b1ac9c2 100644 --- a/ms_reader/extract.py +++ b/ms_reader/extract.py @@ -286,7 +286,7 @@ def _replace_nf(self): :return: None """ # Set the option to raise an error when downcasting - pd.set_option('future.no_silent_downcasting', True) + # pd.set_option('future.no_silent_downcasting', True) self.data["Area"] = self.data["Area"].replace("N/F", 0).infer_objects(copy=False) self.data["Calculated Amt"] = self.data["Calculated Amt"].replace("N/F", 0).copy() @@ -399,6 +399,8 @@ def handle_calibration(self): :return: None """ self._generate_minmax_calib() + self.calib_data = self.calib_data.astype(object) + self.calib_nulls = self.calib_data.astype(object) self.calib_data, self.calib_nulls = self._replace( self.calib_data, to_replace=[np.nan, 0], @@ -998,6 +1000,7 @@ def _define_loq(self, loq_table): lambda x: float(x) < self.calib_data.at[idx, "min"]) uloq_mask = loq_table.loc[idx, :].apply( lambda x: float(x) > self.calib_data.at[idx, "max"]) + loq_table = loq_table.astype(object) loq_table.loc[idx, :] = loq_table.loc[idx, :].where(~lloq_mask, other="