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 the position of first amino acid changed by the frame shift #66

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

nokara26
Copy link
Contributor

@nokara26 nokara26 commented Oct 26, 2022

I have fixed the position of first amino acid changed by the frame shift.

(require '[varity.vcf-to-hgvs :as v2h])

(v2h/vcf-variant->hgvs
 {:chr "chr17", :pos 31261816, :ref "CC", :alt "C"}
 "path/to/hg38.fa" "path/to/refGene.txt.gz" {:prefer-deletion? true})
  • before fix
;;=> ({:coding-dna #clj-hgvs/hgvs "NM_000267:c.4621delC",
;;     :protein #clj-hgvs/hgvs "p.L1541=fs*12"}
;;    {:coding-dna #clj-hgvs/hgvs "NM_001042492:c.4684delC",
;;     :protein #clj-hgvs/hgvs "p.L1562=fs*12"})
  • after fix
;;=> ({:coding-dna #clj-hgvs/hgvs "NM_000267:c.4621delC",
;;     :protein #clj-hgvs/hgvs "p.N1542Tfs*11"}
;;    {:coding-dna #clj-hgvs/hgvs "NM_001042492:c.4684delC",
;;     :protein #clj-hgvs/hgvs "p.N1563Tfs*11"})

@nokara26 nokara26 self-assigned this Oct 26, 2022
@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #66 (48a7fde) into master (ed13cba) will increase coverage by 0.04%.
The diff coverage is 0.00%.

@@            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              
Impacted Files Coverage Δ
src/varity/vcf_to_hgvs/protein.clj 27.82% <0.00%> (+0.16%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment on lines 293 to 301
[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)))))
Copy link
Member

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)

Copy link
Contributor Author

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.

@nokara26 nokara26 force-pushed the feature/fix-protein-fs-change-position branch from 9ad6bd3 to 6a4e220 Compare October 28, 2022 03:09
@nokara26 nokara26 force-pushed the feature/fix-protein-fs-change-position branch from 6a4e220 to 48a7fde Compare October 28, 2022 03:17
@nokara26 nokara26 requested a review from totakke October 28, 2022 03:21
Copy link
Member

@totakke totakke left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@federkasten federkasten left a comment

Choose a reason for hiding this comment

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

🙆‍♂️

@federkasten federkasten merged commit e401a36 into master Oct 31, 2022
@federkasten federkasten deleted the feature/fix-protein-fs-change-position branch October 31, 2022 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants