HuttleyLab / DiverseSeq

Tools for analysis of sequence divergence
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

Misc #70

Closed GavinHuttley closed 4 weeks ago

GavinHuttley commented 4 weeks ago

Summary by Sourcery

Enhancements:

sourcery-ai[bot] commented 4 weeks ago

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

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](https://app.sourcery.ai) 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 - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
coveralls commented 4 weeks ago

Pull Request Test Coverage Report for Build 11623855545

Details


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

💛 - Coveralls