-
Notifications
You must be signed in to change notification settings - Fork 2
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 the position of first amino acid changed by the frame shift #66
Conversation
Codecov Report
@@ Coverage Diff @@
## master #66 +/- ##
==========================================
+ Coverage 45.63% 45.67% +0.04%
==========================================
Files 16 16
Lines 1992 1990 -2
Branches 63 63
==========================================
Hits 909 909
+ Misses 1020 1018 -2
Partials 63 63
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
src/varity/vcf_to_hgvs/protein.clj
Outdated
[ref alt offset*] (let [original-position (dec (+ ppos offset))] | ||
(loop [ref* (nth (:ref-prot-seq seq-info) original-position) | ||
alt* (nth alt-prot-seq original-position) | ||
ex-offset 0] | ||
(if (not= ref* alt*) | ||
[ref* alt* (+ offset ex-offset)] | ||
(recur (nth (:ref-prot-seq seq-info) (+ original-position (inc ex-offset))) | ||
(nth alt-prot-seq (+ original-position (inc ex-offset))) | ||
(inc ex-offset))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing a bug that I missed consideration about trailing alt proteins accidentally corresponded to ref proteins.
Your changed code works correctly, but there is a simpler way; all you have to do is removing (= pref palt)
condition on L282. The following code passes the test you added.
(let [[ppos pref palt] (->> (map vector (:ref-prot-seq seq-info) (:alt-prot-seq seq-info))
(drop (dec ppos))
(map-indexed vector)
(drop-while (fn [[_ [r a]]] (= r a)))
first
((fn [[i [r a]]]
[(+ ppos i) (str r) (str a)])))
[_ _ offset _] (diff-bases pref palt)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your review and comment 🙏🏻
I also think your code is clean and concise. I will fix.
9ad6bd3
to
6a4e220
Compare
6a4e220
to
48a7fde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙆♂️
I have fixed the position of first amino acid changed by the frame shift.