Title: | Omixer: multivariate and reproducible sample randomization to proactively counter batch effects in omics studies |
---|---|
Description: | Omixer - an Bioconductor package for multivariate and reproducible sample randomization, which ensures optimal sample distribution across batches with well-documented methods. It outputs lab-friendly sample layouts, reducing the risk of sample mixups when manually pipetting randomized samples. |
Authors: | Lucy Sinke [cre, aut] |
Maintainer: | Lucy Sinke <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.17.0 |
Built: | 2024-10-30 08:28:54 UTC |
Source: | https://github.com/bioc/Omixer |
Omixer provides functions to perform optimal randomization of sample lists prior to omic profiling. This minimizes the correlation between biological factors and technical covariates, whilst ensuring there is insufficient evidence for any of these associations.
Following this multivariate randomization, Omixer can also be used to smoothly bridge the gap between dry and wet labs, by creating visually intuitive sample sheets.
With clear documentation and the possibility to reproduce any output sample list, Omixer sets the standard for transparency and reproducibility in this often vague methodological step.
Lucy Sinke [email protected]
This function uses appropriate tests of correlation between two variables and stores the estimate and p-value in a list.
omixerCorr(x, y)
omixerCorr(x, y)
x |
Randomization variable (e.g. age) |
y |
Technical covariate (e.g. plate number) |
For two categorical variables, the Cramer's V estimate is stored alongside chi-square p-value. For all other combinations of variables, Pearson's correlation coefficient and p-value are stored.
Please note: variables will be converted to numeric class within this function.
List of correlation estimate and p-value
library(tibble) library(forcats) library(stringr) sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"), sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), age=round(rnorm(48, mean=30, sd=8), 0), smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)), date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), by="day"), 48)) omixerCorr(sampleList$age, sampleList$sex)
library(tibble) library(forcats) library(stringr) sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"), sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), age=round(rnorm(48, mean=30, sd=8), 0), smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)), date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), by="day"), 48)) omixerCorr(sampleList$age, sampleList$sex)
As the main function of the Omixer package, this function outputs a randomized sample list that minimizes correlations between biological factors and technical covariates.
omixerRand( df, sampleId = "sampleId", block = "block", iterNum = 1000, wells, div = "none", positional = FALSE, plateNum = 1, layout, mask = 0, techVars, randVars )
omixerRand( df, sampleId = "sampleId", block = "block", iterNum = 1000, wells, div = "none", positional = FALSE, plateNum = 1, layout, mask = 0, techVars, randVars )
df |
Sample list |
sampleId |
String specifying sample ID variable |
block |
Paired sample identifier |
iterNum |
Number of layouts to generate |
wells |
Number of wells on a plate |
div |
Plate subdivisions |
positional |
Logical indicator of positional batch effects |
plateNum |
Number of plates |
layout |
Custom plate layout as data frame |
mask |
Wells to be left empty |
techVars |
Technical covariates |
randVars |
Randomization variables |
Selected randomized sample list as a data frame
Randomization environment of optimal list generation
library(tibble) library(forcats) library(stringr) sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"), sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), age=round(rnorm(48, mean=30, sd=8), 0), smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)), date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), by="day"), 48)) randVars <- c("sex", "age", "smoke", "date") omixerLayout <- omixerRand(sampleList, sampleId="sampleId", block="block", iterNum=10, wells=48, div="row", plateNum=1, randVars=randVars)
library(tibble) library(forcats) library(stringr) sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"), sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), age=round(rnorm(48, mean=30, sd=8), 0), smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)), date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), by="day"), 48)) randVars <- c("sex", "age", "smoke", "date") omixerLayout <- omixerRand(sampleList, sampleId="sampleId", block="block", iterNum=10, wells=48, div="row", plateNum=1, randVars=randVars)
This function will generate visually intuitive plate layouts for the wet lab, with the option to colour code different types of samples (e.g. for studies investigating multiple tissues).
omixerSheet(omixerLayout = omixerLayout, group)
omixerSheet(omixerLayout = omixerLayout, group)
omixerLayout |
Randomized sample list |
group |
Colour-coding indicator |
PDF of sample layout in working directory
library(tibble) library(forcats) library(stringr) sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"), sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), age=round(rnorm(48, mean=30, sd=8), 0), smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)), date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), by="day"), 48)) randVars <- c("sex", "age", "smoke", "date") omixerLayout <- omixerRand(sampleList, sampleId="sampleId", block="block", iterNum=10, wells=48, div="row", plateNum=1, randVars=randVars) omixerSheet(omixerLayout)
library(tibble) library(forcats) library(stringr) sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"), sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), age=round(rnorm(48, mean=30, sd=8), 0), smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)), date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), by="day"), 48)) randVars <- c("sex", "age", "smoke", "date") omixerLayout <- omixerRand(sampleList, sampleId="sampleId", block="block", iterNum=10, wells=48, div="row", plateNum=1, randVars=randVars) omixerSheet(omixerLayout)
Regenerate an Omixer-produced randomized sample list quickly, after setting up the random environement from omixerRand
omixerSpecific( df, sampleId = "sampleId", block = "block", wells, div = "none", positional = FALSE, plateNum = 1, layout, mask = 0, techVars, randVars )
omixerSpecific( df, sampleId = "sampleId", block = "block", wells, div = "none", positional = FALSE, plateNum = 1, layout, mask = 0, techVars, randVars )
df |
Sample list |
sampleId |
String specifying sample ID variable |
block |
Paired sample identifier |
wells |
Number of wells on a plate |
div |
Plate subdivisions |
positional |
Logical indicator of positional batch effects |
plateNum |
Number of plates |
layout |
Custom plate layout as data frame |
mask |
Wells to be left empty |
techVars |
Technical covariates |
randVars |
Randomization variables |
Chosen layout as a data frame
library(tibble) library(forcats) library(stringr) sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"), sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), age=round(rnorm(48, mean=30, sd=8), 0), smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)), date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), by="day"), 48)) randVars <- c("sex", "age", "smoke", "date") omixerLayout <- omixerSpecific(sampleList, sampleId="sampleId", block="block", wells=48, div="row", plateNum=1, randVars=randVars)
library(tibble) library(forcats) library(stringr) sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"), sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), age=round(rnorm(48, mean=30, sd=8), 0), smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)), date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), by="day"), 48)) randVars <- c("sex", "age", "smoke", "date") omixerLayout <- omixerSpecific(sampleList, sampleId="sampleId", block="block", wells=48, div="row", plateNum=1, randVars=randVars)