tests/testthat/test_acidity_landscape.R

context("Succesfully display acidity categories via ggplot object")

test_that("make sure Acidity information exists",{
#initializing test data frames

write("ATOM   7584  N   THR A1038      85.730  97.747  55.352  1.00 20.29           N", file ="test.pdb")

y <- Rpdb::read.pdb("test.pdb")
y2 <- assign_params(pdb_dataframe(y))
q <-acidity_landscape(y2)
library(proto)
expect_match(colnames(y2, do.NULL = TRUE, prefix = "col"),"Acidity", all=FALSE)
expect_identical(q$data$Acidity,"Neutral")
})

test_that("make sure chains exist for for faceting, with default name",{
#initializing test data frames

write("ATOM   7584  N   THR A1038      85.730  97.747  55.352  1.00 20.29           N", file ="test.pdb")

y <- Rpdb::read.pdb("test.pdb")
y2 <- assign_params(pdb_dataframe(y))

library(proto)

q <-acidity_landscape(y2)
expect_identical(q$data$chainid,"A")
})

test_that("make sure labelling worked out",{
#initializing test data frames

write("ATOM   7584  N   THR A1038      85.730  97.747  55.352  1.00 20.29           N", file ="test.pdb")

y <- Rpdb::read.pdb("test.pdb")
y2 <- assign_params(pdb_dataframe(y))

library(proto)
q <-acidity_landscape(y2)
expect_identical(q$labels$x, "atom coordinate/Acidity category")
expect_identical(q$labels$title, "Acidity Landscape")
})
test_that("make sure non sensical data is not plotted",{
#initializing test data frames

write("ATOM   7584  N   THR A1038      85.730  97.747  55.352  1.00 20.29           N", file ="test.pdb")

y <- Rpdb::read.pdb("test.pdb")
y2 <- assign_params(pdb_dataframe(y))

library(proto)

y3 <- y2
y3$Acidity <- 99
expect_error(acidity_landscape(y3))
})
zalperst/visualizeprot documentation built on May 4, 2019, 9:08 p.m.