Skip to content

Completeness correction - #52

Merged
johnlees merged 6 commits into
mainfrom
completeness_correction
Aug 13, 2025
Merged

johnlees merged 6 commits into
mainfrom
completeness_correction

Conversation

@johannahelene

Copy link
Copy Markdown
Collaborator

feat: implement completeness correction for MAG distance calculations

  • Add completeness correction support to distance calculations
  • Implement completeness_correction() function in jaccard.rs
  • Add completeness vector creation and application in distance matrix calculations
  • Update CLI to accept --completeness-file parameter
  • Add a comprehensive test suite for completeness correction functionality

This feature allows for more accurate distance calculations when working with
Metagenome-Assembled Genomes (MAGs) by correcting for genome completeness
values provided in a tab-separated file format.

Johanna added 2 commits July 2, 2025 14:50
- Implement completeness correction in distance calculations
- Add --completeness-file CLI parameter
- Add comprehensive completeness test suite
- Support tab-separated completeness input format

Enables more accurate distances for Metagenome-Assembled Genomes (MAGs).
@johannahelene
johannahelene requested a review from johnlees August 8, 2025 11:32

@johnlees johnlees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good. Main comments:

  • Have you run cargo clippy and cargo fmt?
  • With the change to f64, was that just for precision while computing, then we still want to store as f32 for the final values? In which case, ignore my comments about those types.
  • The completeness correction function would be better refactored a bit for performance reasons, and to make all the dist functions more readable. I can explain in my comment is unclear.
  • Reading the completness file into a map should be a function in the io.rs file

Comment thread src/cli.rs Resolved
Comment thread src/cli.rs Resolved
Comment thread src/distances/distance_matrix.rs Resolved
Comment thread src/distances/jaccard.rs Resolved
Comment thread src/distances/jaccard.rs Resolved
Comment thread src/lib.rs Resolved
Comment thread src/sketch/multisketch.rs Resolved
Comment thread tests/completeness.rs Resolved
Comment thread tests/completeness.rs Resolved
Comment thread tests/completeness.rs Resolved
@johannahelene

Copy link
Copy Markdown
Collaborator Author

I should have written that in the commit message, but I changed how the completenesses are read in. I am now not using an intermediate HashMap anymore, as I thought it was not necessary, and immediately read in the genome names and save the completeness to their position in the completeness vector.

@johannahelene
johannahelene requested a review from johnlees August 12, 2025 14:22
Comment thread src/distances/mod.rs Resolved
Comment thread src/distances/mod.rs Resolved
…n, adjusted the test_result_correct files to work with new precision (f64).
@codecov

codecov Bot commented Aug 12, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.40580% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.90%. Comparing base (0a0df05) to head (99cc811).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/distances/mod.rs 86.84% 10 Missing ⚠️
src/sketch/multisketch.rs 30.76% 9 Missing ⚠️
src/io.rs 87.17% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
+ Coverage   85.37%   85.90%   +0.53%     
==========================================
  Files          17       17              
  Lines        2735     2590     -145     
==========================================
- Hits         2335     2225     -110     
+ Misses        400      365      -35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@johnlees
johnlees merged commit a0d3b59 into main Aug 13, 2025
@johnlees
johnlees deleted the completeness_correction branch August 13, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants