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 11, 2019
1 parent 4cb4687 commit 76f77af
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v0.1.5
======
+ support for more ALT types (e.g DUP:TANDEM, DEL:ME, etc)
+ flush stdout properly (#25)

v0.1.4
======
+ output DHSP for BND elements on same chrom
Expand Down
2 changes: 1 addition & 1 deletion duphold.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ license = "MIT"

# Dependencies

requires "hts >= 0.2.7", "genoiser >= 0.2.2", "docopt >= 0.6.8"
requires "hts >= 0.2.21", "genoiser >= 0.2.2", "docopt >= 0.6.8"
srcDir = "src"
installExt = @["nim"]

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
2 changes: 1 addition & 1 deletion src/dupholdpkg/version.nim
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const dupholdVersion* = "0.1.4"
const dupholdVersion* = "0.1.5"

0 comments on commit 76f77af

Please sign in to comment.