Description Usage Arguments Details Value Examples
View source: R/rdi_functions.R
Method to convert RDI values to fold/percent change
1 | convertRDI(d, models = NULL, calcSD = FALSE)
|
d |
Distance matrix (as produced by calcRDI), or a vector of distances. |
models |
Set of RDI models, as produced by rdiModel. If |
calcSD |
logical; if |
The convertRDI function works by first generating a model for the RDI values at a given repertoire size and feature count using the rdiModel function (see that method's help file for more details). The RDI models predict the average log-fold/percent change across a range of RDI values, and allows us to convert RDI to a more stable and interpretable metric.
In addition to the average log-fold or percent change value, rdiModel also generates models for the standard deviation at each RDI value. This is useful for understanding the confidence intervals around the fold change estimate.
A list containing either one or two features:
pred | The converted predictions; same length as d . |
sd | If calcSD==T , a set of standard deviation estimates for each
prediction.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #create genes
genes = sample(letters, 10000, replace=TRUE)
#create sequence annotations
seqAnnot = data.frame(donor = sample(1:4, 10000, replace=TRUE))
#calculate RDI
d = rdi(genes, seqAnnot)
##convert RDI to actual 'lfc' estimates and compare
dtrue = convertRDI(d)$pred
plot(d, dtrue)
##look at SD ranges around lfc estimates
dtrue = convertRDI(d, calcSD=TRUE)
##plot using ggplot2
library(ggplot2)
x = as.numeric(d)
y = as.numeric(dtrue$pred)
sd = as.numeric(dtrue$sd)
qplot(x,y)+geom_errorbar(aes(x=x, ymin=y-sd, ymax=y+sd))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.