tests/testthat/test_SuperPCA_pVals.R

context("SuperPCA_pVals")

data("colon_pathwayCollection")
data("colonSurv_df")

###  Survival  ###
test_that("Survival SuperPCA_pVals has correct class", {
  
  colon_OmicsSurv <- CreateOmics(
    assayData_df = colonSurv_df[, -(2:3)],
    pathwayCollection_ls = colon_pathwayCollection,
    response = colonSurv_df[, 1:3],
    respType = "surv"
  )
  
  expect_s3_class(
    SuperPCA_pVals(
      object = colon_OmicsSurv,
      parallel = TRUE,
      numCores = 2,
      adjustpValues = TRUE,
      adjustment = "BH"
    ), class = "superpcOut"
  )
  
})


###  Regression  ###
test_that("Regression SuperPCA_pVals gives correct class", {

  colon_OmicsReg <- CreateOmics(
    assayData_df = colonSurv_df[, -(2:3)],
    pathwayCollection_ls = colon_pathwayCollection,
    response = colonSurv_df[, 1:2],
    respType = "reg"
  )

  expect_s3_class(
    SuperPCA_pVals(
      object = colon_OmicsReg,
      parallel = TRUE,
      numCores = 2,
      adjustpValues = TRUE,
      adjustment = "BH"
    ), class = "superpcOut"
  )

})


###  Categorical  ###
test_that("Categorical SuperPCA_pVals gives correct class", {

  colon_OmicsCateg <- CreateOmics(
    assayData_df = colonSurv_df[, -(2:3)],
    pathwayCollection_ls = colon_pathwayCollection,
    response = colonSurv_df[, c(1, 3)],
    respType = "categ"
  )

  expect_s3_class(
    SuperPCA_pVals(
      object = colon_OmicsCateg,
      parallel = TRUE,
      numCores = 2,
      adjustpValues = TRUE,
      adjustment = "BH"
    ), class = "superpcOut"
  )

})

Try the pathwayPCA package in your browser

Any scripts or data that you put into this service are public.

pathwayPCA documentation built on Dec. 15, 2020, 6:14 p.m.