Skip to content

Commit

Permalink
Make it possible to disable plotting in test
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Jul 24, 2024
1 parent 6e14cda commit e7de566
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: QDNAseq
Version: 1.41.2-9001
Version: 1.41.2-9002
Title: Quantitative DNA Sequencing for Chromosomal Aberrations
Depends: R (>= 3.1.0)
Imports:
Expand Down
35 changes: 22 additions & 13 deletions tests/QDNAseq.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,55 @@ library(QDNAseq)
library(Biobase) ## combine(), sampleNames()
library(utils)

do_plot <- TRUE
do_cleanup <- TRUE

# Load data
data(LGG150)
data <- LGG150
print(data)
stopifnot(inherits(data, "QDNAseqReadCounts"))

# Plot isobars of read counts
isobarPlot(data)
if (do_plot) isobarPlot(data)

# Plot copy number profile
plot(data, ylim=c(-100, 200))
highlightFilters(data, residual=TRUE, blacklist=TRUE)
if (do_plot) {
plot(data, ylim=c(-100, 200))
highlightFilters(data, residual=TRUE, blacklist=TRUE)
}

# Filter out "bad" bins
dataF <- applyFilters(data, residual=TRUE, blacklist=TRUE)
print(dataF)
plot(dataF, ylim=c(-100, 200))
if (do_plot) plot(dataF, ylim=c(-100, 200))
stopifnot(inherits(dataF, "QDNAseqReadCounts"))

# Correct read counts as a function of GC content and mappability
dataC <- correctBins(dataF)
print(dataC)
plot(dataC, ylim=c(-100, 200))
if (do_plot) plot(dataC, ylim=c(-100, 200))
stopifnot(inherits(dataC, "QDNAseqCopyNumbers"))

# Normalize binned read counts to have diploid normal copy number
dataN <- normalizeBins(dataC)
print(dataN)
plot(dataN)
if (do_plot) plot(dataN)
stopifnot(inherits(dataN, "QDNAseqCopyNumbers"))

# Plot noise
noisePlot(dataF)
if (do_plot) noisePlot(dataF)

# Segment copy numbers
fit <- segmentBins(dataN)
print(fit)
plot(fit)
if (do_plot) plot(fit)
stopifnot(inherits(fit, "QDNAseqCopyNumbers"))

# Call copy-number segments
fitC <- callBins(fit)
print(fitC)
plot(fitC)
if (do_plot) plot(fitC)


# ---------------------------------------------------------------
Expand Down Expand Up @@ -75,8 +80,10 @@ for (name in names(sets)) {
message(sprintf(" File(s) written: [n=%d] %s",
length(file), paste(sQuote(file), collapse = ", ")))
stopifnot(all(file_test("-f", file)))
file.remove(file)
stopifnot(!any(file_test("-f", file)))
if (do_cleanup) {f
file.remove(file)
stopifnot(!any(file_test("-f", file)))
}
}
}
}
Expand Down Expand Up @@ -115,8 +122,10 @@ for (name in names(sets)) {
message(sprintf(" File(s) written: [n=%d] %s",
length(file), paste(sQuote(file), collapse = ", ")))
stopifnot(all(file_test("-f", file)))
file.remove(file)
stopifnot(!any(file_test("-f", file)))
if (do_cleanup) {
file.remove(file)
stopifnot(!any(file_test("-f", file)))
}
}
}
}
Expand Down

0 comments on commit e7de566

Please sign in to comment.