Skip to content

Commit

Permalink
closes #56
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Jun 30, 2020
1 parent 325e14d commit 89fcb12
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
v0.2.11 (dev)
=============
+ more informative error message on bad sample name (#53)
+ allow setting SOMALIER_AB_HOM_CUTOFF to change which calls are considered hom-ref (#56)

v0.2.10
=======
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ all cases.

By default `somalier` will only consider variants that have a "PASS" or "RefCall" FILTER. To extend this list, set
the environment variable `SOMALIER_ALLOWED_FILTERS` to a comma-delimited list of additional filters to allow.

by default sites with an allele balance < 0.01 will be considered homozygous reference. To adjust this, use e.g. :
`SOMALIER_AB_HOM_CUTOFF=0.04 somalier relate ...`

## Other Work

Expand Down
11 changes: 10 additions & 1 deletion src/somalierpkg/relate.nim
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,16 @@ proc ab*(c:allele_count, min_depth:int): float {.inline.} =
return 0
result = c.nalt.float / (c.nalt + c.nref).float

proc alts*(ab:float, min_ab:float, ab_cutoff:float=0.01): int8 {.inline.} =
var ab_cutoff: float = 0.01
try:
ab_cutoff = parseFloat(getEnv("SOMALIER_AB_HOM_CUTOFF"))
if ab_cutoff > 0.5:
stderr.writeline("[somalier] error setting SOMALIER_AB_HOM_CUTOFF to:" & getEnv("SOMALIER_AB_HOM_CUTOFF"))
ab_cutoff = 0.01
except:
discard

proc alts*(ab:float, min_ab:float, ab_cutoff:float=ab_cutoff): int8 {.inline.} =
if ab < 0: return -1
if ab < ab_cutoff: return 0
if ab > (1 - ab_cutoff): return 2
Expand Down

0 comments on commit 89fcb12

Please sign in to comment.