From 60f86db94ee2b4f826300cb0e73cb658ac7bdfd8 Mon Sep 17 00:00:00 2001 From: xiangzhou Date: Sun, 24 Jul 2016 15:58:31 -0400 Subject: version 0.95alpha --- src/lmm.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/lmm.cpp') diff --git a/src/lmm.cpp b/src/lmm.cpp index af6ff8a..044f33c 100644 --- a/src/lmm.cpp +++ b/src/lmm.cpp @@ -1243,7 +1243,11 @@ void LMM::AnalyzeBimbam (const gsl_matrix *U, const gsl_vector *eval, const gsl_ // } //start reading genotypes and analyze - size_t c=0; + size_t c=0, t_last=0; + for (size_t t=0; t1) {break;} !safeGetline(infile, line).eof(); @@ -1275,7 +1279,7 @@ void LMM::AnalyzeBimbam (const gsl_matrix *U, const gsl_vector *eval, const gsl_ for (size_t i=0; i1) { // gsl_vector_set(x, i, 2-geno); //} @@ -1292,7 +1296,7 @@ void LMM::AnalyzeBimbam (const gsl_matrix *U, const gsl_vector *eval, const gsl_ gsl_vector_memcpy (&Xlarge_col.vector, x); c++; - if (c%msize==0 || t==indicator_snp.size()-1 ) { + if (c%msize==0 || c==t_last) { size_t l=0; if (c%msize==0) {l=msize;} else {l=c%msize;} @@ -1332,12 +1336,14 @@ void LMM::AnalyzeBimbam (const gsl_matrix *U, const gsl_vector *eval, const gsl_ p_lrt=gsl_cdf_chisq_Q (2.0*(logl_H1-logl_mle_H0), 1); } + //if (p_wald<0) {cout<1) {beta*=-1;} time_opt+=(clock()-time_start)/(double(CLOCKS_PER_SEC)*60.0); //store summary data SUMSTAT SNPs={beta, se, lambda_remle, lambda_mle, p_wald, p_lrt, p_score}; + sumStat.push_back(SNPs); } } @@ -1412,7 +1418,11 @@ void LMM::AnalyzePlink (const gsl_matrix *U, const gsl_vector *eval, const gsl_m b=ch[0]; } - size_t c=0; + size_t c=0, t_last=0; + for (size_t t=0; t::size_type t=0; t1) {break;} if (t%d_pace==0 || t==(ns_total-1)) {ProgressBar ("Reading SNPs ", t, ns_total-1);} + if (indicator_snp[t]==0) {continue;} // read SNP header id.clear(); rs.clear(); @@ -1737,7 +1752,7 @@ void LMM::Analyzebgen (const gsl_matrix *U, const gsl_vector *eval, const gsl_ma gsl_vector_memcpy (&Xlarge_col.vector, x); c++; - if (c%msize==0 || t==indicator_snp.size()-1 ) { + if (c%msize==0 || c==t_last ) { size_t l=0; if (c%msize==0) {l=msize;} else {l=c%msize;} -- cgit v1.2.3