for (i in c(6, 12, 24, 48, 96, 384, 1536)) { path <- paste0("test_data/", i, "/") test_that("plate_params can return a list of those parameters", { csv_file <- paste0(path, "allWellIds.csv") xlsx_file <- paste0(path, "allWellIds.xlsx") imported_csv <- readr::read_csv(csv_file, col_names = FALSE) imported_xlsx <- readxl::read_xlsx(xlsx_file, col_names = FALSE) n_cols_csv <- ncol(imported_csv) n_cols_xlsx <- ncol(imported_csv) result_csv <- plate_params(imported_csv, n_cols_csv) result_xlsx <- plate_params(imported_xlsx, n_cols_xlsx) expect_type(result_csv, "list") expect_type(result_xlsx, "list") }) } test_that("6 well params are identical to 6 well plate", { path <- "test_data/6/" csv_file <- paste0(path, "allWellIds.csv") xlsx_file <- paste0(path, "allWellIds.xlsx") imported_csv <- readr::read_csv(csv_file, col_names = FALSE) imported_xlsx <- readxl::read_xlsx(xlsx_file, col_names = FALSE) n_cols_csv <- ncol(imported_csv) n_cols_xlsx <- ncol(imported_csv) result_csv <- plate_params(imported_csv, n_cols_csv) result_xlsx <- plate_params(imported_xlsx, n_cols_xlsx) expected <- list(1L, 3L, 6L, c(1:4), 3L, 4L, LETTERS[1:2], c(1:3)) expect_identical(result_csv, expected) expect_identical(result_xlsx, expected) }) test_that("12 well params are identical to 12 well plate", { path <- "test_data/12/" csv_file <- paste0(path, "allWellIds.csv") xlsx_file <- paste0(path, "allWellIds.xlsx") imported_csv <- readr::read_csv(csv_file, col_names = FALSE) imported_xlsx <- readxl::read_xlsx(xlsx_file, col_names = FALSE) n_cols_csv <- ncol(imported_csv) n_cols_xlsx <- ncol(imported_csv) result_csv <- plate_params(imported_csv, n_cols_csv) result_xlsx <- plate_params(imported_xlsx, n_cols_xlsx) expected <- list(1L, 4L, 12L, c(1:5), 4L, 5L, LETTERS[1:3], c(1:4)) expect_identical(result_csv, expected) expect_identical(result_xlsx, expected) }) test_that("24 well params are identical to 24 well plate", { path <- "test_data/24/" csv_file <- paste0(path, "allWellIds.csv") xlsx_file <- paste0(path, "allWellIds.xlsx") imported_csv <- readr::read_csv(csv_file, col_names = FALSE) imported_xlsx <- readxl::read_xlsx(xlsx_file, col_names = FALSE) n_cols_csv <- ncol(imported_csv) n_cols_xlsx <- ncol(imported_csv) result_csv <- plate_params(imported_csv, n_cols_csv) result_xlsx <- plate_params(imported_xlsx, n_cols_xlsx) expected <- list(1L, 5L, 24L, c(1:7), 5L, 6L, LETTERS[1:4], c(1:6)) expect_identical(result_csv, expected) expect_identical(result_xlsx, expected) }) test_that("48 well params are identical to 48 well plate", { path <- "test_data/48/" csv_file <- paste0(path, "allWellIds.csv") xlsx_file <- paste0(path, "allWellIds.xlsx") imported_csv <- readr::read_csv(csv_file, col_names = FALSE) imported_xlsx <- readxl::read_xlsx(xlsx_file, col_names = FALSE) n_cols_csv <- ncol(imported_csv) n_cols_xlsx <- ncol(imported_csv) result_csv <- plate_params(imported_csv, n_cols_csv) result_xlsx <- plate_params(imported_xlsx, n_cols_xlsx) expected <- list(1L, 7L, 48L, c(1:9), 7L, 8L, LETTERS[1:6], c(1:8)) expect_identical(result_csv, expected) expect_identical(result_xlsx, expected) }) test_that("96 well params are identical to 96 well plate", { path <- "test_data/96/" csv_file <- paste0(path, "allWellIds.csv") xlsx_file <- paste0(path, "allWellIds.xlsx") imported_csv <- readr::read_csv(csv_file, col_names = FALSE) imported_xlsx <- readxl::read_xlsx(xlsx_file, col_names = FALSE) n_cols_csv <- ncol(imported_csv) n_cols_xlsx <- ncol(imported_csv) result_csv <- plate_params(imported_csv, n_cols_csv) result_xlsx <- plate_params(imported_xlsx, n_cols_xlsx) expected <- list(1L, 9L, 96L, c(1:13), 9L, 10L, LETTERS[1:8], c(1:12)) expect_identical(result_csv, expected) expect_identical(result_xlsx, expected) }) test_that("384 well params are identical to 384 well plate", { path <- "test_data/384/" csv_file <- paste0(path, "allWellIds.csv") xlsx_file <- paste0(path, "allWellIds.xlsx") imported_csv <- readr::read_csv(csv_file, col_names = FALSE) imported_xlsx <- readxl::read_xlsx(xlsx_file, col_names = FALSE) n_cols_csv <- ncol(imported_csv) n_cols_xlsx <- ncol(imported_csv) result_csv <- plate_params(imported_csv, n_cols_csv) result_xlsx <- plate_params(imported_xlsx, n_cols_xlsx) expected <- list(1L, 17L, 384L, c(1:25), 17L, 18L, LETTERS[1:16], c(1:24)) expect_identical(result_csv, expected) expect_identical(result_xlsx, expected) }) test_that("1536 well params are identical to 1536 well plate", { path <- "test_data/1536/" csv_file <- paste0(path, "allWellIds.csv") xlsx_file <- paste0(path, "allWellIds.xlsx") imported_csv <- readr::read_csv(csv_file, col_names = FALSE) imported_xlsx <- readxl::read_xlsx(xlsx_file, col_names = FALSE) n_cols_csv <- ncol(imported_csv) n_cols_xlsx <- ncol(imported_csv) result_csv <- plate_params(imported_csv, n_cols_csv) result_xlsx <- plate_params(imported_xlsx, n_cols_xlsx) expected <- list(1L, 33L, 1536L, c(1:49), 33L, 34L, c(LETTERS[1:26], paste0("A", LETTERS[1:6])), c(1:48)) expect_identical(result_csv, expected) expect_identical(result_xlsx, expected) }) test_that("naming_cols correctly formats the names of the input dataframe", { initial_df <- tibble::tibble( values = LETTERS[1:10], b = 1:10, c = 21:30 ) result <- tibble::tibble( wells = c("A01","B02","C03","D04","E05","F06","G07","H08","I09","J10"), values = 21:30 ) expect_identical(naming_cols(initial_df, "wells"), result) })