Skip to content

Commit

Permalink
Merge pull request #73 from maximskorik/issue_72
Browse files Browse the repository at this point in the history
Fix bug when reading tsv files
  • Loading branch information
hechth authored Dec 10, 2021
2 parents a9dd2b7 + 031ca05 commit ff98f0a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions RIAssigner/data/PandasData.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down
12 changes: 6 additions & 6 deletions doc/example_usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down

0 comments on commit ff98f0a

Please sign in to comment.