tests/testthat/test_full_landscape.R

context("test full_landscape function")
#Like the nature of the function, this is really just an amalgamation of the two functions "polar
#_landscape", and "acidity_landscape"
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 <-full_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 <-full_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 <-full_landscape(y2)
expect_identical(q$labels$x, "atom coordinate/Acidity category")
expect_identical(q$labels$title, "Full 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(full_landscape(y3))
})
test_that("make sure LogP 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))

library(proto)
q <-full_landscape(y2)
expect_match(colnames(y2, do.NULL = TRUE, prefix = "col"),"logP", all=FALSE)
expect_identical(q$data$logP,-2.94)
})

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 <-full_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 <-full_landscape(y2)
expect_identical(q$labels$x, "atom coordinate/Acidity category")
expect_identical(q$labels$y, "logP")
expect_identical(q$labels$title, "Full Landscape")
})

test_that("make sure non sensical data is not plotted",{
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))
y3 <- y2
y3$logP <- NULL
expect_error(full_landscape(y3))
})
zalperst/visualizeprot documentation built on May 4, 2019, 9:08 p.m.