olink_plate_randomizer: Randomly assign samples to plates

View source: R/Olink_plate_randomizer.R

olink_plate_randomizerR Documentation

Description

Generates a scheme for how to plate samples with an option to keep subjects on the same plate and/or to keep studies together.

Usage

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

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 missing values. If provided, subjects are kept on the same plate. This argument is used for longitudinal studies and must be a separate column from the SampleID column.

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.

study

String. Optional. Name of column that includes study information. For when multiple studies are being plated and randomizing within studies. If study column is present in manifest, within study randomization will be performed.

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 (for longitudinal studies)
randomized.manifest_b <- olink_plate_randomizer(manifest,SubjectColumn="SubjectID",
                                                        available.spots=c(88,88), seed=12345)

# Generate randomization scheme that keeps samples from the same study together
randomized.manifest_c <- olink_plate_randomizer(manifest, study = "Site")

#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')
olink_displayPlateLayout(randomized.manifest_c, fill.color = 'Site')

#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 April 4, 2025, 3:26 a.m.