context("test: coverage_bar_plot")
test_that("Testing coverage bar plotting function", {
# Download required test files------------------------------------------------
PC <- readRDS(system.file("testdata", "PeptideCoverage.RDS", package = "pspecterlib"))
# Test coverage bar plot input checks-----------------------------------------
# Peptide coverage must be of the correct class
expect_error(
coverage_bar_plot(data.frame(test = 1)),
"PeptideCoverage must be an object of the peptide_coverage class generated by get_peptide_coverage."
)
# Interactive should be a true or false
expect_error(
coverage_bar_plot(PC, Interactive = "NA"),
"Interactive must be a single logical value TRUE or FALSE."
)
# Create an coverage bar plot-------------------------------------------------
# Make an interactive bar plot
theBarplot <- coverage_bar_plot(PC, TRUE)
expect_true(inherits(theBarplot, "plotly"))
# Make a static bar plot with the NA option
staticBar <- coverage_bar_plot(PC, NA)
expect_true(inherits(staticBar, "ggplot"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.