dba.plotPCA {DiffBind} | R Documentation

## 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,
               components=1:3, ...)

### 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: DBA_GROUP DBA_ID DBA_TISSUE DBA_FACTOR DBA_CONDITION DBA_TREATMENT DBA_REPLICATE DBA_CONSENSUS DBA_CALLER 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): DBA_DESEQ2 DBA_DESEQ2_BLOCK DBA_EDGER DBA_EDGER_BLOCK
`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.
`score` | Score to use for count data. Only used when plotting the global binding matrix (no contrast specified). One of: DBA_SCORE_READS DBA_SCORE_READS_MINUS DBA_SCORE_READS_FOLD DBA_SCORE_RPKM DBA_SCORE_RPKM_FOLD DBA_SCORE_TMM_READS_FULL DBA_SCORE_TMM_READS_EFFECTIVE DBA_SCORE_TMM_MINUS_FULL DBA_SCORE_TMM_MINUS_EFFECTIVE
`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".
`components` | Number(s) of the components to plot. Can be a vector of two or three component numbers, or a single integer. If an integer, that component, in addition to the succeeding one (`b3D=FALSE`) or two (`b3D=TRUE`) will be plotted.
`...` | arguments passed to plot or plot3d (rgl).

### 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, ...)

### Value

`trellis` plot from `lattice` package; see `xyplot`

### Note

uses rgl package for 3D plots (if available)

### Author(s)

Rory Stark

### 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)

[Package DiffBind version 2.16.2 Index]