plateLayout.SBA: Design plate layout

Description Usage Arguments Details Value Author(s) Examples

View source: R/plateLayout_0.6.R

Description

Design layouts of upto four 96-well plates by randomization with balances across those plates in terms of potential confounders. This can handle more than 384 samples, then it produces layouts for plural 386-well plates.

Usage

1
2
3
4
5
6
7
8
plateLayout.SBA(
  sinfo,
  cat_var = NULL,
  qty_var = NULL,
  nNull_per_96 = 2,
  null_var = NULL,
  plate_nr = NULL
)

Arguments

sinfo

a data frame that includes information about samples

cat_var

categorical variables into consideration. The number of samples in each category will be balanced (or kept constant) across the plates. It should be a value or a vector of some of column names in sinfo. When the number of samples are not a multiple of number of plates, some variation in numbers cannot be avoided. In such case, the variables listed to the left are prioritized during the balancing.

qty_var

quantitative variables into consideration. The values of the variables will be tested by ANOVA to check the balance and displayed in box plots. Like cat_var, it should be in sinfo

nNull_per_96

the number of null wells on each 96-well plate

null_var

the name of the column in which 'NULL' will be shown to indicate null well in sinfo. If it is given to NULL as default, the rows for null well will not be appended.

plate_nr

the plate number(s) to which samples will be allocated. The default is a sequential number.

Details

- Balancing in the randomization are as below,
1) The number of samples of each group devided by 'categorical variables' are same or similar on each plate e.g. Male patients on each plate are same across all plates. It lets the ratios of male:female and patient:control are kept. 2) The means of the values of 'quantitative variables' are homogeneous across all plates. e.g. The mean of ages of a plate is not too much deviated from the mean of other plates.

Value

The extended data frame of sinfo is generated with the columns 'plate', 'pos', 'row', and 'col'. 'plate' is designated plate ID. 'pos' is the number indicating position within plate (from top left to bottom right, move column-wise first). 'row' and 'col' are the row letter and column number, respectively. The plots to assist to compare the distribution of quantitative variables in each plate are accompanied.

Author(s)

Mun-Gwan Hong <mun-gwan.hong@scilifelab.se>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
n <- 368
tg <- data.frame(
  "id" = c(paste("a", sample(n*2, n), sep="_"), rep("repl", 8)), 
  "age" = c(abs(rnorm(n, 50, 20)), rep(NA, 8)), 
  "diag_yrs" = c(abs(rnorm(n, 2)), rep(NA, 8)), 
  "gender" = c(rep(c("female", "male"), n/2), rep(NA, 8)), 
  "dis" = c(rep(c("case", "control"), each = n/2), rep("repl", 8))
)
X <- plateLayout.SBA(tg, c("dis", "gender"), c("age", "diag_yrs"), 
                    null_var= "id", plate_nr= 1:4)
head(tg)
head(X)

Rundmus/BAf-R_package documentation built on May 18, 2020, 12:59 p.m.