Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix protein-insertion regex #13

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/clj_hgvs/mutation.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,7 @@
;;;
;;; e.g. Lys23_Leu24insArgSerGln
;;; Arg78_Gly79insX[23]
;;; Thr89_Ter90insSerProIle (T89_*90insSPI)

(defrecord ProteinInsertion [ref-start coord-start ref-end coord-end alts]
Mutation
Expand Down Expand Up @@ -1819,7 +1820,7 @@
vec)))

(def ^:private protein-insertion-re
#"([A-Z](?:[a-z]{2})?)(\d+)_([A-Z](?:[a-z]{2})?)(\d+)ins([\da-zA-Z*\[\]]+)")
#"([A-Z](?:[a-z]{2})?)(\d+)_([A-Z*](?:[a-z]{2})?)(\d+)ins([\da-zA-Z*\[\]]+)")

(defn parse-protein-insertion
[s]
Expand Down
13 changes: 11 additions & 2 deletions test/clj_hgvs/mutation_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,11 @@
(def protein-insertion4 (mut/protein-insertion "Arg" (coord/protein-coordinate 78)
"Gly" (coord/protein-coordinate 79)
["Xaa" "Xaa" "Xaa" "Xaa" "Xaa" "Xaa" "Xaa" "Xaa" "Xaa" "Xaa"]))
(def protein-insertion5s "Thr89_Ter90insSerProIle")
(def protein-insertion5ss "T89_*90insSPI")
(def protein-insertion5 (mut/protein-insertion "Thr" (coord/protein-coordinate 89)
"Ter" (coord/protein-coordinate 90)
["Ser" "Pro" "Ile"]))

(deftest format-protein-insertion-test
(testing "returns a string expression of a protein insertion"
Expand All @@ -1386,7 +1391,9 @@
protein-insertion3 {:ins-format :count} protein-insertion3sc
protein-insertion3 {:amino-acid-format :short :ins-format :count} protein-insertion3scs
protein-insertion4 {:ins-format :auto} protein-insertion4sc
protein-insertion4 {:amino-acid-format :short :ins-format :auto} protein-insertion4scs)))
protein-insertion4 {:amino-acid-format :short :ins-format :auto} protein-insertion4scs
protein-insertion5 nil protein-insertion5s
protein-insertion5 {:amino-acid-format :short} protein-insertion5ss)))

(deftest parse-protein-insertion-test
(testing "returns a correct ProteinInsertion"
Expand All @@ -1400,7 +1407,9 @@
protein-insertion3sc protein-insertion3
protein-insertion3scs protein-insertion3
protein-insertion4sc protein-insertion4
protein-insertion4scs protein-insertion4))
protein-insertion4scs protein-insertion4
protein-insertion5s protein-insertion5
protein-insertion5ss protein-insertion5))
(testing "invalid protein insertion"
(are [s] (thrown? #?(:clj Throwable, :cljs js/Error)
(mut/parse-protein-insertion s))
Expand Down