Skip to content

Commit

Permalink
update mosdepth to use --fast-mode from latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Nov 19, 2018
1 parent 5e8a1b9 commit 6fda101
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ v0.2.2
to use as-is.
+ cnvnator changes and filtering. (still requires github.com/brentp/CNVnator fork).
+ bugfix for case when no output directory was specified.
+ use mosdepth with --fast-mode **NOTE** this requires the latest version of mosdepth (0.2.4 or greater)

v0.2.1
======
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ cd svtools && python setup.py install
cd $basedir
rm -rf svtools

wget -qO /usr/local/bin/mosdepth https://github.com/brentp/mosdepth/releases/download/v0.2.3/mosdepth
wget -qO /usr/local/bin/mosdepth https://github.com/brentp/mosdepth/releases/download/v0.2.4/mosdepth
chmod +x /usr/local/bin/mosdepth

wget -qO /usr/local/bin/duphold https://github.com/brentp/duphold/releases/download/v0.0.9/duphold
wget -qO /usr/local/bin/duphold https://github.com/brentp/duphold/releases/download/v0.1.0/duphold
chmod +x /usr/local/bin/duphold

wget -qO /usr/bin/gsort https://github.com/brentp/gsort/releases/download/v0.0.6/gsort_linux_amd64
Expand Down
18 changes: 9 additions & 9 deletions lumpy/depthfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export MOSDEPTH_Q0=OK
export MOSDEPTH Q1=HIGH
set -euo pipefail
samtools index {{bam}}
mosdepth -f {{fasta}} -n --quantize {{md1}}: {{prefix}} {{bam}}
mosdepth -f {{fasta}} --fast-mode -n --quantize {{md1}}: {{prefix}} {{bam}}
rm -f {{prefix}}.mosdepth*.dist.txt
rm {{prefix}}.quantized.bed.gz.csi
`
Expand Down Expand Up @@ -376,28 +376,28 @@ type inter struct {
read2_tid uint32
read1_pos uint32
read2_pos uint32
qname string
retain bool
qname string
retain bool
}

// Size around an interchromosomal to look for support during filtering
const inter_window_size = 10000
const empty_tid = math.MaxUint32

func localRightOutOfWindow(i, k inter) bool {
return (k.read1_tid > i.read1_tid || (k.read1_tid == i.read1_tid && k.read1_pos > i.read1_pos + inter_window_size))
return (k.read1_tid > i.read1_tid || (k.read1_tid == i.read1_tid && k.read1_pos > i.read1_pos+inter_window_size))
}

func localLeftOutOfWindow(i, k inter) bool {
return (k.read1_tid < i.read1_tid || (k.read1_tid == i.read1_tid && k.read1_pos < i.read1_pos - inter_window_size))
return (k.read1_tid < i.read1_tid || (k.read1_tid == i.read1_tid && k.read1_pos < i.read1_pos-inter_window_size))
}

func distantRightOutOfWindow(i, k inter) bool {
return (k.read2_tid > i.read2_tid || (k.read2_tid == i.read2_tid && k.read2_pos > i.read2_pos + inter_window_size))
return (k.read2_tid > i.read2_tid || (k.read2_tid == i.read2_tid && k.read2_pos > i.read2_pos+inter_window_size))
}

func distantLeftOutOfWindow(i, k inter) bool {
return (k.read2_tid < i.read2_tid || (k.read2_tid == i.read2_tid && k.read2_pos < i.read2_pos - inter_window_size))
return (k.read2_tid < i.read2_tid || (k.read2_tid == i.read2_tid && k.read2_pos < i.read2_pos-inter_window_size))
}

func interSlicePtrs(s []inter, d []*inter) []*inter {
Expand All @@ -412,7 +412,7 @@ func interchromfilter(counts map[string]int, inters []inter) {
for f := 0; f < len(inters); {
g := sort.Search(len(inters), func(z int) bool { return localRightOutOfWindow(inters[f], inters[z]) })
// now we know that everything between first and g is in-window relative to first
if f + 1 != g {
if f+1 != g {
// Need to check and see if in-window on distal site
// populate buf with pointers to elements so we don't mess up the initial array
buf = buf[:0]
Expand All @@ -428,7 +428,7 @@ func interchromfilter(counts map[string]int, inters []inter) {
})
for j := 0; j < len(buf); {
c := sort.Search(len(buf), func(z int) bool { return distantRightOutOfWindow(*buf[j], *buf[z]) })
if j + 1 != c {
if j+1 != c {
for i := j; i < c; i++ {
buf[i].retain = true
}
Expand Down

0 comments on commit 6fda101

Please sign in to comment.