Skip to content

MAINT: update to latest cogent3 - #74

Merged
GavinHuttley merged 1 commit into
HuttleyLab:developfrom
GavinHuttley:develop
Jul 16, 2025
Merged

MAINT: update to latest cogent3#74
GavinHuttley merged 1 commit into
HuttleyLab:developfrom
GavinHuttley:develop

Conversation

@GavinHuttley

@GavinHuttley GavinHuttley commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator

[CHANGED] and bump version to 2025.7.17

Summary by Sourcery

Migrate the codebase to the latest cogent3 API, update imports and function calls accordingly, adjust tests for removed parameters, and bump the package version and dependency requirement.

Bug Fixes:

  • Fix DNA.make_seq call signature in complement.py
  • Ensure correct dtype casting in array_to_str

Enhancements:

  • Replace custom FASTA loader with cogent3.load_aligned_seqs and update various imports to match the new cogent3 structure
  • Refactor motif_count, complement, util, and log_lin modules to use updated cogent3 functions and tables

Build:

  • Bump package version to 2025.7.17
  • Update cogent3 dependency to >=2025.7.10a3 in pyproject.toml

Tests:

  • Remove deprecated array_align parameter in tests and switch to using the .array_seqs attribute
  • Update make_aligned_seqs usage in tests to match new API signature

Chores:

  • Remove deprecated load_from_fasta utility function

[CHANGED] and bump version to 2025.7.17
@sourcery-ai

sourcery-ai Bot commented Jul 16, 2025

Copy link
Copy Markdown

Reviewer's Guide

This PR modernizes the codebase for the latest cogent3 API by replacing custom loading utilities with cogent3 loaders, updating imports and API calls across production code and tests, and bumping the package version and dependency spec

Class diagram for updated sequence loading in aln_to_counts.py

classDiagram
    class align_to_counts {
        +direction
        +chosen_base
        +orig_seqs
        +seqs
        +just_nucs(seqs)
    }
    class cogent3 {
        +load_aligned_seqs(path, moltype)
    }
    align_to_counts --> cogent3 : uses load_aligned_seqs
Loading

Class diagram for removal of load_from_fasta utility

classDiagram
    class util {
        -load_from_fasta(filename)
        +array_to_str(data)
    }
    class cogent3 {
        +load_aligned_seqs(path, moltype)
    }
    util ..> cogent3 : replaced by load_aligned_seqs
Loading

Class diagram for motif_count.py cogent3 API update

classDiagram
    class motif_count {
        +profile_to_seq_counts(data, flank_size)
        +dna_alpha
    }
    class cogent3 {
        +get_moltype(type)
        +make_table(...)
    }
    motif_count --> cogent3 : uses get_moltype, make_table
Loading

Class diagram for log_lin.py Table import update

classDiagram
    class log_lin {
        +Table
    }
    class cogent3_core_table {
        +Table
    }
    log_lin ..> cogent3_core_table : imports Table
Loading

File-Level Changes

Change Details Files
Test suite fixtures and helpers updated to the new loader API
  • Removed array_align argument from load_aligned_seqs calls
  • Replaced seq_data references with array_seqs
  • Swapped ArrayAlignment constructions for make_aligned_seqs invocations
  • Aligned test helper signatures with updated cogent3 loader
tests/test_entropy.py
tests/test_control.py
tests/test_motif_count.py
tests/test_util.py
Replaced custom FASTA loader with cogent3.load_aligned_seqs
  • Imported cogent3 and removed load_from_fasta import and definition
  • Changed sequence loading in align_to_counts to use cogent3.load_aligned_seqs
  • Adjusted data extraction to use array_seqs
  • Added dtype cast in array_to_str to ensure uint8 indices
src/mutation_motif/aln_to_counts.py
src/mutation_motif/util.py
Updated cogent3-based imports and API usages in core modules
  • Imported get_moltype alongside make_table in motif_count
  • Introduced dna_alpha via get_moltype
  • Changed Table import path from util.table to core.table in log_lin
  • Adjusted DNA.make_seq call signature in complement
src/mutation_motif/motif_count.py
src/mutation_motif/log_lin.py
src/mutation_motif/complement.py
Bumped package version and cogent3 dependency
  • Raised cogent3 requirement in pyproject.toml to >=2025.7.10a3
  • Updated version in init.py to 2025.7.17
pyproject.toml
src/mutation_motif/__init__.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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

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 and they look great!


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 07f791a into HuttleyLab:develop Jul 16, 2025
10 of 18 checks passed
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.

1 participant