diff --git a/.gitignore b/.gitignore index 14c44be..d3670e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +tests/all +tests/funcs nimcache *.d4 *.bam diff --git a/CHANGES.md b/CHANGES.md index 8eeac0a..58b48b1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +v0.3.5 +====== ++ fix bug with summary min for regions (#207 thanks to Xavier for supplying test-case) + v0.3.4 ====== + bump version for build supporting gs:// urls diff --git a/mosdepth.nim b/mosdepth.nim index 4c647f0..b793243 100644 --- a/mosdepth.nim +++ b/mosdepth.nim @@ -577,6 +577,12 @@ proc main(bam: hts.Bam, chrom: region_t, mapq: int, eflag: uint16, iflag: uint16 var fd4:D4 var fbase: BGZI + # use clear to set min depth to uint32.high + chrom_region_stat.clear() + chrom_stat.clear() + global_region_stat.clear() + global_stat.clear() + var region_distribution = new_seq[int64](1000) var global_distribution = new_seq[int64](1000) @@ -775,7 +781,7 @@ when(isMainModule): when not defined(release) and not defined(lto): stderr.write_line "[mosdepth] WARNING: built in debug mode; will be slow" - let version = "mosdepth 0.3.4" + let version = "mosdepth 0.3.5" let env_fasta = getEnv("REF_PATH") var doc = format(""" $version diff --git a/mosdepth.nimble b/mosdepth.nimble index bd3ae23..2e02b32 100644 --- a/mosdepth.nimble +++ b/mosdepth.nimble @@ -1,6 +1,6 @@ # Package -version = "0.3.4" +version = "0.3.5" author = "Brent Pedersen" description = "fast depth" license = "MIT" diff --git a/tests/funcs.nim b/tests/funcs.nim index b875573..d789daf 100644 --- a/tests/funcs.nim +++ b/tests/funcs.nim @@ -1,8 +1,21 @@ import unittest import mosdepth +import depthstat import os suite "mosdepth-suite": + + test "depthstat min": + var d = newSeq[int32]() + var t = newDepthStat(d) + check t.min_depth > 0 + + var dd: depth_stat + # "not that this always starts as 0 so we must set clear to increase it" + check dd.min_depth == 0 + dd.clear() + check dd.min_depth > 0 + test "test-quantize-args": var rs = get_quantize_args(":1")