olink_plate_randomizer: Randomly assign samples to plates

View source: R/Olink_plate_randomizer.R

olink_plate_randomizerR Documentation

Randomly assign samples to plates

Description

Generates a scheme for how to plate samples with an option to keep subjects on the same plate.

Usage

olink_plate_randomizer(
  Manifest,
  PlateSize = 96,
  Product,
  SubjectColumn,
  iterations = 500,
  available.spots,
  num_ctrl = 8,
  rand_ctrl = FALSE,
  seed
)

Arguments

Manifest

tibble/data frame in long format containing all sample ID's. Sample ID column must be named SampleID.

PlateSize

Integer. Either 96 or 48. 96 is default.

Product

String. Name of Olink product used to set PlateSize if not provided. Optional.

SubjectColumn

(Optional) Column name of the subject ID column. Cannot contain missings. If provided, subjects are kept on the same plate.

iterations

Number of iterations for fitting subjects on the same plate.

available.spots

Numeric. Number of wells available on each plate. Maximum 40 for T48 and 88 for T96. Takes a vector equal to the number of plates to be used indicating the number of wells available on each plate.

num_ctrl

Numeric. Number of controls on each plate (default = 8)

rand_ctrl

Logical. Whether controls are added to be randomized across the plate (default = FALSE)

seed

Seed to set. Highly recommend setting this for reproducibility.

Details

Variables of interest should if possible be randomized across plates to avoid confounding with potential plate effects. In the case of multiple samples per subject (e.g. in longitudinal studies), Olink recommends keeping each subject on the same plate. This can be achieved using the SubjectColumn argument.

Value

A "tibble" including SampleID, SubjectID etc. assigned to well positions. Columns include same columns as Manifest with additional columns:

  • plate: Plate number

  • column: Column on the plate

  • row: Row on the plate

  • well: Well location on the plate

See Also

  • olink_displayPlateLayout() for visualizing the generated plate layouts

  • olink_displayPlateDistributions() for validating that sites are properly randomized

Examples


#Generate randomization scheme using complete randomization
randomized.manifest_a <- olink_plate_randomizer(manifest, seed=12345)

#Generate randomization scheme that keeps subjects on the same plate
randomized.manifest_b <- olink_plate_randomizer(manifest,SubjectColumn="SubjectID",
                                                        available.spots=c(88,88), seed=12345)

#Visualize the generated plate layouts
olink_displayPlateLayout(randomized.manifest_a, fill.color = 'Site')
olink_displayPlateLayout(randomized.manifest_a, fill.color = 'SubjectID')
olink_displayPlateLayout(randomized.manifest_b, fill.color = 'Site')
olink_displayPlateLayout(randomized.manifest_b, fill.color = 'SubjectID')

#Validate that sites are properly randomized
olink_displayPlateDistributions(randomized.manifest_a, fill.color = 'Site')
olink_displayPlateDistributions(randomized.manifest_b, fill.color = 'Site')




OlinkAnalyze documentation built on Nov. 4, 2023, 1:07 a.m.