Skip to content

fix(lapis): advanced queries: allow ambiguous mutation symbols in "mutation from", disallow . and - in insertions#1549

Merged
fengelniederhammer merged 18 commits intomainfrom
1508-check-whether-lapis-sufficiently-allows-ambiguity-codes-in-mutations
Feb 25, 2026
Merged

fix(lapis): advanced queries: allow ambiguous mutation symbols in "mutation from", disallow . and - in insertions#1549
fengelniederhammer merged 18 commits intomainfrom
1508-check-whether-lapis-sufficiently-allows-ambiguity-codes-in-mutations

Conversation

@fengelniederhammer
Copy link
Contributor

@fengelniederhammer fengelniederhammer commented Feb 19, 2026

resolves #1508

Changes the grammar of the advances queries:

  • allow ambiguous symbols in "mutation from", e.g. those are allowed now:
    • N501G
    • gene:X501T
  • disallow . ("equal to reference") and - ("deletion") in insertions, e.g. those will error now:
    • ins_501:A.A
    • ins_gene:501:A-A

I 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

  • The implemented feature is covered by an appropriate test.

@vercel
Copy link

vercel bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lapis Ready Ready Preview, Comment Feb 19, 2026 10:26am

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@fengelniederhammer fengelniederhammer changed the title fix(lapis): advanced queries: allow ambiguous mutation symbols in "mutation from", disallow . and - in insertions and in "mutation from" fix(lapis): advanced queries: allow ambiguous mutation symbols in "mutation from", disallow . and - in insertions Feb 19, 2026
@fengelniederhammer fengelniederhammer merged commit 244a289 into main Feb 25, 2026
11 checks passed
@fengelniederhammer fengelniederhammer deleted the 1508-check-whether-lapis-sufficiently-allows-ambiguity-codes-in-mutations branch February 25, 2026 10:25
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.

Check whether Lapis sufficiently allows ambiguity codes in mutations

3 participants