DiffBind (version 2.0.2)

dba.plotPCA: PCA plot

Description

Principal Component Analysis plot

Usage

dba.plotPCA(DBA, attributes, minval, maxval, contrast, method=DBA$config$AnalysisMethod, th=DBA$config$th, bUsePval=DBA$config$bUsePval, report, score, bLog=TRUE, mask, sites, label, cor=FALSE, b3D=FALSE, vColors, dotSize, labelSize, labelCols, ...)

Arguments

DBA
DBA object.
attributes
attribute or vector of attributes to use to color plotted points. Each unique combination of attribute values will be assigned a color. Chosen from:

Note that DBA_GROUP is a special attribute which will result in samples from each group in a contrast being colored separately.

minval
Set all scores less than this to minval
maxval
Set all scores greater than this to maxval
contrast
number of contrast to use for PCA; if present, plots a PCA based on a differential binding affinity analysis (see dba.analyze). If mask is unspecified, only the samples in the contrast will be included. See dba.show(DBA, bContrast=T) to get contrast numbers. If missing, uses scores in the main binding matrix.
method
method used for analysis (used in conjunction with contrast):

th
significance threshold; all sites with FDR (or p-values, see bUsePval) less than or equal to this value will be included in the PCA, subject to maxVal. Used in conjunction with contrast.
bUsePval
if TRUE, uses p-value instead of FDR for thresholding. Used in conjunction with contrast.
report
report (obtained from dba.report) specifying the data to be used . If this is present, the method, th, and bUsePval parameters are ignored.
bLog
Logical indicating that log2 values should be used. Only applicable to read count scores (not peak scores).
mask
mask indicating a subset of peaksets to use when using global binding matrix scores. If a contrast is specified, these peaksets will be included, but only the significantly differentially bound sites (using th, bUsePval, and/or report) will be included. See dba.mask.
sites
logical vector indicating which sites to include in PCA. Only relevant when using global binding matrix (contrast is missing).
label
A metadata field to use as a label in 2D plots. The value for this field will be written directly onthe plot near the dot for each sample. Values can be any of those vlaid for the attributes parameter.
cor
a logical value indicating whether the calculation should use the correlation matrix or the covariance matrix. Passed into princomp.
b3D
logical indicating that three principal components should be plotted (requires package{rgl}). If FALSE, the first two principal components are plotted.
vColors
vector of custom colors; is absent, default colors will be used.
dotSize
size of dots to plot; is absent, a default will be calculated.
labelSize
Scaling factor for labels if present. Default is 0.8.
labelCols
Vector of colors to use for labels. Default is "black".
...
arguments passed to plot or plot3d (rgl).

Value

trellis plot from lattice package; see xyplot

Details

MODE: PCA plot using significantly differentially bound sites:

dba.plotPCA(DBA, attributes, minval, maxval, contrast, method, th, bUsePval, b3D=F, vColors, dotSize, ...)

MODE: PCA plot using global binding matrix:

dba.plotPCA(DBA, attributes, minval, maxval, mask, sites, b3D=F, vColors, dotSize, ...)

See Also

dba.analyze, dba.plotHeatmap

Examples

data(tamoxifen_peaks)

# peakcaller scores PCA
dba.plotPCA(tamoxifen)

# raw count correlation PCA
data(tamoxifen_analysis)
dba.plotPCA(tamoxifen)

#PCA based on normalized data for all sites
dba.plotPCA(tamoxifen,contrast=1,th=1)

#PCA based on DB sites only
p <- dba.plotPCA(tamoxifen,contrast=1)
p <- dba.plotPCA(tamoxifen,contrast=1,attributes=DBA_TISSUE)
p <- dba.plotPCA(tamoxifen,contrast=1,attributes=DBA_TISSUE,label=DBA_CONDITION)
p <- dba.plotPCA(tamoxifen,contrast=1,attributes=DBA_CONDITION,label=DBA_TISSUE)
p <- dba.plotPCA(tamoxifen,contrast=1,attributes=c(DBA_TISSUE,DBA_CONDITION),
                label=DBA_REPLICATE)