From 3638c39535871a2ecb8a4e581396df1af452ccad Mon Sep 17 00:00:00 2001 From: maximskorik Date: Thu, 9 Dec 2021 17:26:26 +0100 Subject: [PATCH 1/4] let `csv.Sniffer` identify the delimiter --- RIAssigner/data/PandasData.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RIAssigner/data/PandasData.py b/RIAssigner/data/PandasData.py index 6aa34c2..4fd75a7 100644 --- a/RIAssigner/data/PandasData.py +++ b/RIAssigner/data/PandasData.py @@ -25,8 +25,7 @@ def read(self): def _read_into_dataframe(self): """ Read the data from file into dataframe. """ if(self._filetype in ['csv', 'tsv']): - separator = define_separator(self._filename) - self._data = read_csv(self._filename, sep=separator) + self._data = read_csv(self._filename, sep=None, engine="python") else: raise NotImplementedError("File formats different from ['csv', 'tsv'] are not implemented yet.") From bfcc02143fa4dd05d727302490d4f16b3a9d2a1b Mon Sep 17 00:00:00 2001 From: maximskorik Date: Thu, 9 Dec 2021 17:52:40 +0100 Subject: [PATCH 2/4] update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b3d9bf..4deaf08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Removed +## [0.3.1] - 2021-12-9 +### Changed +- data/PandasData.py: `_read_into_dataframe()` now deduces a proper delimiter via python's [`csv.Sniffer`](https://docs.python.org/3/library/csv.html#csv.Sniffer) class. [#73](https://github.com/RECETOX/RIAssigner/pull/73) + ## [0.3.0] - 2021-09-03 ### Added - __main__.py + cli/LoadDataAction.py: Added required passing of filetype and rt unit. [#64](https://github.com/RECETOX/RIAssigner/issues/64) [#67](https://github.com/RECETOX/RIAssigner/issues/67) [#68](https://github.com/RECETOX/RIAssigner/pull/68) From f57b5c17270421527c31eca592ccf1db645ca877 Mon Sep 17 00:00:00 2001 From: maximskorik Date: Thu, 9 Dec 2021 17:55:35 +0100 Subject: [PATCH 3/4] update usage examples in README.md and example_usage.ipynb --- README.md | 4 ++-- doc/example_usage.ipynb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 104ec20..c1a1027 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ from RIAssigner.compute import Kovats from RIAssigner.data import MatchMSData, PandasData # Load reference & query data -query = PandasData("../tests/data/csv/aplcms_aligned_peaks.csv") -reference = MatchMSData("../tests/data/msp/Alkanes_20210325.msp", rt_unit="min") +query = PandasData("../tests/data/csv/aplcms_aligned_peaks.csv", "csv", rt_unit="seconds") +reference = MatchMSData("../tests/data/msp/Alkanes_20210325.msp", "msp", rt_unit="min") # Compute RI and write it back to file query.retention_indices = Kovats().compute(query, reference) diff --git a/doc/example_usage.ipynb b/doc/example_usage.ipynb index 7622459..4a78c8c 100644 --- a/doc/example_usage.ipynb +++ b/doc/example_usage.ipynb @@ -4,12 +4,12 @@ "cell_type": "code", "execution_count": 1, "source": [ - "from RIAssigner.compute import Kovats\r\n", - "from RIAssigner.data import MatchMSData, PandasData\r\n", - "\r\n", - "# Load test data and init computation method\r\n", - "query = PandasData(\"../tests/data/csv/aplcms_aligned_peaks.csv\")\r\n", - "reference = MatchMSData(\"../tests/data/msp/Alkanes_20210325.msp\", rt_unit=\"min\")\r\n", + "from RIAssigner.compute import Kovats\n", + "from RIAssigner.data import MatchMSData, PandasData\n", + "\n", + "# Load test data and init computation method\n", + "query = PandasData(\"../tests/data/csv/aplcms_aligned_peaks.csv\", \"csv\", rt_unit=\"seconds\")\n", + "reference = MatchMSData(\"../tests/data/msp/Alkanes_20210325.msp\", \"msp\", rt_unit=\"min\")\n", "method = Kovats()" ], "outputs": [], From 031ca052d7b5d0d110a2e83b20fdc8a3b57da696 Mon Sep 17 00:00:00 2001 From: maximskorik Date: Thu, 9 Dec 2021 17:58:28 +0100 Subject: [PATCH 4/4] correct typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4deaf08..ec43f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.3.1] - 2021-12-9 ### Changed -- data/PandasData.py: `_read_into_dataframe()` now deduces a proper delimiter via python's [`csv.Sniffer`](https://docs.python.org/3/library/csv.html#csv.Sniffer) class. [#73](https://github.com/RECETOX/RIAssigner/pull/73) +- data/PandasData.py: `_read_into_dataframe()` now deduces a proper delimiter via Python's [`csv.Sniffer`](https://docs.python.org/3/library/csv.html#csv.Sniffer) class. [#73](https://github.com/RECETOX/RIAssigner/pull/73) ## [0.3.0] - 2021-09-03 ### Added