plotCompareP {variancePartition} | R Documentation |
Plot -log10 p-values from two analyses and color based on donor component from variancePartition analysis
plotCompareP(p1, p2, vpDonor, dupcorvalue, fraction = 0.2, xlabel = bquote(duplicateCorrelation ~ (-log[10] ~ p)), ylabel = bquote(dream ~ (-log[10] ~ p)))
p1 |
p-value from first analysis |
p2 |
p-value from second analysis |
vpDonor |
donor component for each gene from variancePartition analysis |
dupcorvalue |
scalar donor component from duplicateCorrelation |
fraction |
fraction of highest/lowest values to use for best fit lines |
xlabel |
for x-axis |
ylabel |
label for y-axis |
ggplot2 plot
# load library # library(variancePartition) # optional step to run analysis in parallel on multicore machines # Here, we used 4 threads library(doParallel) cl <- makeCluster(4) registerDoParallel(cl) # or by using the doSNOW package # load simulated data: # geneExpr: matrix of gene expression values # info: information/metadata about each sample data(varPartData) # Perform very simple analysis for demonstration # Analysis 1 form <- ~ Batch L = getContrast( geneExpr, form, info, "Batch3") fit = dream( geneExpr, form, info, L) fitEB = eBayes( fit ) res = topTable( fitEB, number=Inf ) # Analysis 2 form <- ~ Batch + (1|Tissue) L = getContrast( geneExpr, form, info, "Batch3") fit = dream( geneExpr, form, info, L) fitEB = eBayes( fit ) res2 = topTable( fitEB, number=Inf ) # Compare p-values plotCompareP( res$P.Value, res2$P.Value, runif(nrow(res)), .3 ) # stop cluster stopCluster(cl)