Skip to content

Commit

Permalink
fix: add extension conditional branch to insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
nokara26 committed Feb 6, 2025
1 parent 4847fa7 commit 30755de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/varity/vcf_to_hgvs/protein.clj
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,18 @@
(or (and (zero? nprefo) (zero? npalto))
(and (= nprefo 1) (= npalto 1))) :substitution
(and prefer-deletion? (pos? nprefo) (zero? npalto)) :deletion
(and prefer-insertion? (zero? nprefo) (pos? npalto)) :insertion
(and prefer-insertion? (zero? nprefo) (pos? npalto)) (if first-diff-aa-is-ter-site
:extension
:insertion)
(and (some? unit) (= ref-repeat 1) (= alt-repeat 2)) :duplication
(and (some? unit) (pos? alt-repeat)) :repeated-seqs
(and (pos? nprefo) (zero? npalto)) :deletion
(and (pos? nprefo) (pos? npalto)) (if (= base-ppos 1)
:extension
:indel)
(and (zero? nprefo) (pos? npalto)) :insertion
(and (zero? nprefo) (pos? npalto)) (if first-diff-aa-is-ter-site
:extension
:insertion)
:else (throw (ex-info "Unsupported variant" {:type ::unsupported-variant})))]
{:type (if (= t :fs-ter-substitution) :substitution t)
:pos base-ppos
Expand Down
5 changes: 3 additions & 2 deletions test/varity/vcf_to_hgvs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@
"chr1" 47438996 "T" "TCCGCAC" {:prefer-insertion? false} '("p.P286_H287[5]")
"chr1" 47438996 "T" "TCCGCAC" {:prefer-insertion? true} '("p.H293_A294insPH")

;; prefer-insertion?, not actual example (+)
"chr1" 26773690 "C" "CGCAGCA" {:prefer-insertion? true} '("p.Q1334_R1335insQQ")
;; prefer-insertion?
"chr1" 26773690 "C" "CGCAGCA" {:prefer-insertion? true} '("p.Q1334_R1335insQQ") ;; not actual example (+)
"chr10" 103089678 "T" "TTCC" {:prefer-insertion? true} '("p.*562Eext*1") ;; not actual example (-)

;; prefer-extension-for-initial-codon-alt?
"chr10" 121593814 "CCATGGT" "C" {:prefer-extension-for-initial-codon-alt? true} '("p.M1Vext-17") ;; not actual example (-)
Expand Down

0 comments on commit 30755de

Please sign in to comment.