Description Usage Arguments Value Examples

Perform a PCA on a matrix where columns are variables

1 | ```
computePca(data, varExplained = 80, scale = TRUE)
``` |

`data` |
A matrix containing the TBA values for a certain genomic region; columns are PWMs, rows are individuals IIDs |

`varExplained` |
An integer between 0 and 100; varExplained=80 means that the principal components selected to fit the models must explain at least 80 percent of variation of TBA values; default is 80 |

`scale` |
A logical; if scale=FALSE the TBA values will be only centered, not scaled before performing PCA; default is TRUE |

A list containing two objects:

eigenvectors: A matrix containing eigenvectors for those principal components selected according to the param varExplained

pcs: A matrix containing the principal components values selected according to the param varExplained

eigenvalues: A vector containing eigenvalues for those principal components selected according to the param varExplained

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
if (interactive()) {
data(exprMatrix)
sampleNames <- colnames(exprMatrix)
nSamples <- length(sampleNames)
sampGroups <- subsetKFold(k=3, n=nSamples)
for (i in seq(length(sampGroups))) {
sampGroups[[i]] <- colnames(exprMatrix)[sampGroups[[i]]]
}
testingSamples <- sampGroups[[i]]
trainingSamples <- sampleNames[!sampleNames %in% testingSamples]
tbaMatrixMAE <- readRDS(system.file("extdata","training.tba.toydata.rds",
package="AffiXcan"))
tbaMatrixMAE <- MultiAssayExperiment::subsetByRow(tbaMatrixMAE,
trainingSamples)
tbaMatrix <- MultiAssayExperiment::experiments(tbaMatrixMAE)
tba <- tbaMatrix$ENSG00000256377.1
pca <- computePca(data=tba, varExplained=80, scale=TRUE)
}
``` |

AffiXcan documentation built on Nov. 8, 2020, 8:07 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.