From 3935ba39d30666dd7d4a831155631847c77b70c4 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 2 Aug 2017 08:46:58 +0000 Subject: Massive patch using LLVM coding style. It was generated with: clang-format -style=LLVM -i *.cpp *.h Please set your editor to replace tabs with spaces and use indentation of 2 spaces. --- src/lmm.h | 197 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 97 insertions(+), 100 deletions(-) (limited to 'src/lmm.h') diff --git a/src/lmm.h b/src/lmm.h index 9c3de9d..c393daf 100644 --- a/src/lmm.h +++ b/src/lmm.h @@ -19,120 +19,117 @@ #ifndef __LMM_H__ #define __LMM_H__ -#include "gsl/gsl_vector.h" #include "gsl/gsl_matrix.h" -#include "param.h" +#include "gsl/gsl_vector.h" #include "io.h" +#include "param.h" using namespace std; class FUNC_PARAM { public: - bool calc_null; - size_t ni_test; - size_t n_cvt; - const gsl_vector *eval; - const gsl_matrix *Uab; - const gsl_vector *ab; - size_t e_mode; + bool calc_null; + size_t ni_test; + size_t n_cvt; + const gsl_vector *eval; + const gsl_matrix *Uab; + const gsl_vector *ab; + size_t e_mode; }; class LMM { public: - // IO-related parameters - int a_mode; // Analysis mode: 1/2/3/4 for Frequentist tests. - size_t d_pace; // Display pace. - - string file_bfile; - string file_geno; - string file_out; - string path_out; - - string file_gene; - // WJA added - string file_oxford; - - // LMM related parameters - double l_min; - double l_max; - size_t n_region; - double l_mle_null; - double logl_mle_H0; - - // Summary statistics - size_t ni_total, ni_test; // Number of individuals. - size_t ns_total, ns_test; // Number of SNPs. - size_t ng_total, ng_test; // Number of genes. - size_t n_cvt; - double time_UtX; // Time spent on optimization iterations. - double time_opt; // Time spent on optimization iterations. - - // Indicator for individuals (phenotypes): 0 missing, 1 - // available for analysis. - vector indicator_idv; - - // Sequence indicator for SNPs: 0 ignored because of (a) maf, - // (b) miss, (c) non-poly; 1 available for analysis. - vector indicator_snp; - - vector snpInfo; // Record SNP information. - - // Not included in PARAM. - vector sumStat; // Output SNPSummary Data. - - // Main functions. - void CopyFromParam (PARAM &cPar); - void CopyToParam (PARAM &cPar); - void AnalyzeGene (const gsl_matrix *U, const gsl_vector *eval, - const gsl_matrix *UtW, const gsl_vector *Utx, - const gsl_matrix *W, const gsl_vector *x); - void AnalyzePlink (const gsl_matrix *U, const gsl_vector *eval, - const gsl_matrix *UtW, const gsl_vector *Uty, - const gsl_matrix *W, const gsl_vector *y); - // WJA added. - void Analyzebgen (const gsl_matrix *U, const gsl_vector *eval, - const gsl_matrix *UtW, const gsl_vector *Uty, - const gsl_matrix *W, const gsl_vector *y); - void AnalyzeBimbam (const gsl_matrix *U, const gsl_vector *eval, - const gsl_matrix *UtW, const gsl_vector *Uty, - const gsl_matrix *W, const gsl_vector *y); - void AnalyzePlinkGXE (const gsl_matrix *U, const gsl_vector *eval, - const gsl_matrix *UtW, const gsl_vector *Uty, - const gsl_matrix *W, const gsl_vector *y, - const gsl_vector *env); - void AnalyzeBimbamGXE (const gsl_matrix *U, const gsl_vector *eval, - const gsl_matrix *UtW, const gsl_vector *Uty, - const gsl_matrix *W, const gsl_vector *y, - const gsl_vector *env); - void WriteFiles (); - - void CalcRLWald (const double &lambda, const FUNC_PARAM ¶ms, - double &beta, double &se, double &p_wald); - void CalcRLScore (const double &l, const FUNC_PARAM ¶ms, - double &beta, double &se, double &p_score); + // IO-related parameters + int a_mode; // Analysis mode: 1/2/3/4 for Frequentist tests. + size_t d_pace; // Display pace. + + string file_bfile; + string file_geno; + string file_out; + string path_out; + + string file_gene; + // WJA added + string file_oxford; + + // LMM related parameters + double l_min; + double l_max; + size_t n_region; + double l_mle_null; + double logl_mle_H0; + + // Summary statistics + size_t ni_total, ni_test; // Number of individuals. + size_t ns_total, ns_test; // Number of SNPs. + size_t ng_total, ng_test; // Number of genes. + size_t n_cvt; + double time_UtX; // Time spent on optimization iterations. + double time_opt; // Time spent on optimization iterations. + + // Indicator for individuals (phenotypes): 0 missing, 1 + // available for analysis. + vector indicator_idv; + + // Sequence indicator for SNPs: 0 ignored because of (a) maf, + // (b) miss, (c) non-poly; 1 available for analysis. + vector indicator_snp; + + vector snpInfo; // Record SNP information. + + // Not included in PARAM. + vector sumStat; // Output SNPSummary Data. + + // Main functions. + void CopyFromParam(PARAM &cPar); + void CopyToParam(PARAM &cPar); + void AnalyzeGene(const gsl_matrix *U, const gsl_vector *eval, + const gsl_matrix *UtW, const gsl_vector *Utx, + const gsl_matrix *W, const gsl_vector *x); + void AnalyzePlink(const gsl_matrix *U, const gsl_vector *eval, + const gsl_matrix *UtW, const gsl_vector *Uty, + const gsl_matrix *W, const gsl_vector *y); + // WJA added. + void Analyzebgen(const gsl_matrix *U, const gsl_vector *eval, + const gsl_matrix *UtW, const gsl_vector *Uty, + const gsl_matrix *W, const gsl_vector *y); + void AnalyzeBimbam(const gsl_matrix *U, const gsl_vector *eval, + const gsl_matrix *UtW, const gsl_vector *Uty, + const gsl_matrix *W, const gsl_vector *y); + void AnalyzePlinkGXE(const gsl_matrix *U, const gsl_vector *eval, + const gsl_matrix *UtW, const gsl_vector *Uty, + const gsl_matrix *W, const gsl_vector *y, + const gsl_vector *env); + void AnalyzeBimbamGXE(const gsl_matrix *U, const gsl_vector *eval, + const gsl_matrix *UtW, const gsl_vector *Uty, + const gsl_matrix *W, const gsl_vector *y, + const gsl_vector *env); + void WriteFiles(); + + void CalcRLWald(const double &lambda, const FUNC_PARAM ¶ms, double &beta, + double &se, double &p_wald); + void CalcRLScore(const double &l, const FUNC_PARAM ¶ms, double &beta, + double &se, double &p_score); }; -void MatrixCalcLR (const gsl_matrix *U, const gsl_matrix *UtX, - const gsl_vector *Uty, const gsl_vector *K_eval, - const double l_min, const double l_max, - const size_t n_region, - vector > &pos_loglr); -void CalcLambda (const char func_name, FUNC_PARAM ¶ms, - const double l_min, const double l_max, - const size_t n_region, double &lambda, double &logf); -void CalcLambda (const char func_name, const gsl_vector *eval, - const gsl_matrix *UtW, const gsl_vector *Uty, - const double l_min, const double l_max, - const size_t n_region, double &lambda, double &logl_H0); -void CalcPve (const gsl_vector *eval, const gsl_matrix *UtW, - const gsl_vector *Uty, const double lambda, - const double trace_G, double &pve, double &pve_se); -void CalcLmmVgVeBeta (const gsl_vector *eval, const gsl_matrix *UtW, - const gsl_vector *Uty, const double lambda, double &vg, - double &ve, gsl_vector *beta, gsl_vector *se_beta); +void MatrixCalcLR(const gsl_matrix *U, const gsl_matrix *UtX, + const gsl_vector *Uty, const gsl_vector *K_eval, + const double l_min, const double l_max, const size_t n_region, + vector> &pos_loglr); +void CalcLambda(const char func_name, FUNC_PARAM ¶ms, const double l_min, + const double l_max, const size_t n_region, double &lambda, + double &logf); +void CalcLambda(const char func_name, const gsl_vector *eval, + const gsl_matrix *UtW, const gsl_vector *Uty, + const double l_min, const double l_max, const size_t n_region, + double &lambda, double &logl_H0); +void CalcPve(const gsl_vector *eval, const gsl_matrix *UtW, + const gsl_vector *Uty, const double lambda, const double trace_G, + double &pve, double &pve_se); +void CalcLmmVgVeBeta(const gsl_vector *eval, const gsl_matrix *UtW, + const gsl_vector *Uty, const double lambda, double &vg, + double &ve, gsl_vector *beta, gsl_vector *se_beta); #endif - - -- cgit v1.2.3