Skip to content

Commit

Permalink
Merge pull request #359 from lima1/issue_356
Browse files Browse the repository at this point in the history
Attempt in fixing #356.
  • Loading branch information
lima1 authored Mar 28, 2024
2 parents c7fddf0 + bb3203d commit 82fbc2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ BUGFIXES

o Bugfix #296 was not merged into the developer branch and did not make
it into 2.8.0.
o Log ratios not shiften to median of sample medians as intended (#356).
Thanks @sleyn.


Changes in version 2.8.0
Expand Down
12 changes: 6 additions & 6 deletions R/createNormalDatabase.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,17 @@ optimal.off.target.counts = 120, plot = FALSE, ...) {
fcnts_std[, i] <- fcnts_std[,i] / iv
}
} else {
fcnts_std <- apply(fcnts,2,function(x) x/fcnts_interval_medians)
fcnts_std <- apply(fcnts, 2, function(x) x / fcnts_interval_medians)
}
fcnts_interval_non_zero_medians <- apply(fcnts_std, 1, function(x) median(x[x>0]))
fcnts_std_imp <- apply(fcnts_std, 2, function(x) { x[x<=0] <- fcnts_interval_non_zero_medians[x<=0]; x})
p=0.001
li <- quantile(as.vector(fcnts_std_imp), probs= c(p, 1-p))
fcnts_interval_non_zero_medians <- apply(fcnts_std, 1, function(x) median(x[x > 0]))
fcnts_std_imp <- apply(fcnts_std, 2, function(x) { x[x <= 0] <- fcnts_interval_non_zero_medians[x <= 0]; x})
p <- 0.001
li <- quantile(as.vector(fcnts_std_imp), probs = c(p, 1 - p))
fcnts_std_trunc <- fcnts_std_imp
fcnts_std_trunc[fcnts_std_imp < li[1]] <- li[1]
fcnts_std_trunc[fcnts_std_imp > li[2]] <- li[2]
fcnts_std_final <- apply(fcnts_std_trunc, 2, function(x) log2(x / median(x)))
fcnts_std_final - median(apply(fcnts_std_final,2,median))
fcnts_std_final <- fcnts_std_final - median(apply(fcnts_std_final, 2, median))
s <- svd(fcnts_std_final)

ret <- list(
Expand Down

0 comments on commit 82fbc2e

Please sign in to comment.