tests/testthat/test-check_phe_table_ok_for_qt.R

test_that("case-control values in first column", {
  phe_table <- create_demo_phe_table()
  # All ones and twos
  phe_table$random <- 2
  phe_table$random[1] <- 1
  expect_error(
    check_phe_table_ok_for_qt(
      phe_table
    )
  )
})

test_that("use, second column", {
  phe_table <- create_demo_phe_table()
  # All zeroes, ones and twos
  phe_table$additive <- 2
  phe_table$additive[1] <- 0
  phe_table$additive[2] <- 1
  expect_error(
    check_phe_table_ok_for_qt(
      phe_table
    )
  )
})

test_that("only FID and IID columns", {
  phe_table <- create_demo_phe_table()
  # All zeroes, ones and twos
  phe_table <- phe_table[, c(1, 2)]
  expect_error(
    check_phe_table_ok_for_qt(
      phe_table
    ),
    "Need at least 3 column in a phenotype ..phe. table"
  )
})
richelbilderbeek/plinkr documentation built on March 25, 2024, 3:18 p.m.