affiXcanTrain: Train the model needed to impute a GReX for each gene

Description Usage Arguments Value Examples

View source: R/AffiXcan.R

Description

Train the model needed to impute a GReX for each gene

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
affiXcanTrain(
  exprMatrix,
  assay,
  tbaPaths,
  regionAssoc,
  cov = NULL,
  varExplained = 80,
  scale = TRUE,
  BPPARAM = bpparam(),
  kfold = 1
)

Arguments

exprMatrix

A SummarizedExperiment object containing expression data

assay

A string with the name of the object in SummarizedExperiment::assays(exprMatrix) that contains expression values

tbaPaths

A vector of strings, which are the paths to MultiAssayExperiment RDS files containing the tba values

regionAssoc

A data.frame with the association between regulatory regions and expressed genes and with colnames = c("REGULATORY_REGION", "EXPRESSED_REGION")

cov

Optional. A data.frame with covariates values for the population structure where the columns are the PCs and the rows are the individual IIDs Default is NULL

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

BPPARAM

A BiocParallelParam object. Default is bpparam(). For details on BiocParallelParam virtual base class see browseVignettes("BiocParallel")

kfold

An integer. The k definition of k-fold cross-validation on the training dataset. Default is 1. This argument controls the behavior of the function in the following way:

  • kfold<2: train the models on the whole dataset, not performing the cross-validation

  • kfold>=2: perform the k-fold cross-validation

Value

The output depends on the parameter kfold

If kfold<2: a list containing three objects: pca, bs, regionsCount

If kfold>=2: a list containing k-fold objects, named from 1 to kfold and corresponding to the different cross-validations [i]; each one of these objects is a list containing lists named as the expressed gene IDs [y] (i.e. the rownames() of the object in SummarizedExperiment::assays(exprMatrix) containing the expression values), for which a GReX could be imputed. Each of these inner lists contain two objects:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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, kfold=3)
}

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