Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: force parsing specific columns as float #124

Merged
merged 2 commits into from
Jul 13, 2023
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Forced reading the `duplicates` and `coverage` columns of KrakenUniq profiles as
float (#123).

## [0.4.0] - (2023-07-02)

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ def read(cls, profile: BufferOrFilepath) -> DataFrame[KrakenUniqProfile]:
header=0,
index_col=False,
skipinitialspace=True,
dtype={"%": float},
dtype={
KrakenUniqProfile.percent: float,
KrakenUniqProfile.duplicates: float,
KrakenUniqProfile.coverage: float,
},
)
cls._check_num_columns(result, KrakenUniqProfile)
return result
4 changes: 4 additions & 0 deletions tests/data/krakenuniq/ERR3201952.krakenuniq.report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# KrakenUniq v1.0.2 DATE:2023-07-13T11:10:57Z DB:./testdb-krakenuniq DB_SIZE:358660 WD:/home/james/git/nf-core/taxprofiler/testing/blah/work/d4/9641b418650bf507e0b05143a5800d
# CL:/usr/local/bin/krakenuniq --db testdb-krakenuniq --threads 2 --report-file ERR3201952.krakenuniq.report.txt ERR3201952.merged.fastq.gz
% reads taxReads kmers dup cov taxID rank taxName
100 4937 4937 10648888 1 NA 0 no rank unclassified
1 change: 1 addition & 0 deletions tests/integration/test_krakenuniq_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path:
[
"test3.krakenuniq.report.txt",
"test1.krakenuniq.report.txt",
"ERR3201952.krakenuniq.report.txt",
pytest.param(
"test1-invalid.krakenuniq.report.txt",
marks=pytest.mark.raises(exception=SchemaErrors),
Expand Down