Skip to content

Commit 7000e80

Browse files
committed
Fixing quantile probs argument (closes #387).
1 parent a82c794 commit 7000e80

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Package: PureCN
22
Type: Package
33
Title: Copy number calling and SNV classification using
44
targeted short read sequencing
5-
Version: 2.15.0
6-
Date: 2025-03-28
5+
Version: 2.15.1
6+
Date: 2025-04-17
77
Authors@R: c(person("Markus", "Riester",
88
role = c("aut", "cre"),
99
email = "markus.riester@novartis.com",
@@ -64,6 +64,7 @@ Enhances:
6464
genomicsdb (>= 0.0.3)
6565
VignetteBuilder: knitr
6666
License: Artistic-2.0
67+
BugReports: https://github.com/lima1/PureCN/issues
6768
URL: https://github.com/lima1/PureCN
6869
biocViews: CopyNumberVariation, Software, Sequencing,
6970
VariantAnnotation, VariantDetection, Coverage, ImmunoOncology

R/correctCoverageBias.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ output.qc.file = NULL) {
123123
as.data.frame(normalized)[, ids])
124124

125125
tumCov <- tumCov[which(tumCov$average.coverage <
126-
quantile(tumCov$average.coverage, 0.999, na.rm = TRUE)), ]
126+
quantile(tumCov$average.coverage, probs = 0.999, na.rm = TRUE)), ]
127127

128128
if (sum(!tumCov$on.target)) {
129129
tumCov <- tumCov[which(tumCov$on.target | tumCov$average.coverage <
130-
quantile(tumCov$average.coverage[!tumCov$on.target], 0.99, na.rm = TRUE)), ]
130+
quantile(tumCov$average.coverage[!tumCov$on.target], probs = 0.99, na.rm = TRUE)), ]
131131
}
132132
tumCov$on.target <- factor(ifelse(tumCov$on.target, "on-target", "off-target"),
133133
levels = c("on-target", "off-target"))
@@ -227,10 +227,10 @@ output.qc.file = NULL) {
227227
if (!any(tumor$valid)) next
228228
tumor$ideal <- TRUE
229229
routlier <- 0.01
230-
range <- quantile(tumor$average.coverage[tumor$valid], prob =
230+
range <- quantile(tumor$average.coverage[tumor$valid], probs =
231231
c(0, 1 - routlier), na.rm = TRUE)
232232
doutlier <- 0.001
233-
domain <- quantile(tumor$gc_bias[tumor$valid], prob = c(doutlier, 1 - doutlier),
233+
domain <- quantile(tumor$gc_bias[tumor$valid], probs = c(doutlier, 1 - doutlier),
234234
na.rm = TRUE)
235235

236236
tumor$ideal[!tumor$valid |
@@ -243,7 +243,7 @@ output.qc.file = NULL) {
243243
if (!any(tumor$ideal)) next
244244

245245
if (!on.target) {
246-
widthR <- quantile(width(tumor[tumor$ideal]), prob = 0.1)
246+
widthR <- quantile(width(tumor[tumor$ideal]), probs = 0.1)
247247
tumor$ideal[width(tumor) < widthR] <- FALSE
248248
}
249249
rough <- loess(tumor$average.coverage[tumor$ideal] ~ tumor$gc_bias[tumor$ideal],

R/filterIntervals.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ normalDB.min.coverage, normalDB.max.missing) {
275275

276276

277277
.filterIntervalsLowHighGC <- function(intervalsUsed, tumor, filter.lowhigh.gc) {
278-
qq <- quantile(tumor$gc_bias, p = c(filter.lowhigh.gc,
278+
qq <- quantile(tumor$gc_bias, probs = c(filter.lowhigh.gc,
279279
1 - filter.lowhigh.gc), na.rm = TRUE)
280280

281281
nBefore <- sum(intervalsUsed)

R/plotAbs.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ ss) {
199199
containsOfftarget <- sum(on.target)!=length(on.target)
200200
if (!containsOfftarget) return(NULL)
201201
myylim <- quantile(subset(log.ratio,
202-
!is.infinite(log.ratio)), p=c(0.0001, 1-0.0001),na.rm=TRUE)
202+
!is.infinite(log.ratio)), probs = c(0.0001, 1 - 0.0001), na.rm = TRUE)
203203
plot(log.ratio, col=ifelse(on.target, "black", "red"),
204204
pch=".",cex=3, ylim=myylim, ylab="log2 ratio")
205205
legend("bottomleft", legend=c("On-Target", "Off-Target"), ncol=2, fill=c("black", "red"))
@@ -240,7 +240,7 @@ ss) {
240240
minLogRatio <- max(min(seg$seg.mean), peak.ideal.means[1]*2)
241241
logRatio <- do.call(c, lapply(seq_len(nrow(seg)), function(i)
242242
rep(seg$seg.mean[i], seg$num.mark[i])))
243-
minLogRatio <- min(minLogRatio, quantile(logRatio, p=0.01))
243+
minLogRatio <- min(minLogRatio, quantile(logRatio, probs = 0.01))
244244
logRatio <- logRatio[logRatio >= minLogRatio]
245245

246246
# estimate genome fractions
@@ -377,10 +377,10 @@ ss) {
377377
ylim = c(
378378
min(
379379
log2(.calcExpectedRatio(-0.1, purity, ploidy)),
380-
quantile(logRatio$log.ratio, p = 0.0001)),
380+
quantile(logRatio$log.ratio, probs = 0.0001)),
381381
max(
382382
max(segment.log.ratio*1.1),
383-
quantile(logRatio$log.ratio, p = 1 - 0.0001))
383+
quantile(logRatio$log.ratio, probs = 1 - 0.0001))
384384
),
385385
...)
386386
points(x, r$log.ratio[idx], col=col.snps, pch=mypch)
@@ -418,7 +418,7 @@ ss) {
418418
round(res$results[[id]]$log.likelihood, digits = 2))
419419

420420
myylim <- quantile(subset(r$log.ratio,
421-
!is.infinite(r$log.ratio)), p=c(0.001, 1-0.001), na.rm=TRUE)
421+
!is.infinite(r$log.ratio)), probs = c(0.001, 1 - 0.001), na.rm = TRUE)
422422
myylim[1] <- floor(myylim[1])
423423
myylim[2] <- ceiling(myylim[2])
424424

@@ -491,7 +491,7 @@ ss) {
491491

492492
seg <- res$results[[id]]$seg
493493
mylogratio.xlim <- quantile(subset(r$log.ratio,
494-
!is.infinite(r$log.ratio)), p = c(0.001, 1 - 0.001), na.rm = TRUE)
494+
!is.infinite(r$log.ratio)), probs = c(0.001, 1 - 0.001), na.rm = TRUE)
495495

496496
peak.ideal.means <- .calcIdealPeaks(seg, purity, ploidy)
497497
scatter.labels <- paste0(r$ML.C, "m", r$ML.M)[!r$ML.SOMATIC]
@@ -608,15 +608,15 @@ ss) {
608608
xc <- .matrixTotalPloidyToTumorPloidy(res$candidates$all)
609609
xc[is.infinite(xc)] <- min(xc[!is.infinite(xc)], na.rm = TRUE)
610610
xc[is.na(xc)] <- min(xc[!is.infinite(xc)], na.rm = TRUE)
611-
xc[xc < quantile(xc, p = 0.2)] <- quantile(xc, p = 0.2)
611+
xc[xc < quantile(xc, p = 0.2)] <- quantile(xc, probs = 0.2)
612612

613613
mycol.image <- colorRampPalette(rev(brewer.pal(n = 7,
614614
name = "RdYlBu")))(100)
615615
image(as.numeric(colnames(xc)), as.numeric(rownames(xc)),
616616
t(xc) - max(xc), col = mycol.image, xlab = "Purity",
617617
ylab = "Ploidy",main = main,...)
618618
.legend.col(col = mycol.image, lev = min(xc):max(xc),
619-
ylim = quantile(as.numeric(rownames(xc)), p = c(0,1)))
619+
ylim = quantile(as.numeric(rownames(xc)), probs = c(0,1)))
620620

621621
if (show.contour) contour(as.numeric(colnames(xc)),
622622
as.numeric(rownames(xc)), t(xc), add = TRUE)

R/segmentationCBS.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ segmentationCBS <- function(normal, tumor, log.ratio, seg, plot.cnv,
303303
}
304304
# a crude way of estimating purity - in heigher purity samples, we
305305
# can undo a little bit more aggressively
306-
q <- quantile(log.ratio, p = c(d, 1 - d))
306+
q <- quantile(log.ratio, probs = c(d, 1 - d))
307307
q.diff <- abs(q[1] - q[2])
308308
if (q.diff < 0.5) return(0.5 * sd.min.ratio)
309309
if (q.diff < 1) return(0.75 * sd.min.ratio)
@@ -315,7 +315,7 @@ segmentationCBS <- function(normal, tumor, log.ratio, seg, plot.cnv,
315315
seg <- seg[seg$num.mark >= 1, ]
316316
log.ratio <- unlist(lapply(seq_len(nrow(seg)), function(i)
317317
rep(seg$seg.mean[i], seg$num.mark[i])))
318-
q <- quantile(log.ratio, p = c(d, 1 - d))
318+
q <- quantile(log.ratio, probs = c(d, 1 - d))
319319
q.diff <- abs(q[1] - q[2])
320320
if (q.diff < 0.5) return(0.1)
321321
if (q.diff < 1) return(0.15)

0 commit comments

Comments
 (0)