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

Add prefer-deletion-insertion option to coding-dna #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions src/varity/hgvs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
{:prefer-deletion? true}
{:prefer-insertion? false}
{:prefer-insertion? true}
{:prefer-deletion-insertion? false}
{:prefer-deletion-insertion? true}
{:prefer-extension-for-initial-codon-alt? false}
{:prefer-extension-for-initial-codon-alt? true}])

Expand Down
15 changes: 13 additions & 2 deletions src/varity/vcf_to_hgvs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
(def ^:private default-options
{:prefer-deletion? false
:prefer-insertion? false
:prefer-deletion-insertion? false
:prefer-extension-for-initial-codon-alt? false
:tx-margin 5000
:verbose? false})
Expand All @@ -91,6 +92,10 @@
:prefer-insertion? Prefer insertion (e.g. \"c.9_10insAGG\") to repeated
sequences (e.g. \"c.4_6[3]\"), default false.

:prefer-deletion-insertion? Prefer indel (e.g. \"c.18_20delATCinsGAT\")
to repeated sequences and inversion (e.g. \"c.18_20inv\"),
default false.

:tx-margin The length of transcription margin, up to a maximum of
10000, default 5000.

Expand Down Expand Up @@ -158,8 +163,10 @@
:prefer-deletion? Prefer deletion (e.g. \"p.P7_H8del\") to repeated
sequences (e.g. \"p.P5_H6[1]\"), default false.

:prefer-insertion? Prefer insertion (e.g. \"c.H9_L10insRPH\") to repeated
sequences (e.g. \"c.R4_H6[3]\"), default false.
:prefer-insertion? Prefer insertion (e.g. \"p.H9_L10insRPH\") to repeated
sequences (e.g. \"p.R4_H6[3]\"), default false.

:prefer-deletion-insertion? Prefer indel to repeated sequences, default false.

:prefer-extension-for-initial-codon-alt? Prefer extension to protein unknown variant
that affects initial codon, default false.
Expand Down Expand Up @@ -234,6 +241,10 @@
:prefer-insertion? Prefer insertion (e.g. \"c.9_10insAGG\") to repeated
sequences (e.g. \"c.4_6[3]\"), default false.

:prefer-deletion-insertion? Prefer indel (e.g. \"c.18_20delATCinsGAT\")
to repeated sequences and inversion (e.g. \"c.18_20inv\"),
default false.

:prefer-extension-for-initial-codon-alt? Prefer extension to protein unknown variant
that affects initial codon, default false.

Expand Down
3 changes: 2 additions & 1 deletion src/varity/vcf_to_hgvs/coding_dna.clj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
:reverse (repeat-info-backward seq-rdr rg pos alt type))))

(defn- mutation-type
[seq-rdr rg pos ref alt {:keys [prefer-deletion? prefer-insertion?]}]
[seq-rdr rg pos ref alt {:keys [prefer-deletion? prefer-insertion? prefer-deletion-insertion?]}]
(if (re-matches #"[acgntACGNT]*" alt)
(let [[ref-only alt-only offset _] (diff-bases ref alt)
nrefo (count ref-only)
Expand All @@ -79,6 +79,7 @@
(or (= nrefo nalto 0) (= nrefo nalto 1)) :substitution
(and prefer-deletion? (pos? nrefo) (zero? nalto)) :deletion
(and prefer-insertion? (zero? nrefo) (pos? nalto)) :insertion
(and prefer-deletion-insertion? (pos? nrefo) (pos? nalto)) :indel
(= ref-only (util-seq/revcomp alt-only)) :inversion
(and (some? unit) (= ref-repeat 1) (= alt-repeat 2)) :duplication
(and (some? unit) (pos? alt-repeat)
Expand Down
7 changes: 5 additions & 2 deletions src/varity/vcf_to_hgvs/protein.clj
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@
[{:keys [strand] :as rg} pos ref alt
{:keys [ref-exon-seq ref-prot-seq alt-exon-seq alt-rg ref-include-ter-site
ref-include-from-ter-start-and-over-ter-end utr-variant] :as seq-info}
{:keys [prefer-deletion? prefer-insertion? prefer-extension-for-initial-codon-alt?]}]
{:keys [prefer-deletion? prefer-insertion? prefer-deletion-insertion?
prefer-extension-for-initial-codon-alt?]}]
(cond
(:overlap-exon-intron-boundary seq-info)
{:type :overlap-exon-intron-boundary, :pos nil, :ref nil, :alt nil}
Expand Down Expand Up @@ -466,7 +467,9 @@
(and prefer-deletion? (pos? nprefo) (zero? npalto)) :deletion
(and prefer-insertion? (zero? nprefo) (pos? npalto)) :insertion
(and (some? unit) (= ref-repeat 1) (= alt-repeat 2)) :duplication
(and (some? unit) (pos? alt-repeat)) :repeated-seqs
(and (some? unit) (pos? alt-repeat)) (if (and prefer-deletion-insertion? (pos? npref) (pos? npalto))
:indel
:repeated-seqs)
(and (pos? nprefo) (zero? npalto)) :deletion
(and (pos? nprefo) (pos? npalto)) (if (= base-ppos 1)
:extension
Expand Down
9 changes: 9 additions & 0 deletions test/varity/vcf_to_hgvs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@
"chr3" 126492636 "C" "CCTCT" {:prefer-insertion? true} '("NM_001165974:c.1690-121_1690-120insAGAG"
"NM_144639:c.1510-121_1510-120insAGAG")

;; prefer-deletion-inserion?
;; inversion cf. rs267608133 (+)
"chr2" 47806747 "AAAACTTTTTTTTTTTTTTTTTTAA" "ATTAAAAAAAAAAAAAAAAAAGTTT" {:prefer-deletion-insertion? true} '("NM_000179:c.4002-31_4002-8delAAACTTTTTTTTTTTTTTTTTTAAinsTTAAAAAAAAAAAAAAAAAAGTTT"
"NM_001281492:c.3612-31_3612-8delAAACTTTTTTTTTTTTTTTTTTAAinsTTAAAAAAAAAAAAAAAAAAGTTT"
"NM_001281493:c.3096-31_3096-8delAAACTTTTTTTTTTTTTTTTTTAAinsTTAAAAAAAAAAAAAAAAAAGTTT"
"NM_001281494:c.3096-31_3096-8delAAACTTTTTTTTTTTTTTTTTTAAinsTTAAAAAAAAAAAAAAAAAAGTTT"
"NM_025133:c.*1347_*1370delTTAAAAAAAAAAAAAAAAAAGTTTinsAAACTTTTTTTTTTTTTTTTTTAA"
"NM_001190274:c.*1347_*1370delTTAAAAAAAAAAAAAAAAAAGTTTinsAAACTTTTTTTTTTTTTTTTTTAA")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

default(prefer-deletion-insertion? false)

;; inversion
"chr2" 47806747 "AAAACTTTTTTTTTTTTTTTTTTAA" "ATTAAAAAAAAAAAAAAAAAAGTTT"
'("NM_000179:c.4002-31_4002-8inv"
"NM_001281492:c.3612-31_3612-8inv"
"NM_001281493:c.3096-31_3096-8inv"
"NM_001281494:c.3096-31_3096-8inv"
"NM_025133:c.*1347_*1370inv"
"NM_001190274:c.*1347_*1370inv") ; cf. rs267608133 (+)

;; tx-margin
"chr5" 1295113 "G" "A" {:tx-margin 5000} '("NM_001193376:c.-124C>T"
"NM_198253:c.-124C>T")
Expand Down