computePcs: Compute a matrix product between variables and eigenvectors

Description Usage Arguments Value Examples

View source: R/AffiXcan.R

Description

Compute a matrix product between variables and eigenvectors

Usage

1
computePcs(region, tbaMatrix, scale, pca)

Arguments

region

A string, which is the name of the object in the list MultiAssayExperiment::experiments(tbaMatrix) that contains the TBA values of the genomic region of interest (see the param tbaMatrix)

tbaMatrix

A MultiAssayExperiment object containing the TBA values

scale

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

pca

The returningObject$pca from affiXcanTrain()

Value

A data.frame containing the principal components values of the TBA in a certain genomic region, as the result of the matrix product between the TBA values and the eigenvectors

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
if (interactive()) {
trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
package="AffiXcan")

data(exprMatrix)
data(regionAssoc)
data(trainingCovariates)

assay <- "values"

training <- affiXcanTrain(exprMatrix=exprMatrix, assay=assay,
tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc, cov=trainingCovariates,
varExplained=80, scale=TRUE)

region <- "ENSG00000256377.1"

tbaMatrixMAE <- readRDS(system.file("extdata","training.tba.toydata.rds",
package="AffiXcan"))

pca <- training$pca
pcs <- computePcs(region=region, tbaMatrix=tbaMatrixMAE, scale=TRUE, pca=pca)
}

alussana/AffiXcan documentation built on Oct. 20, 2020, 12:08 a.m.