findGuideHits: Calculate guide-level statistics for a single screen

View source: R/MAUDE.R

findGuideHitsR Documentation

Calculate guide-level statistics for a single screen

Description

Given a table of counts per guide/bin and a bin model for an experiment, calculate the optimal mean expression for each guide

Usage

findGuideHits(
  countTable,
  curBinBounds,
  pseudocount = 10,
  meanFunction = mean,
  sortBins = c("A", "B", "C", "D", "E", "F"),
  unsortedBin = "NS",
  negativeControl = "NT",
  limits = c(-4, 4)
)

Arguments

countTable

a table containing one column for each bin (A-F) and another column for non-targeting guide (logical-"NT"), and unsorted abundance (NS)

curBinBounds

a bin model as created by makeBinModel

pseudocount

the count to be added to each bin count, per 1e6 reads/bin total (default=10 pseudo reads per 1e6 reads total)

meanFunction

how to calculate the mean of the non-targeting guides for centering Z-scores. Defaults to 'mean'

sortBins

the names in countTable of the sorting bins. Defaults to c("A","B","C","D","E","F")

unsortedBin

the name in countTable of the unsorted bin. Defaults to "NS"

negativeControl

the name in countTable containing a logical representing whether or not the guide is non-Targeting (i.e. a negative control guide). Defaults to "NT"

limits

the limits to the mu optimization. Defaults to c(-4,4)

Value

a data.frame containing the guide-level statistics, including the Z score 'Z', log likelihood ratio 'llRatio', and estimated mean expression 'mean'.

Examples

curSortBins = makeBinModel(data.frame(Bin = c("A","B","C","D","E","F"), fraction = rep(0.1,6)))
fakeReadData = data.frame(id=1:1000, A=rpois(1000, lambda = 100), B=rpois(1000, lambda = 100),
                          C=rpois(1000, lambda = 100), D=rpois(1000, lambda = 100),
                          E=rpois(1000, lambda = 100), F=rpois(1000, lambda = 100),
                          NotSorted=rpois(1000, lambda = 100), negControl = rnorm(1000)>0)
guideHits = findGuideHits(fakeReadData, curSortBins, unsortedBin = "NotSorted", 
  negativeControl="negControl")
if(require("ggplot2")){
  p=ggplot(guideHits, aes(x=Z, colour=negControl))+geom_density(); print(p)
}

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