Attempt in fixing #356.
... | ... |
@@ -204,17 +204,17 @@ optimal.off.target.counts = 120, plot = FALSE, ...) { |
204 | 204 |
fcnts_std[, i] <- fcnts_std[,i] / iv |
205 | 205 |
} |
206 | 206 |
} else { |
207 |
- fcnts_std <- apply(fcnts,2,function(x) x/fcnts_interval_medians) |
|
207 |
+ fcnts_std <- apply(fcnts, 2, function(x) x / fcnts_interval_medians) |
|
208 | 208 |
} |
209 |
- fcnts_interval_non_zero_medians <- apply(fcnts_std, 1, function(x) median(x[x>0])) |
|
210 |
- fcnts_std_imp <- apply(fcnts_std, 2, function(x) { x[x<=0] <- fcnts_interval_non_zero_medians[x<=0]; x}) |
|
211 |
- p=0.001 |
|
212 |
- li <- quantile(as.vector(fcnts_std_imp), probs= c(p, 1-p)) |
|
209 |
+ fcnts_interval_non_zero_medians <- apply(fcnts_std, 1, function(x) median(x[x > 0])) |
|
210 |
+ fcnts_std_imp <- apply(fcnts_std, 2, function(x) { x[x <= 0] <- fcnts_interval_non_zero_medians[x <= 0]; x}) |
|
211 |
+ p <- 0.001 |
|
212 |
+ li <- quantile(as.vector(fcnts_std_imp), probs = c(p, 1 - p)) |
|
213 | 213 |
fcnts_std_trunc <- fcnts_std_imp |
214 | 214 |
fcnts_std_trunc[fcnts_std_imp < li[1]] <- li[1] |
215 | 215 |
fcnts_std_trunc[fcnts_std_imp > li[2]] <- li[2] |
216 | 216 |
fcnts_std_final <- apply(fcnts_std_trunc, 2, function(x) log2(x / median(x))) |
217 |
- fcnts_std_final - median(apply(fcnts_std_final,2,median)) |
|
217 |
+ fcnts_std_final <- fcnts_std_final - median(apply(fcnts_std_final, 2, median)) |
|
218 | 218 |
s <- svd(fcnts_std_final) |
219 | 219 |
|
220 | 220 |
ret <- list( |