Integrate pairwise distance calculations and visualization features (simplot-like plots) - #18
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors msaexplorer to standardize alignment iteration/length access, introduces new dataclass-based result containers, and adds a new “simplot-like similarity” visualization that leverages pairwise distance calculations across sliding windows.
Changes:
- Refactor core + app code to use
__iter__/__len__-style access (next(iter(aln)),len(aln)) and return dataclasses for stats/variants/ORFs/distances. - Add simplot-like similarity plotting (library + Shiny integration) and expand nucleotide distance metric options (incl.
jc69,k2p). - Add export helpers/tests and document repo-specific coding standards for future contributions.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
msaexplorer/explore.py |
Introduces dataclass outputs (stats, SNPs, ORFs, pairwise distances) and centralizes distance calculation mapping. |
msaexplorer/draw.py |
Refactors plotting utilities to new alignment interface and adds simplot() plotting helper. |
msaexplorer/export.py |
Updates exporters to consume new dataclasses and adds support for AlignmentStats export. |
msaexplorer/_helpers.py |
Adds shared internal helpers for alignment parsing, distance metrics, path creation, and draw utilities. |
msaexplorer/_data_classes.py |
Adds frozen dataclasses for SNPs, stats, ORFs, and pairwise distance results. |
msaexplorer/__init__.py |
Updates examples to use iterator-based alignment access. |
app_src/shiny_server.py |
Updates Shiny server logic for new interfaces, adds new plot type/metric choices, and adapts download handling for dataclasses. |
app_src/shiny_plots.py |
Adds simplot-like plot option and adapts analysis heatmap to new PairwiseDistance result type. |
tests/test_stats_calculations.py |
Updates tests to new dataclass return types and adds coverage for reference-distance calculations. |
tests/test_orf_detection.py |
Updates ORF tests to new OrfCollection/OpenReadingFrame structures. |
tests/test_export.py |
Adds new export tests for SNP/FASTA/stats/ORF/character frequencies/percent recovery exporters. |
tests/test_draw_plots.py |
Adds plotting tests (including simplot) using a non-interactive matplotlib backend. |
tests/test_alignment_parsing.py |
Switches parsing tests to _helpers._read_alignment. |
tests/README.md |
Updates test suite scope description. |
README.md |
Refreshes feature bullets and clarifies package capabilities. |
pyproject.toml |
Bumps package version to 0.5. |
.github/copilot-instructions.md |
Documents repository coding/testing/style conventions for AI-assisted edits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and refactors to both the core
msaexplorerlibrary and the Shiny app frontend. The main changes include standardizing the use of the alignment object interface, adding support for a new "simplot-like similarity" plot type, improving UI options for distance metrics, and documenting repository coding standards. These updates enhance code maintainability, add new features, and ensure consistency across the codebase.Interface and API Consistency:
app_src/shiny_server.py,app_src/shiny_plots.py, andmsaexplorer/__init__.pyto usenext(iter(aln))andlen(aln)instead of accessing the.alignmentdictionary directly. This change standardizes how alignment objects are iterated and measured, improving abstraction and maintainability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]New Features:
UI and Analysis Improvements:
jc69,k2p) for nucleotide alignments and displaying explanatory info for each metric. [1] [2]AlignmentStatsobjects. [1] [2]Documentation and Standards:
.github/copilot-instructions.mdfile detailing repository-specific coding, documentation, and testing standards to guide future contributions and AI-assisted edits.README.md, including clarifying feature lists and package capabilities. [1] [2]