| getZScalesWithNTGuides | R Documentation |
Calculates scaling factors to calibrate element-wise Z-scores by repeatedly calculating a set of "null" Z-scores by repeatedly sampling the given numbers of non-targeting guides per element. This function is not normally used directly.
getZScalesWithNTGuides(ntData, uGuidesPerElement, mergeBy, ntSampleFold = 10)
ntData |
data.frame containing the data for the non-targeting guides |
uGuidesPerElement |
a unique vector of guide counts per element |
mergeBy |
a character vector containing the header(s) that demarcate the screen/experiment/replicate ID(s) |
ntSampleFold |
how many times to sample each non-targeting guide to make the Z score scale (defaults to 10) |
a data.frame containing a Z-score scaling factor, one for every number of guides and unique entry in mergeBy
fakeReadData = data.frame(id=rep(1:1000,2), expt=c(rep("e1",1000), rep("e2",1000)),
A=rpois(2000, lambda = 100), B=rpois(2000, lambda = 100),
C=rpois(2000, lambda = 100), D=rpois(2000, lambda = 100),
E=rpois(2000, lambda = 100), F=rpois(2000, lambda = 100),
NotSorted=rpois(2000, lambda = 100),
negControl = rep(rnorm(1000)>0,2), stringsAsFactors = FALSE)
expts = unique(fakeReadData["expt"]);
curSortBins = makeBinModel(data.frame(Bin = c("A","B","C","D","E","F"), fraction = rep(0.1,6)))
curSortBins = rbind(curSortBins, curSortBins) # duplicate and use same for both expts
curSortBins$expt = c(rep(expts$expt[1],6),rep(expts$expt[2],6))
guideHits = findGuideHitsAllScreens(experiments = expts, countDataFrame=fakeReadData,
binStats = curSortBins, unsortedBin = "NotSorted",
negativeControl="negControl")
guideZScales = getZScalesWithNTGuides(guideHits[guideHits$negControl,], uGuidesPerElement=1:10,
mergeBy=names(expts))
if(require("ggplot2")){
p=ggplot(guideZScales, aes(x=numGuides, y=Zscale, colour=expt))+geom_point()+geom_line();
print(p)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.