Skip to content

Commit

Permalink
support for more ALT types (e.g DUP:TANDEM, DEL:ME, etc)
Browse files Browse the repository at this point in the history
closes #26
  • Loading branch information
brentp committed Sep 10, 2019
1 parent 4cb4687 commit c3cfc67
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.1.5
======
+ support for more ALT types (e.g DUP:TANDEM, DEL:ME, etc)

v0.1.4
======
+ output DHSP for BND elements on same chrom
Expand Down
33 changes: 18 additions & 15 deletions src/duphold.nim
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,24 @@ proc duphold*[T](variant:Variant, values:var seq[T], sample_i: int, stats:var Me
var
s = variant.start
e = variant.stop
isBnd = false

var bnd = get_bnd_mate_pos(variant)
var isBnd = false
if bnd != -1:
if bnd < s and s - bnd < 20000000:
e = s
s = bnd
elif bnd > e and bnd - e < 20000000:
s = e
e = bnd - 1
isBnd = true

if bnd == -1:
# skip distant BND's as this is not informative
if ':' in variant.ALT[0]: return -1

if variant.ALT[0][0] != '<':
var bnd = get_bnd_mate_pos(variant)
var isBnd = false
if bnd != -1:
if bnd < s and s - bnd < 20000000:
e = s
s = bnd
elif bnd > e and bnd - e < 20000000:
s = e
e = bnd - 1
isBnd = true

if bnd == -1:
# skip distant BND's as this is not informative
if ':' in variant.ALT[0]: return -1

if e - s < 10:
s = max(0, s - 50)
Expand Down Expand Up @@ -276,7 +279,7 @@ proc duphold*[T](variant:Variant, values:var seq[T], sample_i: int, stats:var Me

if discordants.len == 0: return

if isBnd or variant.ALT[0] == "<DEL>" or (variant.ALT[0] != "<" and len(variant.REF) > len(variant.ALT[0])):
if isBnd or variant.ALT[0].startswith("<DEL") or (variant.ALT[0] != "<" and len(variant.REF) > len(variant.ALT[0])):
var ints = newSeq[int32](variant.vcf.n_samples)
get_or_empty(variant, "DHSP", ints)
ints[sample_i] = discordants.count(s, e, i99).int32
Expand Down

0 comments on commit c3cfc67

Please sign in to comment.