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

[MRG] add --distance-matrix option to sourmash compare #2225

Merged
merged 24 commits into from
Aug 26, 2022
Merged

Conversation

ctb
Copy link
Contributor

@ctb ctb commented Aug 20, 2022

This PR addresses #2196 by adding a --distance-matrix flag to compare.

This flag simply subtracts every value in the matrix from 1, converting it from a similarity matrix to a distance matrix. Easy peasy!

Along the way, I decided to clean up the compare tests in tests/test_sourmash.py, which makes for a somewhat messier diff, sorry :(. Specifically, I

  • renamed the compare tests to all have def test_compare at the beginning of the test fn;
  • switched the tests from decorator c to test fixture runtmp;
  • added comments;
  • refactored some shared sig and matrix loading code out of a number of tests;

TODO:

  • confirm that plot code needs no changes

Fixes #2196

@codecov
Copy link

codecov bot commented Aug 20, 2022

Codecov Report

Merging #2225 (ef16462) into latest (718c9b5) will increase coverage by 7.37%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           latest    #2225      +/-   ##
==========================================
+ Coverage   84.66%   92.04%   +7.37%     
==========================================
  Files         131      100      -31     
  Lines       15512    11245    -4267     
  Branches     2210     2213       +3     
==========================================
- Hits        13134    10351    -2783     
+ Misses       2085      601    -1484     
  Partials      293      293              
Flag Coverage Δ
python 92.04% <100.00%> (+<0.01%) ⬆️
rust ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/sourmash/cli/compare.py 100.00% <100.00%> (ø)
src/sourmash/commands.py 90.72% <100.00%> (+0.07%) ⬆️
src/core/src/sketch/minhash.rs
src/core/src/from.rs
src/core/src/signature.rs
src/core/src/encodings.rs
src/core/src/index/search.rs
src/core/src/index/sbt/mhbt.rs
src/core/tests/test.rs
src/core/src/lib.rs
... and 23 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ctb ctb changed the title [WIP] add --distance-matrix option to sourmash compare [MRG] add --distance-matrix option to sourmash compare Aug 20, 2022
@ctb
Copy link
Contributor Author

ctb commented Aug 20, 2022

ready for review @sourmash-bio/devs !

@taylorreiter
Copy link
Contributor

did you confirm that the plot code needs no changes as marked as a todo item?

Copy link
Contributor

@taylorreiter taylorreiter left a comment

Choose a reason for hiding this comment

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

a couple of comments, otherwise LGTM.

src/sourmash/cli/compare.py Show resolved Hide resolved
src/sourmash/commands.py Outdated Show resolved Hide resolved
@taylorreiter
Copy link
Contributor

also why is the docs build failing? (sry if its a dumb question bc i haven't been keeping up with sourmash CI)

@ctb
Copy link
Contributor Author

ctb commented Aug 20, 2022

also why is the docs build failing? (sry if its a dumb question bc i haven't been keeping up with sourmash CI)

readthedocs is ALWAYS failing. Usually because I haven't pinned some version or something 😆

I'll take a look in a bit.

@ctb
Copy link
Contributor Author

ctb commented Aug 20, 2022

did you confirm that the plot code needs no changes as marked as a todo item?

unfortunately, it does indeed need changes. but I think I will do as a separate issue.

(oddly, I thought I'd made this comment ...somewhere, but apparently forgot it. yay.)

@ctb
Copy link
Contributor Author

ctb commented Aug 20, 2022

readthedocs builds failing issue: #2227

@ctb
Copy link
Contributor Author

ctb commented Aug 20, 2022

plot adjustment issue: #2228

@ctb
Copy link
Contributor Author

ctb commented Aug 20, 2022

thanks for the review @taylorreiter - I'm going to wait to merge until #2215 is in!

Base automatically changed from fix_containment_direction to latest August 26, 2022 01:05
@ctb ctb merged commit b1ddabc into latest Aug 26, 2022
@ctb ctb deleted the add/distance_matrix branch August 26, 2022 02:36
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.

support distance matrix output from compare?
2 participants