diff --git a/R/adjustLogRatio.R b/R/adjustLogRatio.R index c07c038..2fe0770 100644 --- a/R/adjustLogRatio.R +++ b/R/adjustLogRatio.R @@ -30,7 +30,7 @@ #' log.ratio.adjusted <- adjustLogRatio(log.ratio, 0.65, 1.73) #' #' @export adjustLogRatio -adjustLogRatio <- function(ratio, purity, ploidy, is.log2 = TRUE, min.ratio = 0.004) { +adjustLogRatio <- function(ratio, purity, ploidy, is.log2 = TRUE, min.ratio = 2^-8) { if (is.log2) ratio <- 2^ratio adjusted <- (purity * ploidy * ratio + 2 * (1 - purity) * ratio - 2 * (1 - purity)) / (purity * ploidy) adjusted <- pmax(min.ratio, adjusted) diff --git a/man/adjustLogRatio.Rd b/man/adjustLogRatio.Rd index 0fb25ab..fe70bc2 100644 --- a/man/adjustLogRatio.Rd +++ b/man/adjustLogRatio.Rd @@ -4,7 +4,7 @@ \alias{adjustLogRatio} \title{Adjust tumor vs. normal coverage log ratio for tumor purity and ploidy} \usage{ -adjustLogRatio(ratio, purity, ploidy, is.log2 = TRUE, min.ratio = 0.004) +adjustLogRatio(ratio, purity, ploidy, is.log2 = TRUE, min.ratio = 2^-8) } \arguments{ \item{ratio}{Vector of log2 tumor vs normal coverage ratios.} diff --git a/tests/testthat/test_adjustLogRatio.R b/tests/testthat/test_adjustLogRatio.R index 8c76a0c..830a257 100644 --- a/tests/testthat/test_adjustLogRatio.R +++ b/tests/testthat/test_adjustLogRatio.R @@ -10,7 +10,7 @@ test_that("Function returns expected values for example coverage", { p <- 1 log.ratio.offset <- 0 opt.C <- (2^(log.ratio.adjusted + log.ratio.offset) * total.ploidy)/p - ((2 * (1 - p))/p) - expect_lt(abs(min(log.ratio.adjusted, na.rm=TRUE) - log2(0.004)), 0.001) + expect_lt(abs(min(log.ratio.adjusted, na.rm=TRUE) + 8), 0.001) expect_lt(median(abs(opt.C - purecn.example.output$results[[1]]$seg$C)), 0.1) })