From 667f487abdf9124af83cfce7c49486f4fb4a6412 Mon Sep 17 00:00:00 2001 From: Jonas Kellerer Date: Tue, 23 Jan 2024 15:00:05 +0100 Subject: [PATCH] feat: amino acid and nucleotide insertion filters are case-insensitive --- .../org/genspectrum/lapis/request/AminoAcidInsertion.kt | 3 +++ .../org/genspectrum/lapis/request/NucleotideInsertion.kt | 3 +++ .../org/genspectrum/lapis/request/AminoAcidInsertionTest.kt | 4 ++++ .../org/genspectrum/lapis/request/NucleotideInsertionTest.kt | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/lapis2/src/main/kotlin/org/genspectrum/lapis/request/AminoAcidInsertion.kt b/lapis2/src/main/kotlin/org/genspectrum/lapis/request/AminoAcidInsertion.kt index b991cbf85..68eac54f0 100644 --- a/lapis2/src/main/kotlin/org/genspectrum/lapis/request/AminoAcidInsertion.kt +++ b/lapis2/src/main/kotlin/org/genspectrum/lapis/request/AminoAcidInsertion.kt @@ -51,6 +51,9 @@ data class AminoAcidInsertion(val position: Int, val gene: String, val insertion private val AMINO_ACID_INSERTION_REGEX = Regex( """^ins_(?[a-zA-Z0-9_-]+):(?\d+):(?(([a-zA-Z?]|(\.\*))+))$""", + setOf( + RegexOption.IGNORE_CASE, + ), ) @JsonComponent diff --git a/lapis2/src/main/kotlin/org/genspectrum/lapis/request/NucleotideInsertion.kt b/lapis2/src/main/kotlin/org/genspectrum/lapis/request/NucleotideInsertion.kt index 0fdde101c..7af796895 100644 --- a/lapis2/src/main/kotlin/org/genspectrum/lapis/request/NucleotideInsertion.kt +++ b/lapis2/src/main/kotlin/org/genspectrum/lapis/request/NucleotideInsertion.kt @@ -51,6 +51,9 @@ data class NucleotideInsertion(val position: Int, val insertions: String, val se private val NUCLEOTIDE_INSERTION_REGEX = Regex( """^ins_((?[a-zA-Z0-9_-]+)(?=:):)?(?\d+):(?(([a-zA-Z?]|(\.\*))+))$""", + setOf( + RegexOption.IGNORE_CASE, + ), ) @JsonComponent diff --git a/lapis2/src/test/kotlin/org/genspectrum/lapis/request/AminoAcidInsertionTest.kt b/lapis2/src/test/kotlin/org/genspectrum/lapis/request/AminoAcidInsertionTest.kt index 82b4661b6..2772f6740 100644 --- a/lapis2/src/test/kotlin/org/genspectrum/lapis/request/AminoAcidInsertionTest.kt +++ b/lapis2/src/test/kotlin/org/genspectrum/lapis/request/AminoAcidInsertionTest.kt @@ -88,6 +88,10 @@ class AminoAcidInsertionTest { "\"ins_gEne1:123:ABCD\"", AminoAcidInsertion(123, "gene1", "ABCD"), ), + Arguments.of( + "\"INs_gEne1:123:ABCD\"", + AminoAcidInsertion(123, "gene1", "ABCD"), + ), ) @JvmStatic diff --git a/lapis2/src/test/kotlin/org/genspectrum/lapis/request/NucleotideInsertionTest.kt b/lapis2/src/test/kotlin/org/genspectrum/lapis/request/NucleotideInsertionTest.kt index bff329746..4ce54c9a3 100644 --- a/lapis2/src/test/kotlin/org/genspectrum/lapis/request/NucleotideInsertionTest.kt +++ b/lapis2/src/test/kotlin/org/genspectrum/lapis/request/NucleotideInsertionTest.kt @@ -96,6 +96,10 @@ class NucleotideInsertionTest { "\"ins_oTher_segmenT:123:ABCD\"", NucleotideInsertion(123, "ABCD", "other_segment"), ), + Arguments.of( + "\"INs_123:AcCD\"", + NucleotideInsertion(123, "ACCD", null), + ), ) @JvmStatic