Commit 7e227e8 1 parent 0587070 commit 7e227e8 Copy full SHA for 7e227e8
File tree 2 files changed +28
-14
lines changed
2 files changed +28
-14
lines changed Original file line number Diff line number Diff line change 14
14
[varity.ref-gene :as rg]
15
15
[varity.vcf-to-hgvs.common :refer [diff-bases] :as common]))
16
16
17
- (defn- overlap-exon-intron-boundary?
17
+ (defn- overlap-exon-intron-boundary?*
18
18
[exon-ranges pos ref alt]
19
19
(let [nref (count ref)
20
- nalt (count alt)]
21
- (and (not (= 1 nref nalt))
22
- (not= 1 (count exon-ranges))
23
- (let [[pos nref] (if (= (first ref) (first alt))
24
- [(inc pos) (dec nref)]
25
- [pos nref])]
26
- (some (fn [[s e]]
27
- (and (not= s e)
28
- (or (and (< pos s) (<= s (+ pos nref -1 )))
29
- (and (<= pos e) (< e (+ pos nref -1 ))))))
30
- exon-ranges)))))
20
+ nalt (count alt)
21
+ [_ _ d _] (diff-bases ref alt)
22
+ pos (+ pos d)
23
+ nref (- nref d)]
24
+ (boolean
25
+ (and (not (= 1 nref nalt))
26
+ (not= 1 (count exon-ranges))
27
+ (some (fn [[s e]]
28
+ (and (not= s e)
29
+ (or (and (< pos s) (<= s (+ pos nref -1 )))
30
+ (and (<= pos e) (< e (+ pos nref -1 ))))))
31
+ exon-ranges)))))
32
+
33
+ (def ^:private overlap-exon-intron-boundary? (memoize overlap-exon-intron-boundary?*))
31
34
32
35
(defn alt-exon-ranges
33
36
" Returns exon ranges a variant applied."
Original file line number Diff line number Diff line change 7
7
[varity.t-common :refer [test-ref-seq-file
8
8
defslowtest ]]))
9
9
10
+ (deftest overlap-exon-intron-boundary?-test
11
+ (let [exon-ranges [[123 321 ] [456 654 ] [789 987 ]]]
12
+ (are [p pos ref alt] (p (#'prot/overlap-exon-intron-boundary? exon-ranges pos ref alt))
13
+ false ? 454 " X" " Y"
14
+ true ? 454 " XXX" " X"
15
+ false ? 455 " XX" " X"
16
+ false ? 456 " XX" " X"
17
+ false ? 654 " XX" " X"
18
+ true ? 653 " XXX" " X"
19
+ false ? 653 " XX" " X" )))
20
+
10
21
(deftest alt-exon-ranges-test
11
22
; ; 1 [2 3 4] 5 6 7 [8 9 10 11] 12 13 14 15
12
23
(are [p r a e] (= (#'prot/alt-exon-ranges [[2 4 ] [8 11 ]] p r a) e)
15
26
2 " XX" " X" [[2 3 ] [7 10 ]]
16
27
3 " XX" " X" [[2 3 ] [7 10 ]]
17
28
6 " XX" " X" [[2 4 ] [7 10 ]]
18
- 9 " XXX" " XXX " [[2 4 ] [8 11 ]])
29
+ 9 " XXX" " YYY " [[2 4 ] [8 11 ]])
19
30
; ; Variants overlapping a boundary of exon/intron
20
31
(are [p r a] (nil? (#'prot/alt-exon-ranges [[2 4 ] [8 11 ]] p r a))
21
- 3 " XXX" " XXX "
32
+ 3 " XXX" " YYY "
22
33
6 " XXX" " X"
23
34
3 " XXX" " X"
24
35
1 " XXXXX" " X" ))
You can’t perform that action at this time.
0 commit comments