MuGen
Multitrait genetics
Public Member Functions | Protected Attributes | List of all members
BetaGrpSnpMiss Class Reference

Simple single-SNP regression class with missing data. More...

#include <MuGen.h>

Inheritance diagram for BetaGrpSnpMiss:
[legend]
Collaboration diagram for BetaGrpSnpMiss:
[legend]

Public Member Functions

 BetaGrpSnpMiss ()
 Default constructor.
 
 BetaGrpSnpMiss (const string &predFlNam, const string &outFlNam, const size_t &Ndat, const size_t &Npred, const size_t &d, const int &Nthr, const double &absLab)
 Constructor with no replication and \(p\)-values. More...
 
 BetaGrpSnpMiss (const string &predFlNam, const string &outFlNam, RanIndex &low, const size_t &Npred, const size_t &d, const int &Nthr, const double &absLab)
 Constructor with replication and \(p\)-values. More...
 
 BetaGrpSnpMiss (const string &predFlNam, const string &outFlNam, const size_t &Ndat, const size_t &Npred, const size_t &d, const int &Nthr, const double &prVar, const double &absLab)
 Constructor with no replication and ABF. More...
 
 BetaGrpSnpMiss (const string &predFlNam, const string &outFlNam, RanIndex &low, const size_t &Npred, const size_t &d, const int &Nthr, const double &prVar, const double &absLab)
 Constructor with replication and ABF. More...
 
 ~BetaGrpSnpMiss ()
 Destructor.
 
 BetaGrpSnpMiss (const BetaGrpSnpMiss &mG)
 Copy constructor. More...
 
BetaGrpSnpMissoperator= (const BetaGrpSnpMiss &mG)
 Assignment operator. More...
 
virtual void dump ()
 Dump results to the output file. More...
 
const gsl_matrix * fMat () const
 Access adjusted fitted value matrix. More...
 
void update (const Grp &dat, const SigmaI &SigIm)
 Response update function. More...
 
- Public Member Functions inherited from MuGrp
 MuGrp ()
 Default constructor.
 
 MuGrp (RanIndex &low, const size_t &d)
 Deterministic zero-value constructor. More...
 
 MuGrp (const string &datFlNam, RanIndex &low, RanIndex &up, const size_t &d)
 Constructor with data from file. More...
 
 MuGrp (const string &datFlNam, RanIndex &up, const size_t &d)
 Constructor with data from file and no lower level. More...
 
 MuGrp (const vector< MVnorm * > &dat, RanIndex &low, RanIndex &up)
 Constructor with a vector of MVnorm pointers. More...
 
 MuGrp (const Grp &dat, RanIndex &low, RanIndex &up)
 Constructor with a Grp object. More...
 
 MuGrp (const vector< MVnorm * > &dat, RanIndex &low, RanIndex &up, const string &outFlNam)
 Constructor with a vector of MVnorm pointers and output file name. More...
 
 MuGrp (const Grp &dat, RanIndex &low, RanIndex &up, const string &outFlNam)
 Constructor with a Grp object and output file name. More...
 
 MuGrp (const Grp &dat, RanIndex &low)
 Deterministic mean constructor. More...
 
 MuGrp (const Grp &dat, const Qgrp &q, RanIndex &low)
 Deterministic weighted mean constructor. More...
 
 MuGrp (const gsl_matrix *dat)
 Deterministic constructor with a GSL matrix. More...
 
 MuGrp (const gsl_matrix *dat, RanIndex &low)
 Deterministic GSL matrix mean constructor. More...
 
 MuGrp (const gsl_matrix *dat, const Qgrp &q, RanIndex &low)
 Deterministic GSL matrix weighted mean constructor. More...
 
virtual ~MuGrp ()
 Destructor.
 
 MuGrp (const MuGrp &mG)
 Copy constructor. More...
 
 MuGrp (const Grp &g)
 Copy constructor. More...
 
MuGrpoperator= (const MuGrp &mG)
 Assignemnt operator. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm)
 Student- \(t\) likelihood, improper prior. More...
 
virtual void update (const Grp &dat, const SigmaI &SigIm, const SigmaI &SigIp)
 Gaussian likelihood, 0-mean Gaussian prior. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const SigmaI &SigIp)
 Student- \(t\) likelihood, 0-mean Gaussian prior. More...
 
virtual void update (const Grp &dat, const SigmaI &SigIm, const Qgrp &qPr, const SigmaI &SigIp)
 Gaussian likelihood, 0-mean Student- \(t\) prior. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const Qgrp &qPr, const SigmaI &SigIp)
 Student- \(t\) likelihood, 0-mean Student- \(t\) prior. More...
 
virtual void update (const Grp &dat, const SigmaI &SigIm, const Grp &muPr, const SigmaI &SigIp)
 Gaussian likelihood, non-zero mean Gaussian prior. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const Grp &muPr, const SigmaI &SigIp)
 Student- \(t\) likelihood, non-zero mean Gaussian prior. More...
 
virtual void update (const Grp &dat, const SigmaI &SigIm, const Grp &muPr, const Qgrp &qPr, const SigmaI &SigIp)
 Gaussian likelihood, non-zero mean Student- \(t\) prior. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const Grp &muPr, const Qgrp &qPr, const SigmaI &SigIp)
 Student- \(t\) likelihood, non-zero mean Student- \(t\) prior. More...
 
- Public Member Functions inherited from Grp
virtual ~Grp ()
 Destructor.
 
virtual void save ()
 Save to pre-specified file. More...
 
virtual void save (const string &outFlNam)
 Save to file. More...
 
virtual void save (const string &outMuFlNam, const string &outSigFlNam, const SigmaI &SigI)
 Joint save. More...
 
virtual void save (const SigmaI &SigI)
 Save with inverse-covariance. More...
 
virtual void save (const Grp &y, const SigmaI &SigI)
 Save with data and inverse-covariance. More...
 
void mhlSave (const string &outFlNam, const SigmaI SigI)
 Save Mahalanobis distance. More...
 
const vector< MVnorm * > & dataVec () const
 Get vector of row pointers. More...
 
virtual const gsl_matrix * dMat () const
 Access the value matrix. More...
 
const size_t Ndata () const
 Get number of rows. More...
 
const size_t phenD () const
 Get number of traits. More...
 
virtual double lnOddsRat (const Grp &y, const SigmaI &SigI, const size_t i) const
 Log-odds ratio. More...
 
const MVnormoperator[] (const size_t i) const
 Subscript operator. More...
 
MVnormoperator[] (const size_t i)
 Subscript operator. More...
 
virtual MuGrp mean (RanIndex &grp)
 Group mean. More...
 
virtual const MuGrp mean (RanIndex &grp) const
 Group mean. More...
 
virtual MuGrp mean (RanIndex &grp, const Qgrp &q)
 Group weighted mean. More...
 
virtual const MuGrp mean (RanIndex &grp, const Qgrp &q) const
 Group weighted mean. More...
 
void center ()
 Center the value matrix. More...
 

Protected Attributes

vector< vector< double > > _Xmat
 Predictor array. More...
 
gsl_matrix * _fakeFmat
 Matrix for addition operators. More...
 
gsl_matrix * _Ystore
 Response storage. More...
 
size_t _Npred
 Number of predictors (SNPs)
 
int _nThr
 Number of threads to use.
 
double _numSaves
 Number of saves. More...
 
double _absLab
 Missing value label. More...
 
double _priorVar
 Prior variance. More...
 
string _inPredFl
 Predictor (SNP) file name.
 
- Protected Attributes inherited from Grp
vector< MVnorm * > _theta
 Vector of pointers to value rows. More...
 
gsl_matrix * _valueMat
 Value matrix. More...
 
RanIndex_lowLevel
 Lower level index. More...
 
RanIndex_upLevel
 Upper level index. More...
 
vector< gsl_rng * > _rV
 Vector of PNG pointers. More...
 
string _outFlNam
 Name of the output file.
 

Additional Inherited Members

- Protected Member Functions inherited from Grp
 Grp ()
 

Detailed Description

Simple single-SNP regression class with missing data.

Implements single-marker GWAS with missing genotypes. Rows with missing genotypes are dropped. Each trait is treated separately, including the variances (i.e., \( \widehat{\sigma}^2_p = \widehat{\boldsymbol{\Sigma}}_{p,p} \)). However, in addition to the single-trait tests an extra Hotelling-type mutivariate association test is performed. This multivariate test reflects the distance of the whole vector of trait effects to zero, potentially increasing the power to detect pleiotropic SNPs with moderate effects on mutiple traits. The saved value matrix thus has one extra column for this test. The output is either \( -\log_{10}p \), (although this statistic is not strictly a frequentist \(p\)-value, it performs very similarly in simulations), or Wakefield's [wakefield07] approximation of \( -ln BF \) (log-Bayes factor ratio). In the latter case, the user can set the prior variance manually. The SNP regression is performed on the point estimate of a response, as described in documentation of the update() and dump() functions. The latter can be, say, a residual of a mixed-model type GEBV estimate done to control population structure.

Constructor & Destructor Documentation

◆ BetaGrpSnpMiss() [1/5]

BetaGrpSnpMiss::BetaGrpSnpMiss ( const string &  predFlNam,
const string &  outFlNam,
const size_t &  Ndat,
const size_t &  Npred,
const size_t &  d,
const int &  Nthr,
const double &  absLab 
)

Constructor with no replication and \(p\)-values.

Initializes the object with no replication (i.e., the number of rows in the predictor is the same as in the response) and leaves the prior variance for SNP regressions at zero, thereby resulting in a dump of \( -\log_{10}p \) values.

Parameters
[in]string&predictor file name
[in]string&output file name
[in]size_t&number of rows in the response matrix
[in]size_t&number of predictors
[in]size_t&number of traits
[in]int&number of threads
[in]double&missing value label

◆ BetaGrpSnpMiss() [2/5]

BetaGrpSnpMiss::BetaGrpSnpMiss ( const string &  predFlNam,
const string &  outFlNam,
RanIndex low,
const size_t &  Npred,
const size_t &  d,
const int &  Nthr,
const double &  absLab 
)

Constructor with replication and \(p\)-values.

Initializes the object with replication, encoded with the given index, and leaves the prior variance for SNP regressions at zero, thereby resulting in a dump of \( -\log_{10}p \) values.

Parameters
[in]string&predictor file name
[in]string&output file name
[in]RanIndex&replicate index
[in]size_t&number of predictors
[in]size_t&number of traits
[in]int&number of threads
[in]double&missing value label

◆ BetaGrpSnpMiss() [3/5]

BetaGrpSnpMiss::BetaGrpSnpMiss ( const string &  predFlNam,
const string &  outFlNam,
const size_t &  Ndat,
const size_t &  Npred,
const size_t &  d,
const int &  Nthr,
const double &  prVar,
const double &  absLab 
)

Constructor with no replication and ABF.

Initializes the object with no replication (i.e., the number of rows in the predictor is the same as in the response) and sets the prior variance for SNP regressions to the given value, therefore dumping Wakefield's log of approximate Bayes factor (ABF) ratios to the output file.

Parameters
[in]string&predictor file name
[in]string&output file name
[in]size_t&number of rows in the response matrix
[in]size_t&number of predictors
[in]size_t&number of traits
[in]int&number of threads
[in]double&prior variance
[in]double&missing value label

◆ BetaGrpSnpMiss() [4/5]

BetaGrpSnpMiss::BetaGrpSnpMiss ( const string &  predFlNam,
const string &  outFlNam,
RanIndex low,
const size_t &  Npred,
const size_t &  d,
const int &  Nthr,
const double &  prVar,
const double &  absLab 
)

Constructor with replication and ABF.

Initializes the object with replication, encoded with the given index, and sets the prior variance for SNP regressions to the given value, therefore dumping Wakefield's log of approximate Bayes factor (ABF) ratios to the output file.

Parameters
[in]string&predictor file name
[in]string&output file name
[in]RanIndex&replicate index
[in]size_t&number of predictors
[in]size_t&number of traits
[in]int&number of threads
[in]double&prior variance
[in]double&missing value label

◆ BetaGrpSnpMiss() [5/5]

BetaGrpSnpMiss::BetaGrpSnpMiss ( const BetaGrpSnpMiss mG)

Copy constructor.

Parameters
[in]BetaGrpSnpMiss&object to be copied

Member Function Documentation

◆ dump()

void BetaGrpSnpMiss::dump ( )
virtual

Dump results to the output file.

The predictor (SNP) file is read by this function, and the single-predictor regression (i.e., each predictor is tested separately, ignoring all others) is performed. The results are saved to the pre-specified output file.

Reimplemented from Grp.

Reimplemented in BetaGrpPSRmiss, and BetaGrpSnpMissCV.

◆ fMat()

const gsl_matrix* BetaGrpSnpMiss::fMat ( ) const
inlinevirtual

Access adjusted fitted value matrix.

Returns
gsl_matrix* pointer to a zero-valued matrix

Reimplemented from Grp.

◆ operator=()

BetaGrpSnpMiss & BetaGrpSnpMiss::operator= ( const BetaGrpSnpMiss mG)

Assignment operator.

Parameters
[in]BetaGrpSnpMiss&object to be copied
Returns
BetaGrpSnpMiss& target object

Member Data Documentation

◆ _absLab

double BetaGrpSnpMiss::_absLab
protected

Missing value label.

Value that labels the missing genotypes (predictors). Provided by the user.

◆ _fakeFmat

gsl_matrix* BetaGrpSnpMiss::_fakeFmat
protected

Matrix for addition operators.

This matrix is addressed by fMat() and set to all zero values, so that if this object is in an addition/subtraction operator things don't break. Because this object operates outside of the regular Markov chains, on the residuals of the model, it ordinarily makes no sense to add or subtract it from anything.

◆ _numSaves

double BetaGrpSnpMiss::_numSaves
protected

Number of saves.

Number of times the response samples have been saved.

◆ _priorVar

double BetaGrpSnpMiss::_priorVar
protected

Prior variance.

Prior variance for Wakefield's [wakefield07] ABF calculation (Wakefield's notation for it is \(W\)). If it zero, \( -\log_{10}p \) are calculated.

◆ _Xmat

vector< vector<double> > BetaGrpSnpMiss::_Xmat
protected

Predictor array.

The outer vector is the same length as the number of predictors. Each constituent vector stores only the non-missing genotypes.

◆ _Ystore

gsl_matrix* BetaGrpSnpMiss::_Ystore
protected

Response storage.

MCMC samples from a response variable (representing a residual of the model) are stored here and divided by the total number of saves at the end before the regression is performed.


The documentation for this class was generated from the following files: