Skip to contents

Updates a Plate object representing a multiwell plate, by setting a given value for all wells in a block or a list of blocks defined by the well coordinates of their upper-left and bottom-right corners.

Usage

set_block(plate, block, what, value, add = FALSE)

# S4 method for Plate,character,character,numeric
set_block(plate, block, what, value, add = FALSE)

Arguments

plate

A Plate object representing a multiwell plate.

block

Coordinates of a rectangular block (such as “A01~B02”), or a vector of coordinates.

what

A reagent name.

value

The value to set.

add

Add to the volume instead of overriding it.

Value

Returns the Plate object, where the values for the wells indicated in the blocks have been updated.

Details

This function wraps platetools::set_block().

See also

Examples

p <- Plate("96")
head(p)
#> DataFrame with 6 rows and 0 columns

p <- p |>
  set_block(c("A01~B02", "A05~D05"), "dNTP", 0.25) |>
  set_block(    "A03",               "dNTP", 0.50)
head(p)
#> DataFrame with 6 rows and 1 column
#>          dNTP
#>     <numeric>
#> A01      0.25
#> A02      0.25
#> A03      0.50
#> A04        NA
#> A05      0.25
#> A06        NA

# Be careful with the column names
p <- set_block(p, "A01~H12", "Mg2+", 3.0)
#> Warning: Column name not syntactically correct.  See “?make.names”.
head(p)
#> DataFrame with 6 rows and 2 columns
#>          dNTP      Mg2.
#>     <numeric> <numeric>
#> A01      0.25         3
#> A02      0.25         3
#> A03      0.50         3
#> A04        NA         3
#> A05      0.25         3
#> A06        NA         3

p <- set_block(p, "A02~A03", "dNTP", 1, add = TRUE)
head(p)
#> DataFrame with 6 rows and 2 columns
#>          dNTP      Mg2.
#>     <numeric> <numeric>
#> A01      0.25         3
#> A02      1.25         3
#> A03      1.50         3
#> A04        NA         3
#> A05      0.25         3
#> A06        NA         3