Skip to content

Commit 20b42b3

Browse files
committed
Add some more tests, ignore lines that are not recognized by covr
1 parent 80c6260 commit 20b42b3

File tree

3 files changed

+65
-3
lines changed

3 files changed

+65
-3
lines changed

R/plotPairs.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@ plotPairs <- function(se, selAssay = "counts", doLog = TRUE, pseudocount = 1,
126126
cols)(transfCor),
127127
maxColorValue = 255)
128128
} else {
129+
# nocov start
129130
cols <- hcl.colors(n = 11, palette = "RdBu")[6:10]
130131
col <- rgb(colorRamp(
131132
cols)(transfCor),
132133
maxColorValue = 255)
134+
# nocov end
133135
}
134136
} else {
135-
col <- "white"
137+
col <- "white" #nocov
136138
}
137139

138140
## Construct plot
@@ -150,6 +152,9 @@ plotPairs <- function(se, selAssay = "counts", doLog = TRUE, pseudocount = 1,
150152
## --------------------------------------------------------------------- ##
151153
## Scatter plots
152154
## --------------------------------------------------------------------- ##
155+
# All the point plotting functions are tested, but for some reason covr
156+
# doesn't pick it up - ignore these definitions in the coverage tests
157+
# nocov start
153158
if (pointsType == "smoothscatter") {
154159
## Define function to create smoothscatter-like plot
155160
## (for use with ggpairs)
@@ -229,6 +234,7 @@ plotPairs <- function(se, selAssay = "counts", doLog = TRUE, pseudocount = 1,
229234
}
230235
}
231236
}
237+
# nocov end
232238

233239
## Define the function to use for the plots
234240
if (pointsType == "smoothscatter") {
@@ -244,6 +250,7 @@ plotPairs <- function(se, selAssay = "counts", doLog = TRUE, pseudocount = 1,
244250
## --------------------------------------------------------------------- ##
245251
## Histogram
246252
## --------------------------------------------------------------------- ##
253+
# nocov start
247254
diaghist <- function(data, mapping, ...) {
248255
gg <- ggplot(data = data, mapping = mapping) +
249256
geom_histogram(fill = "#F5C710", color = "grey50",
@@ -254,6 +261,7 @@ plotPairs <- function(se, selAssay = "counts", doLog = TRUE, pseudocount = 1,
254261
}
255262
gg
256263
}
264+
# nocov end
257265

258266
## --------------------------------------------------------------------- ##
259267
## Combined plot

R/plotResults.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
.assertScalar(x = interactivePlot, type = "logical")
6363

6464
if (interactivePlot && !requireNamespace("plotly", quietly = TRUE)) {
65-
stop("The 'plotly' package is required to make interactive plots.")
65+
stop("The 'plotly' package is required to make interactive plots.") # nocov
6666
}
6767
xr <- range(res[[xCol]], na.rm = TRUE)
6868
yr <- range(res[[yCol]], na.rm = TRUE)
@@ -113,7 +113,7 @@
113113
}
114114
}
115115
if (interactivePlot) {
116-
plotly::ggplotly(gg)
116+
plotly::ggplotly(gg) # nocov
117117
} else {
118118
if (!is.null(labelCol) && length(labelValues) > 0) {
119119
.assertVector(x = labelValues, type = "character",

tests/testthat/test_linkMultipleVariants.R

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,60 @@ test_that("linkMultipleVariants works", {
535535
expect_equal(res$filtSeparate$V3[, "nbrRetained"],
536536
sum(!grepl("C.*mut|del|V3\\.", truth$truth$status)))
537537

538+
# --------------------------------------------------------------------------
539+
# Get warning when summing UMIs
540+
expect_warning({
541+
res <- linkMultipleVariants(
542+
combinedDigestParams = list(
543+
fastqForward = system.file("extdata", "multipleVariableRegions_R1.fastq.gz",
544+
package = "mutscan"),
545+
fastqReverse = system.file("extdata", "multipleVariableRegions_R2.fastq.gz",
546+
package = "mutscan"),
547+
elementsForward = "UVCVCV", elementLengthsForward = c(6, 24, 10, 30, 10, -1),
548+
elementsReverse = "CVCV", elementLengthsReverse = c(6, 40, 10, -1),
549+
mergeForwardReverse = TRUE, minOverlap = 20,
550+
maxOverlap = 30, maxFracMismatchOverlap = 0,
551+
revComplForward = FALSE, revComplReverse = TRUE,
552+
avePhredMinForward = 20, avePhredMinReverse = 20,
553+
verbose = verbose),
554+
barcode = list(
555+
fastqForward = system.file("extdata", "multipleVariableRegions_R1.fastq.gz",
556+
package = "mutscan"),
557+
elementsForward = "CVCSCS", elementLengthsForward = c(6, 24, 10, 30, 10, -1),
558+
avePhredMinForward = 20,
559+
collapseMaxDist = 1, collapseMinScore = 1, collapseMinRatio = 1,
560+
verbose = verbose),
561+
V2 = list(
562+
fastqForward = system.file("extdata", "multipleVariableRegions_R1.fastq.gz",
563+
package = "mutscan"),
564+
fastqReverse = system.file("extdata", "multipleVariableRegions_R2.fastq.gz",
565+
package = "mutscan"),
566+
elementsForward = "CSCVCS", elementLengthsForward = c(6, 24, 10, 30, 10, -1),
567+
elementsReverse = "CSCV", elementLengthsReverse = c(6, 40, 10, -1),
568+
mergeForwardReverse = TRUE, minOverlap = 10,
569+
maxOverlap = 20, maxFracMismatchOverlap = 0,
570+
revComplForward = FALSE, revComplReverse = TRUE,
571+
avePhredMinForward = 20, avePhredMinReverse = 20,
572+
wildTypeForward = truth$WTV2,
573+
nbrMutatedCodonsMaxForward = -1, nbrMutatedBasesMaxForward = 1,
574+
forbiddenMutatedCodonsForward = "", collapseToWTForward = FALSE,
575+
verbose = verbose, useTreeWTmatch = TRUE),
576+
V3 = list(
577+
fastqForward = system.file("extdata", "multipleVariableRegions_R1.fastq.gz",
578+
package = "mutscan"),
579+
fastqReverse = system.file("extdata", "multipleVariableRegions_R2.fastq.gz",
580+
package = "mutscan"),
581+
elementsForward = "CSCSCV", elementLengthsForward = c(6, 24, 10, 30, 10, -1),
582+
elementsReverse = "CVCS", elementLengthsReverse = c(6, 40, 10, -1),
583+
mergeForwardReverse = TRUE, minOverlap = 5,
584+
maxOverlap = 15, maxFracMismatchOverlap = 0,
585+
revComplForward = FALSE, revComplReverse = TRUE,
586+
avePhredMinForward = 20, avePhredMinReverse = 20,
587+
wildTypeForward = truth$WTV3,
588+
nbrMutatedCodonsMaxForward = -1, nbrMutatedBasesMaxForward = 1,
589+
forbiddenMutatedCodonsForward = "", collapseToWTForward = FALSE,
590+
verbose = verbose, useTreeWTmatch = TRUE)
591+
)}, "Aggregating UMI counts")
538592
})
539593

540594

0 commit comments

Comments
 (0)