Skip to content

Commit

Permalink
Changed default of min.ratio to cleaner -8.
Browse files Browse the repository at this point in the history
  • Loading branch information
lima1 committed Apr 1, 2024
1 parent daf175b commit 5ec2226
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/adjustLogRatio.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion man/adjustLogRatio.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test_adjustLogRatio.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

0 comments on commit 5ec2226

Please sign in to comment.