fix(lapis): advanced queries: allow ambiguous mutation symbols in "mutation from", disallow . and - in insertions#1549
Merged
fengelniederhammer merged 18 commits intomainfrom Feb 25, 2026
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances mutation query handling in Lapis by allowing ambiguous IUPAC codes in the "mutation from" position and restricting special symbols (. and -) from being used in insertions and "mutation from" positions. The changes update the ANTLR grammar, add ambiguous amino acid codes B and Z, and refactor tests from individual methods to a parameterized test structure.
Changes:
- Extended ambiguous amino acid symbols to include B (Aspartic acid/Asparagine) and Z (Glutamic acid/Glutamine) in addition to X
- Modified ANTLR grammar to allow ambiguous symbols in "from" position while disallowing
.and-in insertions and "from" positions - Refactored mutation and insertion tests from individual test methods to comprehensive parameterized test cases using TestCaseCollection
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lapis/src/main/antlr/org/genspectrum/lapis/model/advancedqueryparser/AdvancedQuery.g4 | Restructured grammar rules to merge ambiguous symbols into main symbol rules and created specialSymbolsInMutationTo for . and - |
| lapis/src/main/kotlin/org/genspectrum/lapis/model/MutationValidator.kt | Added B and Z to ambiguousAaSymbols set for proper IUPAC amino acid ambiguity code support |
| lapis/src/main/kotlin/org/genspectrum/lapis/model/AdvancedQueryCustomListener.kt | Simplified variable naming in mutation handling logic for better code clarity |
| lapis/src/test/kotlin/org/genspectrum/lapis/model/AdvancedQueryFacadeTest.kt | Refactored individual test methods into comprehensive TestCaseCollection-based parameterized tests with extensive coverage |
| lapis/src/test/kotlin/org/genspectrum/lapis/model/AdvancedQueryFacadeMultiSegmentTest.kt | Added tests verifying ambiguous symbols work correctly in multi-segmented genomes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lapis/src/test/kotlin/org/genspectrum/lapis/model/AdvancedQueryFacadeTest.kt
Outdated
Show resolved
Hide resolved
. and - in insertions and in "mutation from". and - in insertions
fhennig
approved these changes
Feb 25, 2026
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.
resolves #1508
Changes the grammar of the advances queries:
N501Ggene:X501T.("equal to reference") and-("deletion") in insertions, e.g. those will error now:ins_501:A.Ains_gene:501:A-AI also restructured one of the unit tests to make it easier to maintain.
PR Checklist
- [ ] All necessary documentation has been adapted.not necessary as far as I can see