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 substitution for nonsense variant #113

Merged
merged 1 commit into from
Dec 6, 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
22 changes: 15 additions & 7 deletions src/varity/vcf_to_hgvs/protein.clj
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@
:reverse (protein-position pos alt-rg))
(count alt-prot-seq*))])
[pref-only palt-only offset _] (diff-bases pref palt)
npref (count pref)
nprefo (count pref-only)
npalto (count palt-only)
[unit ref-repeat alt-repeat] (repeat-info* ref-prot-seq
Expand All @@ -436,13 +437,13 @@
:unknown

(or (= ref-prot-rest alt-prot-rest)
(and prefer-extension-for-initial-codon-alt?
(not= (first ref-prot-seq) (first alt-prot-seq*))))
(and prefer-extension-for-initial-codon-alt?
(not= (first ref-prot-seq) (first alt-prot-seq*))))
:extension

:else
:frame-shift)
(and (pos? nprefo) (= (first palt-only) \*)) :substitution
(and (pos? npref) (= (first palt-only) \*)) :substitution
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return false in a case like pref Y and palt *Y.
So I change nprefo to npref.

(not= ref-prot-rest alt-prot-rest) (cond
(or (and (= (first alt-prot-rest) \*)
(>= nprefo npalto)
Expand Down Expand Up @@ -480,12 +481,19 @@
palt)})))

(defn- protein-substitution
[ppos pref palt]
[ppos pref palt {:keys [ref-prot-seq alt-prot-seq]}]
(let [[s-ref s-alt offset _] (diff-bases pref palt)]
(if (and (empty? s-ref) (empty? s-alt))
(cond
(and (empty? s-ref) (empty? s-alt))
(mut/protein-substitution (mut/->long-amino-acid (last pref))
(coord/protein-coordinate ppos)
(mut/->long-amino-acid (last palt)))
(empty? s-ref)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s-ref is empty in a case like pref Y and palt *Y.

(let [{:keys [ppos pref palt]} (get-first-diff-aa-info ppos ref-prot-seq alt-prot-seq)]
(mut/protein-substitution (mut/->long-amino-acid pref)
(coord/protein-coordinate ppos)
(mut/->long-amino-acid palt)))
:else
(mut/protein-substitution (mut/->long-amino-acid (first s-ref))
(coord/protein-coordinate (+ ppos offset))
(mut/->long-amino-acid (first s-alt))))))
Expand Down Expand Up @@ -555,7 +563,7 @@
(subs (dec (+ ppos offset)))
(string/index-of "*"))]
(if (= alt \*)
(protein-substitution (+ ppos offset) (str ref) (str alt)) ; eventually fs-ter-substitution
(protein-substitution (+ ppos offset) (str ref) (str alt) seq-info) ; eventually fs-ter-substitution
(mut/protein-frame-shift (mut/->long-amino-acid ref)
(coord/protein-coordinate (+ ppos offset))
(mut/->long-amino-acid alt)
Expand Down Expand Up @@ -662,7 +670,7 @@
pvariant)
seq-info (merge seq-info options)]
(case (:type pvariant)
:substitution (protein-substitution ppos pref palt)
:substitution (protein-substitution ppos pref palt seq-info)
:deletion (protein-deletion ppos pref palt)
:duplication (protein-duplication ppos pref palt)
:insertion (protein-insertion ppos pref palt seq-info)
Expand Down
1 change: 1 addition & 0 deletions test/varity/vcf_to_hgvs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
"p.A35=") ; cf. rs786201577 (synonymous)
"chr6" 33086236 "TA" "T" '("p.*259=") ; cf. rs67523850 (deletion in border of UTR)
"chr7" 152247986 "G" "GT" '("p.Y816*") ; cf. rs150073007 (-, nonsense mutation)
"chr18" 51048782 "C" "CAGT" '("p.Y117*") ; cf. not actual example (+, inframe nonsense mutation)
"chr17" 31159027 "TGC" "T" '("p.A75*") ; not actual example (+, nonsense in del case)
"chr2" 47478341 "TG" "T" '("p.L762*" "p.L696*") ;; rs786204050 (+) frameshift with termination
"chr17" 7676202 "T" "TGTCCCTTAGTCTT" '("p.P58*" "p.P19*") ; cf. not actual example (-, frameshift with termination)
Expand Down
Loading