aboutsummaryrefslogtreecommitdiff
path: root/src/mvlmm.cpp
diff options
context:
space:
mode:
authorxiangzhou2016-07-24 15:58:31 -0400
committerxiangzhou2016-07-24 15:58:31 -0400
commit60f86db94ee2b4f826300cb0e73cb658ac7bdfd8 (patch)
tree4f3eeb1b0575493b8f29262a2acdc8f6a432633c /src/mvlmm.cpp
parentd222159e9629f50aed78b8ecc42faef33ee96e1a (diff)
downloadpangemma-60f86db94ee2b4f826300cb0e73cb658ac7bdfd8.tar.gz
version 0.95alpha
Diffstat (limited to 'src/mvlmm.cpp')
-rw-r--r--src/mvlmm.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/mvlmm.cpp b/src/mvlmm.cpp
index 7655b50..5deda06 100644
--- a/src/mvlmm.cpp
+++ b/src/mvlmm.cpp
@@ -3185,12 +3185,17 @@ void MVLMM::Analyzebgen (const gsl_matrix *U, const gsl_vector *eval, const gsl_
//start reading genotypes and analyze
- size_t csnp=0;
+ size_t csnp=0, t_last=0;
+ for (size_t t=0; t<indicator_snp.size(); ++t) {
+ if (indicator_snp[t]==0) {continue;}
+ t_last++;
+ }
for (size_t t=0; t<indicator_snp.size(); ++t) {
// if (t>1) {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();
@@ -3293,7 +3298,7 @@ void MVLMM::Analyzebgen (const gsl_matrix *U, const gsl_vector *eval, const gsl_
for (size_t i=0; i<ni_test; ++i) {
if (gsl_vector_get (x_miss, i)==0) {gsl_vector_set(x, i, x_mean);}
- geno=gsl_vector_get(x, i);
+ //geno=gsl_vector_get(x, i);
//if (x_mean>1) {
//gsl_vector_set(x, i, 2-geno);
//}
@@ -3310,7 +3315,7 @@ void MVLMM::Analyzebgen (const gsl_matrix *U, const gsl_vector *eval, const gsl_
gsl_vector_memcpy (&Xlarge_col.vector, x);
csnp++;
- if (csnp%msize==0 || t==indicator_snp.size()-1 ) {
+ if (csnp%msize==0 || c==t_last ) {
size_t l=0;
if (csnp%msize==0) {l=msize;} else {l=csnp%msize;}
@@ -3656,7 +3661,11 @@ void MVLMM::AnalyzeBimbam (const gsl_matrix *U, const gsl_vector *eval, const gs
gsl_matrix_memcpy (B_null, B);
//start reading genotypes and analyze
- size_t csnp=0;
+ size_t csnp=0, t_last=0;
+ for (size_t t=0; t<indicator_snp.size(); ++t) {
+ if (indicator_snp[t]==0) {continue;}
+ t_last++;
+ }
for (size_t t=0; t<indicator_snp.size(); ++t) {
//if (t>=1) {break;}
!safeGetline(infile, line).eof();
@@ -3705,7 +3714,7 @@ void MVLMM::AnalyzeBimbam (const gsl_matrix *U, const gsl_vector *eval, const gs
gsl_vector_memcpy (&Xlarge_col.vector, x);
csnp++;
- if (csnp%msize==0 || t==indicator_snp.size()-1 ) {
+ if (csnp%msize==0 || c==t_last ) {
size_t l=0;
if (csnp%msize==0) {l=msize;} else {l=csnp%msize;}
@@ -4068,7 +4077,11 @@ void MVLMM::AnalyzePlink (const gsl_matrix *U, const gsl_vector *eval, const gsl
b=ch[0];
}
- size_t csnp=0;
+ size_t csnp=0, t_last=0;
+ for (size_t t=0; t<indicator_snp.size(); ++t) {
+ if (indicator_snp[t]==0) {continue;}
+ t_last++;
+ }
for (vector<SNPINFO>::size_type t=0; t<snpInfo.size(); ++t) {
if (t%d_pace==0 || t==snpInfo.size()-1) {ProgressBar ("Reading SNPs ", t, snpInfo.size()-1);}
if (indicator_snp[t]==0) {continue;}
@@ -4135,7 +4148,7 @@ void MVLMM::AnalyzePlink (const gsl_matrix *U, const gsl_vector *eval, const gsl
gsl_vector_memcpy (&Xlarge_col.vector, x);
csnp++;
- if (csnp%msize==0 || t==indicator_snp.size()-1 ) {
+ if (csnp%msize==0 || c==t_last ) {
size_t l=0;
if (csnp%msize==0) {l=msize;} else {l=csnp%msize;}