diff options
-rw-r--r-- | src/io.cpp | 15 | ||||
-rw-r--r-- | src/io.h | 6 | ||||
-rw-r--r-- | src/param.cpp | 8 | ||||
-rwxr-xr-x | test/dev_test_suite.sh | 4 |
4 files changed, 18 insertions, 15 deletions
@@ -608,7 +608,7 @@ bool ReadFile_geno(const string &file_geno, const set<string> &setSnps, const double &r2_level, map<string, string> &mapRS2chr, map<string, long int> &mapRS2bp, map<string, double> &mapRS2cM, vector<SNPINFO> &snpInfo, - size_t &ns_test) { + size_t &ns_test, bool debug) { indicator_snp.clear(); snpInfo.clear(); @@ -679,10 +679,11 @@ bool ReadFile_geno(const string &file_geno, const set<string> &setSnps, } if (mapRS2bp.count(rs) == 0) { - std::string msg = "Can't figure out position for "; - msg += rs; - debug_msg(msg); - + if (debug) { + std::string msg = "Can't figure out position for "; + msg += rs; + debug_msg(msg); + } chr = "-9"; b_pos = -9; cM = -9; @@ -1633,7 +1634,7 @@ bool PlinkKin(const string &file_bed, vector<int> &indicator_snp, // genotype and calculate K. bool ReadFile_geno(const string file_geno, vector<int> &indicator_idv, vector<int> &indicator_snp, gsl_matrix *UtX, gsl_matrix *K, - const bool calc_K) { + const bool calc_K, bool debug) { igzstream infile(file_geno.c_str(), igzstream::in); if (!infile) { cout << "error reading genotype file:" << file_geno << endl; @@ -1737,7 +1738,7 @@ bool ReadFile_geno(const string &file_geno, vector<int> &indicator_idv, vector<int> &indicator_snp, vector<vector<unsigned char>> &Xt, gsl_matrix *K, const bool calc_K, const size_t ni_test, - const size_t ns_test) { + const size_t ns_test, bool debug) { igzstream infile(file_geno.c_str(), igzstream::in); if (!infile) { cout << "error reading genotype file:" << file_geno << endl; @@ -64,7 +64,7 @@ bool ReadFile_geno(const string &file_geno, const set<string> &setSnps, const double &r2_level, map<string, string> &mapRS2chr, map<string, long int> &mapRS2bp, map<string, double> &mapRS2cM, vector<SNPINFO> &snpInfo, - size_t &ns_test); + size_t &ns_test, bool debug); bool ReadFile_bed(const string &file_bed, const set<string> &setSnps, const gsl_matrix *W, vector<int> &indicator_idv, vector<int> &indicator_snp, vector<SNPINFO> &snpInfo, @@ -94,7 +94,7 @@ bool PlinkKin(const string &file_bed, vector<int> &indicator_snp, bool ReadFile_geno(const string file_geno, vector<int> &indicator_idv, vector<int> &indicator_snp, gsl_matrix *UtX, gsl_matrix *K, - const bool calc_K); + const bool calc_K, bool debug); bool ReadFile_bed(const string &file_bed, vector<int> &indicator_idv, vector<int> &indicator_snp, gsl_matrix *UtX, gsl_matrix *K, const bool calc_K); @@ -102,7 +102,7 @@ bool ReadFile_geno(const string &file_geno, vector<int> &indicator_idv, vector<int> &indicator_snp, vector<vector<unsigned char>> &Xt, gsl_matrix *K, const bool calc_K, const size_t ni_test, - const size_t ns_test); + const size_t ns_test, bool debug); bool ReadFile_bed(const string &file_bed, vector<int> &indicator_idv, vector<int> &indicator_snp, vector<vector<unsigned char>> &Xt, gsl_matrix *K, const bool calc_K, const size_t ni_test, diff --git a/src/param.cpp b/src/param.cpp index c81eaf5..dce55e0 100644 --- a/src/param.cpp +++ b/src/param.cpp @@ -337,7 +337,7 @@ void PARAM::ReadFiles(void) { trim_individuals(indicator_cvt, ni_max, mode_debug); if (ReadFile_geno(file_geno, setSnps, W, indicator_idv, indicator_snp, maf_level, miss_level, hwe_level, r2_level, mapRS2chr, - mapRS2bp, mapRS2cM, snpInfo, ns_test) == false) { + mapRS2bp, mapRS2cM, snpInfo, ns_test, mode_debug) == false) { error = true; } gsl_matrix_free(W); @@ -445,7 +445,7 @@ void PARAM::ReadFiles(void) { while (!safeGetline(infile, file_name).eof()) { if (ReadFile_geno(file_name, setSnps, W, indicator_idv, indicator_snp, maf_level, miss_level, hwe_level, r2_level, mapRS2chr, - mapRS2bp, mapRS2cM, snpInfo, ns_test_tmp) == false) { + mapRS2bp, mapRS2cM, snpInfo, ns_test_tmp, mode_debug) == false) { error = true; } @@ -1338,7 +1338,7 @@ void PARAM::ReadGenotypes(gsl_matrix *UtX, gsl_matrix *K, const bool calc_K) { } } else { if (ReadFile_geno(file_geno, indicator_idv, indicator_snp, UtX, K, - calc_K) == false) { + calc_K, mode_debug) == false) { error = true; } } @@ -1358,7 +1358,7 @@ void PARAM::ReadGenotypes(vector<vector<unsigned char>> &Xt, gsl_matrix *K, } } else { if (ReadFile_geno(file_geno, indicator_idv, indicator_snp, Xt, K, calc_K, - ni_test, ns_test) == false) { + ni_test, ns_test, mode_debug) == false) { error = true; } } diff --git a/test/dev_test_suite.sh b/test/dev_test_suite.sh index 67d9cba..9e49251 100755 --- a/test/dev_test_suite.sh +++ b/test/dev_test_suite.sh @@ -24,7 +24,8 @@ testBXDStandardRelatednessMatrixK() { -c ../example/BXD_covariates2.txt \ -a ../example/BXD_snps.txt \ -gk \ - -debug -o $outn + -debug \ + -o $outn assertEquals 0 $? outfn=output/$outn.cXX.txt assertEquals "198" `wc -l < $outfn` @@ -38,6 +39,7 @@ testBXDMultivariateLinearMixedModel() { -a ../example/BXD_snps.txt \ -k ./output/BXD.cXX.txt \ -lmm 2 -maf 0.1 \ + -debug \ -o BXD_mvlmm assertEquals 0 $? |