makeBinModel: Create a bin model for a single experiment

View source: R/MAUDE.R

makeBinModelR Documentation

Create a bin model for a single experiment

Description

Provided with the fractions captured by each bin, creates a bin model for use with MAUDE analysis, assuming 3 contiguous bins on the tails of the distribution. You can easily remove or rename bins after they have been created with this function. An example is provided in the BACH2 Vignette.

Usage

makeBinModel(curBinBounds, tailP = 0.001)

Arguments

curBinBounds

a data.frame containing two columns: Bin (must be A,B,C,D,E,F), and fraction (the fractions of the total captured by each bin)

tailP

the fraction of the tails of the distribution not captured in any bin (defaults to 0.001)

Value

returns a data.frame with additional columns including the bin starts and ends in Z-score space, and in quantile space.

Examples

#generally, the bin bounds are retrieved from the FACS data
binBounds = makeBinModel(data.frame(Bin=c("A","B","C","D","E","F"), fraction=rep(0.1,6))) 
if(require("ggplot2")){
  p = ggplot() + 
    geom_vline(xintercept= sort(unique(c(binBounds$binStartZ, binBounds$binEndZ))),colour="gray")+
    theme_classic() + xlab("Target expression") + 
    geom_segment(data=binBounds, aes(x=binStartZ, xend=binEndZ, colour=Bin, y=0, yend=0), 
      size=5, inherit.aes = FALSE); 
  print(p)
}

Carldeboer/MAUDE documentation built on March 27, 2022, 8:50 p.m.