@@ -72,21 +72,22 @@ well_from_rowcol <- function(row, col) {
7272# ' @return A list with two elements: row and col
7373# ' @export
7474# ' @examples
75- # ' rowcol_from_well(c("A1", "B2", "C3"), 48)
75+ # ' rowcol_from_well(c("A1", "B2", "C3", NA ), 48)
7676# ' # The order is preserved
7777# ' rowcol_from_well(c("H12", "A1"), 96)
7878rowcol_from_well <- function (well , format ) {
7979 format <- as.character(format )
8080 if (! length(format ) == 1 ) {
81- rlang :: abort(" Format must be a single element character vector" )
81+ rlang :: abort(" Plate format must be a single element character vector" )
8282 }
83- if (! as.character(format ) %in% names(.plateformats )) {
84- rlang :: abort(" Format must be one of '24', '48', '96', or '384'" )
83+ plfs <- names(.plateformats )
84+ if (! as.character(format ) %in% plfs ) {
85+ rlang :: abort(glue :: glue(" Plate format must be one of " , paste0(" '" , plfs , " '" , collapse = " , " ), " ." ))
8586 }
8687 if (! is.character(well )) {
8788 rlang :: abort(" Well must be a character vector" )
8889 }
89- if (any(! well %in% .plateformats [[format ]]$ wellnames )) {
90+ if (any(! well [ ! is.na( well )] %in% .plateformats [[format ]]$ wellnames )) {
9091 rlang :: abort(glue :: glue(" Wells not present in {format}-wells format" ))
9192 }
9293 indices <- match(well , .plateformats [[format ]]$ map $ well )
0 commit comments