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

Misc #70

Merged
merged 2 commits into from
Nov 1, 2024
Merged

Misc #70

merged 2 commits into from
Nov 1, 2024

Conversation

GavinHuttley
Copy link
Collaborator

@GavinHuttley GavinHuttley commented Nov 1, 2024

Summary by Sourcery

Enhancements:

  • Refactor distance calculation logic to use a unified function call for both mash and euclidean distances, reducing code duplication.

dependabot bot and others added 2 commits October 28, 2024 19:29
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.7.0 to 0.7.1.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.7.0...0.7.1)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
[CHANGED] also turn off code coverage for numba decorated
    functions as they cannot be evaluated by pytest-cov
Copy link

sourcery-ai bot commented Nov 1, 2024

Reviewer's Guide by Sourcery

This PR refactors the sequence distance calculation implementation to improve code organization and sets new default parameters. The main changes include restructuring the distance calculation logic in the __init__ method to use a function mapping approach, updating default parameters for k-mer size and sketch size, and adding code coverage pragmas.

Updated class diagram for distance calculation

classDiagram
    class DistanceCalculator {
        -int k
        -int|None sketch_size
        -str moltype
        -bool|None mash_canonical_kmers
        -bool show_progress
        -function _s2a
        -function _func
        -dict _func_kwargs
        +main(seqs: c3_types.SeqsCollectionType) c3_types.PairwiseDistanceType
    }
    note for DistanceCalculator "Refactored to use function mapping for distance calculation"
    class mash_distances
    class euclidean_distances
    DistanceCalculator --> mash_distances : uses
    DistanceCalculator --> euclidean_distances : uses
Loading

File-Level Changes

Change Details Files
Refactored distance calculation implementation for better organization
  • Moved distance calculation logic setup to init method
  • Created function mapping and kwargs dictionary for different distance modes
  • Simplified main() method by using stored function and kwargs
  • Added sequence moltype conversion at the start of main()
  • Removed redundant distance mode validation
src/diverse_seq/distance.py
Updated default parameters for sequence analysis
  • Changed default k-mer size from 16 to 12
  • Set default sketch size to 3000 instead of None
  • Removed redundant default value descriptions from docstrings
src/diverse_seq/distance.py
Added code coverage pragmas and removed validation
  • Added 'pragma: no cover' to several low-level hash functions
  • Removed validation for sketch size when distance mode is not mash
src/diverse_seq/distance.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @GavinHuttley - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please explain the rationale for changing the default k-mer size from 16 to 12 and sketch_size from None to 3000. These changes could impact performance and accuracy.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@GavinHuttley GavinHuttley merged commit e72811d into HuttleyLab:main Nov 1, 2024
13 checks passed
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11623855545

Details

  • 9 of 9 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+3.1%) to 91.947%

Totals Coverage Status
Change from base Build 11512015058: 3.1%
Covered Lines: 1176
Relevant Lines: 1279

💛 - Coveralls

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