tests/testthat/test-downloadGEFiles.R

context("ISCon$downloadGEFiles()")

# Helper Functions ---------------------------------------------
getFileList <- function(con) {
  gef <- con$getDataset("gene_expression_files")
  nms <- unique(gef$file_info_name)
  nms <- nms[ !is.na(nms)]
  if (length(nms) > 5) {
    nms <- nms[1:5]
  }
  return(nms)
}

try_ggef <- function(con) {
  files <- getFileList(con)
  dmp <- tempdir()
  res <- tryCatch(
    con$downloadGEFiles(files = files, destdir = dmp),
    warning = function(w) {
      return(w)
    },
    error = function(e) {
      return(e)
    }
  )
}

# Main Tests ------------------------------------------------
test_that("gets files when files are present", {
  res <- try_ggef(con = SDY269)
  expect_true(all(res))
})

# TODO: IS1 once virtual study import is changed to pull rawfiles

Try the ImmuneSpaceR package in your browser

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

ImmuneSpaceR documentation built on Dec. 21, 2020, 2:01 a.m.