Skip to content

Commit

Permalink
fix: force parsing specific columns as float
Browse files Browse the repository at this point in the history
  • Loading branch information
Midnighter committed Jul 13, 2023
1 parent 6407ec1 commit f252fb1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit f252fb1

Please sign in to comment.