Skip to content

Commit 7645dae

Browse files
authored
Merge pull request #122 from chrovis/fix/add-stop-codon-substitution-branch
Add stop codon substitution conditional branch to protein-variant
2 parents 83d0846 + 99707f5 commit 7645dae

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/varity/vcf_to_hgvs/protein.clj

+10-4
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@
503503
:else :frame-shift)
504504
(or (and (zero? nprefo) (zero? npalto))
505505
(and (= nprefo 1) (= npalto 1))) :substitution
506+
(and ref-include-ter-site (pos? (count pref)) (= (first palt) \*)) :ter-substitution
506507
(and prefer-deletion? (pos? nprefo) (zero? npalto)) :deletion
507508
(and prefer-insertion? (zero? nprefo) (pos? npalto)) (if first-diff-aa-is-ter-site
508509
:extension
@@ -519,17 +520,22 @@
519520
:extension
520521
:insertion)
521522
:else (throw (ex-info "Unsupported variant" {:type ::unsupported-variant})))]
522-
{:type (if (= t :fs-ter-substitution) :substitution t)
523+
{:type (if (#{:fs-ter-substitution :ter-substitution} t) :substitution t)
523524
:pos base-ppos
524-
:ref (if (= t :fs-ter-substitution)
525+
:ref (cond
526+
(= t :fs-ter-substitution)
525527
(let [pref-len (count pref)
526528
palt-len (count palt)
527529
palt-ter-len (inc palt-len)]
528530
(if (<= pref-len palt-ter-len)
529531
(str pref (subs ref-prot-rest 0 (inc (- palt-len pref-len))))
530532
(subs pref 0 palt-ter-len)))
531-
pref)
532-
:alt (if (= t :fs-ter-substitution)
533+
534+
(= t :ter-substitution)
535+
(first (string/split pref #"\*"))
536+
537+
:else pref)
538+
:alt (if (#{:fs-ter-substitution :ter-substitution} t)
533539
(str palt \*)
534540
palt)})))
535541

test/varity/vcf_to_hgvs_test.clj

+1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@
221221
"chr2" 47478341 "TG" "T" '("p.L762*" "p.L696*") ;; rs786204050 (+) frameshift with termination
222222
"chr17" 7676202 "T" "TGTCCCTTAGTCTT" '("p.P58*" "p.P19*") ; cf. not actual example (-, frameshift with termination)
223223
"chr13" 24421115 "TGACTTAGCC" "T" '("p.G1724K") ; not actual example (-, del includes termination codon)
224+
"chrX" 15823233 "ATCCAAATAAAC" "A" '("p.S481*") ; not actual example (+, del includes termination codon)
224225

225226
;; deletion
226227
"chr1" 240092288 "AGTC" "A" '("p.S61del") ; cf. rs772088733 (+)

0 commit comments

Comments
 (0)