effectsArray2list: effectsArray2list

Description Usage Arguments Value Examples

View source: R/predCrossVar.R

Description

Converts an array of posterior samples of multi-trait marker effects to a named list (one for each trait).

Usage

1
effectsArray2list(effectsArray, snpIDs, traits, nIter, burnIn, thin)

Arguments

effectsArray

According to BGLR documentation: 3D array, with dim=c(nRow,p,traits), where nRow number of MCMC samples saved, p is the number of predictors and traits is the number of traits. BGLR::Multitrait() writes a binary file to disk when saveEffects=TRUE is specified. It can be read to R with BGLR::readBinMatMultitrait().

snpIDs

character vector with labels for the predictors (SNPs), numeric should work too, but untested.

traits

character vector to label the traits.

nIter

number of iterations used for MCMC; used internally only to exclude burn-in samples from computation

burnIn

burnIn for MCMC; used internally only to exclude burn-in samples from computation

thin

thin for MCMC; used internally only to exclude burn-in samples from computation

Value

list of matrices, one matrix per trait, each matrix has 'nrow((nIter-burnIn)/thin)' and 'ncol(length(snpIDs))'. Each element of the list is named with a string identifying the trait and the colnames of each matrix are labelled with snpIDs.

Examples

1
2
effectsArray<-BGLR::readBinMatMultitrait(filename = "mt_effects_ETA_g_beta.bin")
effectsArray<-effectsArray2list(effectsArray, snpIDs, traits, nIter, burnIn, thin)

wolfemd/predCrossVar documentation built on Dec. 21, 2020, 10:14 a.m.