From 35e4ee4767c35c2436fea81788742641172ada37 Mon Sep 17 00:00:00 2001 From: Peter Carbonetto Date: Mon, 5 Jun 2017 07:17:23 -0500 Subject: Removed FORCE_FLOAT from varcov.h,varcov.cpp. --- src/varcov.cpp | 75 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 34 deletions(-) (limited to 'src/varcov.cpp') diff --git a/src/varcov.cpp b/src/varcov.cpp index 9d39c6c..48a4fc5 100644 --- a/src/varcov.cpp +++ b/src/varcov.cpp @@ -38,23 +38,14 @@ #include "lapack.h" #include "gzstream.h" - -#ifdef FORCE_FLOAT -#include "param_float.h" -#include "varcov_float.h" -#include "io_float.h" -#include "mathfunc_float.h" -#else #include "param.h" #include "varcov.h" #include "io.h" #include "mathfunc.h" -#endif using namespace std; -void VARCOV::CopyFromParam (PARAM &cPar) -{ +void VARCOV::CopyFromParam (PARAM &cPar) { d_pace=cPar.d_pace; file_bfile=cPar.file_bfile; @@ -75,15 +66,13 @@ void VARCOV::CopyFromParam (PARAM &cPar) return; } -void VARCOV::CopyToParam (PARAM &cPar) -{ +void VARCOV::CopyToParam (PARAM &cPar) { cPar.time_opt=time_opt; return; } void VARCOV::WriteCov (const int flag, const vector &snpInfo_sub, - const vector > &Cov_mat) -{ + const vector > &Cov_mat) { string file_cov; file_cov=path_out+"/"+file_out; file_cov+=".cor.txt"; @@ -103,7 +92,12 @@ void VARCOV::WriteCov (const int flag, const vector &snpInfo_sub, if (!outfile) {cout<<"error writing file: "< &snpInfo_sub, return; } -bool CompareSNPinfo (const SNPINFO &snpInfo1, const SNPINFO &snpInfo2) -{ +bool CompareSNPinfo (const SNPINFO &snpInfo1, const SNPINFO &snpInfo2) { int c_chr=snpInfo1.chr.compare(snpInfo2.chr); long int c_bp=snpInfo1.base_position-snpInfo2.base_position; @@ -149,14 +142,15 @@ bool CompareSNPinfo (const SNPINFO &snpInfo1, const SNPINFO &snpInfo2) // Do not sort SNPs (because gzip files do not support random access) -// then calculate n_nb, the number of neighbours, for each snp. -void VARCOV::CalcNB (vector &snpInfo_sort) -{ +// then calculate n_nb, the number of neighbours, for each SNP. +void VARCOV::CalcNB (vector &snpInfo_sort) { size_t t2=0, n_nb=0; for (size_t t=0; t &snpInfo_sort) t2=t+1; n_nb=0; - while (t2 &snpInfo_sort) } // Vector double is centered to have mean 0. -void Calc_Cor(vector > &X_mat, vector &cov_vec) -{ +void Calc_Cor(vector > &X_mat, vector &cov_vec) { cov_vec.clear(); double v1, v2, r; @@ -208,11 +214,12 @@ void Calc_Cor(vector > &X_mat, vector &cov_vec) // window_size (which can vary if cM was used) read bimbam mean // genotype file and calculate the covariance matrix for neighboring // SNPs output values at 10000-SNP-interval. -// -void VARCOV::AnalyzeBimbam () -{ +void VARCOV::AnalyzeBimbam () { igzstream infile (file_geno.c_str(), igzstream::in); - if (!infile) {cout<<"error reading genotype file:"< snpInfo_sub; @@ -299,8 +306,7 @@ void VARCOV::AnalyzeBimbam () return; } -void VARCOV::AnalyzePlink () -{ +void VARCOV::AnalyzePlink () { string file_bed=file_bfile+".bed"; ifstream infile (file_bed.c_str(), ios::binary); if (!infile) {cout<<"error reading bed file:"<