[Genabel-commits] r1689 - pkg/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Apr 14 22:19:03 CEST 2014
Author: maartenk
Date: 2014-04-14 22:19:03 +0200 (Mon, 14 Apr 2014)
New Revision: 1689
Modified:
pkg/ProbABEL/src/gendata.cpp
Log:
removed some old non functional code
Modified: pkg/ProbABEL/src/gendata.cpp
===================================================================
--- pkg/ProbABEL/src/gendata.cpp 2014-04-11 09:26:28 UTC (rev 1688)
+++ pkg/ProbABEL/src/gendata.cpp 2014-04-14 20:19:03 UTC (rev 1689)
@@ -253,7 +253,6 @@
}
std::string tmpid, tmpstr;
- char inStr[8];
int k = 0;
for (unsigned int i = 0; i < npeople; i++)
@@ -290,58 +289,11 @@
infile >> tmpstr;
}
- int oldstyle = 0;
- if (oldstyle == 1)
- {
- for (unsigned int j = 0; j < (nsnps * ngpreds); j++)
- {
- if (infile.good())
- {
- infile >> inStr;
- // tmpstr contains the dosage/probability in
- // string form. Convert it to double (if tmpstr is
- // NaN it will be set to nan).
- double dosage;
- char *endptr;
- errno = 0; // To distinguish success/failure
- // after strtod()
+ std::string all_numbers;
+ all_numbers.reserve(nsnps * ngpreds * 7);
+ std::getline(infile, all_numbers);
+ mldose_line_to_matrix(k, all_numbers.c_str(), nsnps * ngpreds);
- dosage = strtod(inStr, &endptr);
- if ((errno == ERANGE
- && (dosage == HUGE_VALF || dosage == HUGE_VALL))
- || (errno != 0 && dosage == 0))
- {
- perror("Error while reading genetic data (strtod)");
- exit(EXIT_FAILURE);
- }
-
- if (endptr == tmpstr.c_str())
- {
- cerr
- << "No digits were found while reading genetic data"
- << " (individual " << i + 1 << ", position "
- << j + 1 << ")" << endl;
- exit(EXIT_FAILURE);
- }
- /* If we got here, strtod() successfully parsed a number */
- G.put(dosage, k, j);
- }
- else
- {
- std::cerr << "cannot read dose-file: " << fname
- << "check skipd and ngpreds parameters\n";
- infile.close();
- exit(1);
- }
- }
- }
- else
- {
- std::string all_numbers;
- all_numbers.reserve(nsnps * ngpreds * 7);
- std::getline(infile, all_numbers);
- mldose_line_to_matrix(k, all_numbers.c_str(), nsnps * ngpreds);
- }
k++;
}
else
@@ -361,7 +313,6 @@
}
-
// HERE NEED A NEW CONSTRUCTOR BASED ON DATABELBASECPP OBJECT
gendata::~gendata()
{
More information about the Genabel-commits
mailing list