# define an input stuff according to the help documentation for the tests!
mypeaks <- c("818.59 10000 1\n758.57 20\n687.50 20\n506.33 50\n494.33 15\n488.31 2")
# test the input
context("msms-search-lipidmaps: input check")
test_that("Is input correct:", {
expect_error(msms_search_lipidmaps(lipidclass = "phoslipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "Any",
ion = "formate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'arg' should be one of \"glycerolipids\", \"phospholipids\"")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "Any",
ion = "formate",
min_matches = 2,
LIMIT = "All"),
"No 'peaklist' given!")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "TG",
ion = "formate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'arg' should be one of \"Any\", \"PC\", \"PA\", \"PS\", \"PE\", \"PG\", \"PI\"")
expect_error(msms_search_lipidmaps(lipidclass = "glycerolipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "PC",
ion = "ammonium",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'arg' should be one of \"All\", \"MG\", \"DG\", \"TG\"")
expect_error(msms_search_lipidmaps(lipidclass = "glycerolipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "Any",
ion = "fornate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'arg' should be one of \"ammonium\"")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "Any",
ion = "ammonium",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'arg' should be one of \"chloride\", \"acetate\", \"formate\"")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = -10,
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "Any",
ion = "formate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'intensity_threshold' should be possitive!")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = "10",
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "Any",
ion = "formate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'intensity_threshold' needs to be a number!")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = -0.01,
prod_tol = 0.01,
headgroup = "Any",
ion = "formate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'prec_tol' should be possitive!")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = "0.01",
prod_tol = 0.01,
headgroup = "Any",
ion = "formate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'prec_tol' needs to be a number!")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = -0.01,
headgroup = "Any",
ion = "formate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'prod_tol' should be possitive!")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = "0.01",
headgroup = "Any",
ion = "formate",
min_matches = 2,
LIMIT = "All",
peaklist = mypeaks),
"'prod_tol' needs to be a number!")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = -0.01,
headgroup = "Any",
ion = "formate",
min_matches = -1,
LIMIT = "All",
peaklist = mypeaks),
"'min_matches' should be at least 2!")
expect_error(msms_search_lipidmaps(lipidclass = "phospholipids",
intensity_threshold = 10,
prec_tol = 0.01,
prod_tol = 0.01,
headgroup = "Any",
ion = "formate",
min_matches = "1",
LIMIT = "All",
peaklist = mypeaks),
"'min_matches' needs to be a number!")
})
# # test the output
#### for now: it returns 0 rows! I don't know why!
# context("msms-search-lipidmaps: output check")
#
# test_that("Is output correct:", {
# expect_equal(class(msms_search_lipidmaps(lipidclass = "phospholipids",
# intensity_threshold = 10,
# prec_tol = 0.01,
# prod_tol = 0.01,
# headgroup = "Any",
# ion = "formate",
# min_matches = 2,
# LIMIT = "All",
# peaklist = mypeaks)),
# "data.frame")
# })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.