MuGen
Multitrait genetics
Public Member Functions | List of all members
BetaGrpPSR Class Reference

Single-SNP regression with partial effects. More...

#include <MuGen.h>

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

Public Member Functions

 BetaGrpPSR ()
 Default constructor.
 
 BetaGrpPSR (const string &predFlNam, const string &outFlNam, const size_t &Ndat, const size_t &Npred, const size_t &d, const int &Nthr)
 Constructor with no replication and \(p\)-values. More...
 
 BetaGrpPSR (const string &predFlNam, const string &outFlNam, RanIndex &low, const size_t &Npred, const size_t &d, const int &Nthr)
 Constructor with replication and \(p\)-values. More...
 
 BetaGrpPSR (const string &predFlNam, const string &outFlNam, const size_t &Ndat, const size_t &Npred, const size_t &d, const int &Nthr, const double &prVar)
 Constructor with no replication and ABF. More...
 
 BetaGrpPSR (const string &predFlNam, const string &outFlNam, RanIndex &low, const size_t &Npred, const size_t &d, const int &Nthr, const double &prVar)
 Constructor with replication and ABF. More...
 
 ~BetaGrpPSR ()
 Destructor.
 
 BetaGrpPSR (const BetaGrpPSR &mG)
 Copy constructor. More...
 
BetaGrpPSRoperator= (const BetaGrpPSR &mG)
 Assignment operator. More...
 
void dump ()
 Dump results to the output file. More...
 
- Public Member Functions inherited from BetaGrpSnp
 BetaGrpSnp ()
 Default constructor.
 
 BetaGrpSnp (const string &predFlNam, const string &outFlNam, const size_t &Ndat, const size_t &Npred, const size_t &d, const int &Nthr)
 Constructor with no replication and \(p\)-values. More...
 
 BetaGrpSnp (const string &predFlNam, const string &outFlNam, RanIndex &low, const size_t &Npred, const size_t &d, const int &Nthr)
 Constructor with replication and \(p\)-values. More...
 
 BetaGrpSnp (const string &predFlNam, const string &outFlNam, const size_t &Ndat, const size_t &Npred, const size_t &d, const int &Nthr, const double &prVar)
 Constructor with no replication and ABF. More...
 
 BetaGrpSnp (const string &predFlNam, const string &outFlNam, RanIndex &low, const size_t &Npred, const size_t &d, const int &Nthr, const double &prVar)
 Constructor with replication and ABF. More...
 
 ~BetaGrpSnp ()
 Destructor.
 
 BetaGrpSnp (const BetaGrpSnp &mG)
 Copy constructor. More...
 
BetaGrpSnpoperator= (const BetaGrpSnp &mG)
 Assignment operator. 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...
 

Additional Inherited Members

- Protected Member Functions inherited from Grp
 Grp ()
 
- Protected Attributes inherited from BetaGrpSnp
gsl_matrix * _Xmat
 SNP predictor matrix. 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.
 
double _numSaves
 Number of saves. 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.
 

Detailed Description

Single-SNP regression with partial effects.

Implements single-marker GWAS. Each trait is treated as a single response, and the other traits are added to the SNP as predictors. Only the SNP test is reported. No Hotelling-type mutivariate association test is performed, so the number of columns in the results matrix is the same as the number of traits. 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

◆ BetaGrpPSR() [1/5]

BetaGrpPSR::BetaGrpPSR ( const string &  predFlNam,
const string &  outFlNam,
const size_t &  Ndat,
const size_t &  Npred,
const size_t &  d,
const int &  Nthr 
)
inline

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

◆ BetaGrpPSR() [2/5]

BetaGrpPSR::BetaGrpPSR ( const string &  predFlNam,
const string &  outFlNam,
RanIndex low,
const size_t &  Npred,
const size_t &  d,
const int &  Nthr 
)
inline

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

◆ BetaGrpPSR() [3/5]

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

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

◆ BetaGrpPSR() [4/5]

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

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

◆ BetaGrpPSR() [5/5]

BetaGrpPSR::BetaGrpPSR ( const BetaGrpPSR mG)

Copy constructor.

Parameters
[in]BetaGrpPSR&object to be copied

Member Function Documentation

◆ dump()

void BetaGrpPSR::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 BetaGrpSnp.

◆ operator=()

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

Assignment operator.

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

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