Skip to content

Commit

Permalink
fix: add unknown repeat repairer
Browse files Browse the repository at this point in the history
  • Loading branch information
nokara26 committed Oct 15, 2024
1 parent e11455b commit 4307618
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/clj_hgvs/repairer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@
(string/replace s #"del\d+ins" "delins")
s))

;; g.1134_1135ins(100) -> g.1134_1135insN[100]
;; r.431_432ins(5) -> r.431_432insn[5]
;; p.R78_G79ins23 -> p.R78_G79insX[23]
(defn ^:no-doc replace-unknown-repeated-seq
[s kind]
(case kind
(:genome :mitochondria :coding-dna :non-coding-dna :circular-dna)
(string/replace s #"ins\((\d+)\)$" "insN[$1]")
(:rna)
(string/replace s #"ins\((\d+)\)$" "insn[$1]")
(:protein)
(string/replace s #"ins(\d+)$" "insX[$1]")
s))

;; c.112GAT(14) -> c.112GAT[14]
(defn ^:no-doc replace-repeated-seqs-parens1
[s kind]
Expand Down Expand Up @@ -318,6 +332,7 @@
remove-alternative
remove-inv-bases
remove-del-count-from-delins
replace-unknown-repeated-seq
replace-repeated-seqs-parens1
replace-repeated-seqs-parens2
remove-genomic-bases-from-protein
Expand Down
5 changes: 5 additions & 0 deletions test/clj_hgvs/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@
;; remove-del-count-from-delins
"c.123_124del2insCTGA" "c.123_124delinsCTGA"

;; replace-unknown-repeated-seq
"g.1134_1135ins(100)" "g.1134_1135insN[100]"
"r.431_432ins(5)" "r.431_432insn[5]"
"p.R78_G79ins23" "p.R78_G79insX[23]"

;; replace-repeated-seqs-parens1
"c.112GAT(14)" "c.112GAT[14]"

Expand Down

0 comments on commit 4307618

Please sign in to comment.