[Genabel-commits] r1903 - branches/ProbABEL-pvals/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Dec 30 10:55:21 CET 2014
Author: lckarssen
Date: 2014-12-30 10:55:20 +0100 (Tue, 30 Dec 2014)
New Revision: 1903
Modified:
branches/ProbABEL-pvals/ProbABEL/src/main.cpp
Log:
ProbABEL: Instead of putting the string "NaN" in the various vectors that contain the output columns, use the constant NAN (a float defined in <cmath>). This is more consistent with the actual math behind it.
One downside: 'cout << NAN' prints 'nan', not 'NaN' on Linux. According to http://en.wikipedia.org/wiki/NaN#Display the way this is operating system dependent.
This undoes commit 1735 (see forum: http://forum.genabel.org/viewtopic.php?f=10&t=879#p1840).
Modified: branches/ProbABEL-pvals/ProbABEL/src/main.cpp
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/main.cpp 2014-12-29 21:43:04 UTC (rev 1902)
+++ branches/ProbABEL-pvals/ProbABEL/src/main.cpp 2014-12-30 09:55:20 UTC (rev 1903)
@@ -451,7 +451,7 @@
* paper. TODO LCK
*/
*chi2val[model] = NAN;
- *chi2[model] << "nan";
+ *chi2[model] << *chi2val[model];
}
else
{
@@ -488,9 +488,9 @@
for (int pos = start_pos; pos <= end_pos; pos++)
{
*beta_sebeta[model] << input_var.getSep()
- << "NaN"
+ << NAN
<< input_var.getSep()
- << "NaN";
+ << NAN;
}
if (input_var.getNgpreds() == 2)
@@ -502,17 +502,17 @@
{
if (model == 0)
{
- *covvalue[model] << "NaN"
+ *covvalue[model] << NAN
<< input_var.getSep()
- << "NaN";
+ << NAN;
} else{
- *covvalue[model] << "NaN";
+ *covvalue[model] << NAN;
}
}
#endif
// Oct 26, 2009
*chi2val[model] = NAN;
- *chi2[model] << "nan";
+ *chi2[model] << *chi2val[model];
} else{
// ngpreds==1 (and SNP is rare)
if (input_var.getInverseFilename() == NULL)
@@ -522,13 +522,13 @@
if (!input_var.getAllcov()
&& input_var.getInteraction() != 0)
{
- *covvalue[model] << "NaN";
+ *covvalue[model] << NAN;
}
#endif
// Oct 26, 2009
} // END if getInverseFilename == NULL
*chi2val[model] = NAN;
- *chi2[model] << "nan";
+ *chi2[model] << *chi2val[model];
} // END ngpreds == 1 (and SNP is rare)
} // END else: SNP is rare
@@ -542,7 +542,9 @@
catch (std::exception &e)
{
std::cerr << mli.name[csnp] << ": "
- << e.what() << std::endl;
+ << e.what()
+ << " Setting p-value to NAN"
+ << std::endl;
*pval[model] << NAN;
}
#endif
More information about the Genabel-commits
mailing list