Skip to content

Commit 7e930f8

Browse files
committed
fixed bug in winsorized mafR calculation
1 parent 14b0a65 commit 7e930f8

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

R/facets-clustersegs.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ clustersegs <- function(out, jointseg, min.nhet=10) {
3333
# function to estimate maf from clustered data
3434
maffun <- function(x) {
3535
# occasional extreme valor can screw maf. so winsorize the maf
36-
valor <- x$valor
36+
valor <- abs(x$valor)
3737
lorvar <- x$lorvar
38+
# extreme large values
3839
valor.thresh <- median(valor) + 3*sqrt(quantile(lorvar, 0.8, type=1))
3940
valor[valor > valor.thresh] <- valor.thresh
41+
# extreme small values (not likely)
42+
valor.thresh <- median(valor) - 3*sqrt(quantile(lorvar, 0.8, type=1))
43+
valor[valor < valor.thresh] <- valor.thresh
4044
sum(((valor)^2 - lorvar)/lorvar)/sum(1/lorvar)
4145
}
4246
# loop through ocn clusters

R/facets-segsummary.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ jointsegsummary <- function(jointseg) {
3333
# function to estimate maf from valor and lorvar
3434
maffun <- function(x) {
3535
# occasional extreme valor can screw maf. so winsorize the maf
36-
valor <- x$valor
36+
valor <- abs(x$valor)
3737
lorvar <- x$lorvar
38+
# extreme large values
3839
valor.thresh <- median(valor) + 3*sqrt(quantile(lorvar, 0.8, type=1))
3940
valor[valor > valor.thresh] <- valor.thresh
41+
# extreme small values (not likely)
42+
valor.thresh <- median(valor) - 3*sqrt(quantile(lorvar, 0.8, type=1))
43+
valor[valor < valor.thresh] <- valor.thresh
4044
sum(((valor)^2 - lorvar)/lorvar)/sum(1/lorvar)
4145
}
4246
# loop over the segments

inst/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
11/17/2015: v0.3.9
2+
3+
o Bug in winsorized mafR code (median(abs(valor)) instead median(valor))
4+
15
09/09/2015: v0.3.8
26

37
o Modified balanced seg selection restrict to mafR < 0.1

0 commit comments

Comments
 (0)