diff --git a/src/varity/vcf_to_hgvs/protein.clj b/src/varity/vcf_to_hgvs/protein.clj index 78e2c8a..59b8d4e 100644 --- a/src/varity/vcf_to_hgvs/protein.clj +++ b/src/varity/vcf_to_hgvs/protein.clj @@ -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 diff --git a/test/varity/vcf_to_hgvs_test.clj b/test/varity/vcf_to_hgvs_test.clj index f9c0ef9..08291fe 100644 --- a/test/varity/vcf_to_hgvs_test.clj +++ b/test/varity/vcf_to_hgvs_test.clj @@ -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 (-)