Commit ee5c527a authored by mvalle's avatar mvalle
Browse files

Changed message output to cout from cerr.


git-svn-id: https://svn.vital-it.ch/svn/hp2c/trunk/Codeml_Variants/Fastcodeml@5413 95c5a404-1f88-0410-a6b0-c3f062b6f34a
parent ad0c251f
......@@ -60,7 +60,7 @@ void alignedFree(void* aPtr)
#if 0
// The following headers contain stuff that main() uses.
#include <iostream> // For std::cerr
#include <iostream> // For std::cout
#include <ostream> // For std::endl
#include <vector> // For std::vector
#include "AlignedAllocator.h"
......@@ -69,31 +69,31 @@ int main()
{
using namespace std;
cerr << "Constructing l:" << endl;
cout << "Constructing l:" << endl;
vector<double, AlignedAllocator<double, 8> > l;
l.reserve(10);
cerr << endl << "l.push_back(1729):" << endl;
cout << endl << "l.push_back(1729):" << endl;
l.push_back(1729.);
cerr << endl << "l.push_back(2161):" << endl;
cout << endl << "l.push_back(2161):" << endl;
l.push_back(2161.);
cerr << endl;
cout << endl;
double* p = &l[0];
int x = reinterpret_cast<int>(p);
cerr << "Aligned on 16: " << x%16 << endl;
cerr << "Aligned on 8: " << x%8 << endl;
cerr << "Aligned on 4: " << x%4 << endl;
cerr << endl;
cout << "Aligned on 16: " << x%16 << endl;
cout << "Aligned on 8: " << x%8 << endl;
cout << "Aligned on 4: " << x%4 << endl;
cout << endl;
for (vector<double, AlignedAllocator<double, 8> >::const_iterator i = l.begin(); i != l.end(); ++i) {
cerr << "Element: " << *i << endl;
cout << "Element: " << *i << endl;
}
cerr << endl << "Destroying l:" << endl;
cout << endl << "Destroying l:" << endl;
}
#endif
......@@ -44,11 +44,11 @@ double BayesTest::getGridParams(const std::vector<double>& aVars, const std::vec
aVars[n-3] = x[n-2]; // w0
aVars[n-2] = x[n-5]; // k
aVars[n-1] = x[n-1]; // w2
for(size_t i=0; i < n; ++i) {std::cerr << "aVars[" << std::setw(2) << i << "] = " << aVars[i] << std::endl;}
for(size_t i=0; i < n; ++i) {std::cout << "aVars[" << std::setw(2) << i << "] = " << aVars[i] << std::endl;}
fclose(fp);
//TEST! force the scale factors
std::cerr << "(computed) FG: " << aScales2[1] << " BG: " << aScales2[0] << std::endl;
std::cout << "(computed) FG: " << aScales2[1] << " BG: " << aScales2[0] << std::endl;
if(n == 13)
{
aScales[1] = 1./0.001651;
......@@ -59,7 +59,7 @@ double BayesTest::getGridParams(const std::vector<double>& aVars, const std::vec
aScales[1] = 1./5.833284036955;
aScales[0] = 1./5.834837576257;
}
std::cerr << "(forced) FG: " << aScales[1] << " BG: " << aScales[0] << std::endl;
std::cout << "(forced) FG: " << aScales[1] << " BG: " << aScales[0] << std::endl;
}
#endif
......@@ -179,16 +179,16 @@ double BayesTest::getGridParams(const std::vector<double>& aVars, const std::vec
std::vector<double> prio(mPriors.size());
fread(&prio[0], sizeof(double), mPriors.size(), fp);
std::cerr << std::setw(4) << "idx" << std::setw(20) << "CodeML";
std::cerr << std::setw(20) << "FastCodeML" << " (num. sites:" << mNumSites << ')' << std::endl;
std::cout << std::setw(4) << "idx" << std::setw(20) << "CodeML";
std::cout << std::setw(20) << "FastCodeML" << " (num. sites:" << mNumSites << ')' << std::endl;
for(size_t i=0; i < mPriors.size(); ++i)
{
int idx = (mNumSites == 20) ? cml_to_fast[i%20]-20+i-i%20 : i;
double perc = (prio[idx]-mPriors[i])/mPriors[i];
std::cerr << std::fixed << std::setw(4) << i << std::setw(20) << std::setprecision(12) << prio[idx];
std::cerr << std::fixed << std::setw(20) << std::setprecision(12) << mPriors[i];
std::cerr << std::fixed << std::setw(20) << std::setprecision(3) << perc << std::endl;
std::cout << std::fixed << std::setw(4) << i << std::setw(20) << std::setprecision(12) << prio[idx];
std::cout << std::fixed << std::setw(20) << std::setprecision(12) << mPriors[i];
std::cout << std::fixed << std::setw(20) << std::setprecision(3) << perc << std::endl;
}
fclose(fp);
}
......@@ -207,7 +207,7 @@ void BayesTest::getIndexTernary(double* aProbX, double* aProbY, unsigned int aTr
void BayesTest::computeBEB(const std::vector<double>& aVars, size_t aFgBranch, const std::vector<double>& aScales)
{
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cerr << std::endl << "Computing BEB for fg branch " << aFgBranch << std::endl;
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cout << std::endl << "Computing BEB for fg branch " << aFgBranch << std::endl;
// Get the site multiplicity
const std::vector<double>& site_multiplicity = mForest.getSiteMultiplicity();
......@@ -262,7 +262,7 @@ void BayesTest::computeBEB(const std::vector<double>& aVars, size_t aFgBranch, c
}
// Calculate marginal prob of data, fX, and postpara[]. scale2 is scale.
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cerr << std::endl << "Calculating f(X), the marginal probability of data." << std::endl;
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cout << std::endl << "Calculating f(X), the marginal probability of data." << std::endl;
double fX = 1.;
double scale2 = -1e300;
double lnfXs[BEB_NGRID];
......@@ -293,7 +293,7 @@ void BayesTest::computeBEB(const std::vector<double>& aVars, size_t aFgBranch, c
fh += codon_class_proportion[igrid*BEB_DIMS+k]*mPriors[iw[igrid*BEB_DIMS+k]*mNumSites+site];
if(fh < 1e-300)
{
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cerr << "Strange: f[" << site << "] = " << fh << " very small." << std::endl;
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cout << "Strange: f[" << site << "] = " << fh << " very small." << std::endl;
continue;
}
lnfXs[igrid] += log(fh)*site_multiplicity[site];
......@@ -328,40 +328,40 @@ void BayesTest::computeBEB(const std::vector<double>& aVars, size_t aFgBranch, c
// Print
if(mVerbose >= VERBOSE_ONLY_RESULTS)
{
std::cerr << std::endl << "Posterior on the grid" << std::endl << std::endl;
std::cout << std::endl << "Posterior on the grid" << std::endl << std::endl;
const char* paras[5] = {"p0","p1","w0","w2","w3"};
for(unsigned int j=2; j < BEB_DIMS; ++j)
{
std::cerr << paras[j] << ": ";
std::cout << paras[j] << ": ";
for(unsigned int k=0; k < BEB_N1D; ++k) std::cerr << std::fixed << std::setw(7) << std::setprecision(3) << post_params[j][k];
std::cerr << std::endl;
for(unsigned int k=0; k < BEB_N1D; ++k) std::cout << std::fixed << std::setw(7) << std::setprecision(3) << post_params[j][k];
std::cout << std::endl;
}
std::cerr << std::endl << "Posterior for p0-p1 (see the ternary graph)" << std::endl << std::endl;
std::cout << std::endl << "Posterior for p0-p1 (see the ternary graph)" << std::endl << std::endl;
double sum_postp0p1 = 0.;
for(unsigned int k=0; k<BEB_N1D*BEB_N1D; ++k)
{
std::cerr << std::fixed << std::setw(6) << std::setprecision(3) << postp0p1[k];
std::cout << std::fixed << std::setw(6) << std::setprecision(3) << postp0p1[k];
int sq = static_cast<int>(sqrt(k+1.));
if(fabs(sq*sq-(k+1.))<1e-5) std::cerr << std::endl;
if(fabs(sq*sq-(k+1.))<1e-5) std::cout << std::endl;
sum_postp0p1 += postp0p1[k];
}
std::cerr << std::endl << "Sum of density on p0-p1 = " << std::setprecision(4) << sum_postp0p1 << std::endl << std::endl;
std::cout << std::endl << "Sum of density on p0-p1 = " << std::setprecision(4) << sum_postp0p1 << std::endl << std::endl;
}
fX = log(fX)+scale2;
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cerr << "log(fX) = " << (fX+scale1-BEB_DIMS*log(BEB_N1D*1.))
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cout << "log(fX) = " << (fX+scale1-BEB_DIMS*log(BEB_N1D*1.))
<< " Scales = " << scale1 << " " << scale2 << std::endl;
// Calculate posterior probabilities for sites. scale1 is scale factor
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cerr << std::endl << "Calculating f(w|X), posterior probs of site classes." << std::endl;
if(mVerbose >= VERBOSE_ONLY_RESULTS) std::cout << std::endl << "Calculating f(w|X), posterior probs of site classes." << std::endl;
for(unsigned int site=0; site < mNumSites; ++site)
{
......@@ -417,7 +417,7 @@ void BayesTest::printPositiveSelSites(size_t aFgBranch) const
// Put a title the firts time
if(print_title)
{
std::cerr << "Printing positive sel sites for branch " << aFgBranch << std::endl;
std::cout << "Printing positive sel sites for branch " << aFgBranch << std::endl;
print_title = false;
}
......@@ -433,7 +433,7 @@ void BayesTest::printPositiveSelSites(size_t aFgBranch) const
const std::multimap<size_t, size_t>::const_iterator end(ret.second);
for(; it != end; ++it)
{
std::cerr << std::setw(6) << it->second + 1 << ' ' << std::fixed << std::setprecision(6) << prob << sig << std::endl;
std::cout << std::setw(6) << it->second + 1 << ' ' << std::fixed << std::setprecision(6) << prob << sig << std::endl;
}
}
}
......
......@@ -401,11 +401,11 @@ double BranchSiteModelNullHyp::computeLikelihoodForGradient(const std::vector<do
if(mExtraDebug > 0)
{
std::cerr << "FG: " << std::setprecision(8) << mFgScale << " BG: " << mBgScale << std::endl;
std::cerr << "The following is the value printed by CodeML" << std::endl;
std::cerr << "FG: " << std::setprecision(8) << 1./mFgScale << " BG: " << 1./mBgScale << std::endl;
std::cerr << "Q0 " << mScaleQw0 << std::endl;
std::cerr << "Q1 " << mScaleQ1 << std::endl << std::endl;
std::cout << "FG: " << std::setprecision(8) << mFgScale << " BG: " << mBgScale << std::endl;
std::cout << "The following is the value printed by CodeML" << std::endl;
std::cout << "FG: " << std::setprecision(8) << 1./mFgScale << " BG: " << 1./mBgScale << std::endl;
std::cout << "Q0 " << mScaleQw0 << std::endl;
std::cout << "Q1 " << mScaleQ1 << std::endl << std::endl;
}
// Combine the site likelihood into a single value
......@@ -488,11 +488,11 @@ double BranchSiteModelNullHyp::computeLikelihood(const std::vector<double>& aVar
if(mExtraDebug > 0)
{
std::cerr << "FG: " << std::setprecision(8) << mFgScale << " BG: " << mBgScale << std::endl;
std::cerr << "The following is the value printed by CodeML" << std::endl;
std::cerr << "FG: " << std::setprecision(8) << 1./mFgScale << " BG: " << 1./mBgScale << std::endl;
std::cerr << "Q0 " << mScaleQw0 << std::endl;
std::cerr << "Q1 " << mScaleQ1 << std::endl << std::endl;
std::cout << "FG: " << std::setprecision(8) << mFgScale << " BG: " << mBgScale << std::endl;
std::cout << "The following is the value printed by CodeML" << std::endl;
std::cout << "FG: " << std::setprecision(8) << 1./mFgScale << " BG: " << 1./mBgScale << std::endl;
std::cout << "Q0 " << mScaleQw0 << std::endl;
std::cout << "Q1 " << mScaleQ1 << std::endl << std::endl;
}
// Combine the site likelihood into a single value
......@@ -546,11 +546,11 @@ double BranchSiteModelNullHyp::combineSiteLikelihoods(void)
#endif
if(mExtraDebug > 1)
{
std::cerr << std::setw(4) << site << ' ';
std::cerr << std::scientific << std::setw(14) << likelihoods[0*num_sites+site] << ' ';
std::cerr << std::scientific << std::setw(14) << likelihoods[1*num_sites+site] << ' ';
std::cerr << std::scientific << std::setw(14) << likelihoods[2*num_sites+site] << " -> ";
std::cerr << std::fixed << std::setw(14) << x*mult[site] << std::endl;
std::cout << std::setw(4) << site << ' ';
std::cout << std::scientific << std::setw(14) << likelihoods[0*num_sites+site] << ' ';
std::cout << std::scientific << std::setw(14) << likelihoods[1*num_sites+site] << ' ';
std::cout << std::scientific << std::setw(14) << likelihoods[2*num_sites+site] << " -> ";
std::cout << std::fixed << std::setw(14) << x*mult[site] << std::endl;
}
}
#ifdef USE_GLOBAL_SCALING
......@@ -698,12 +698,12 @@ double BranchSiteModelAltHyp::computeLikelihoodForGradient(const std::vector<dou
if(mExtraDebug > 0)
{
std::cerr << "FG: " << std::setprecision(8) << mFgScale << " BG: " << mBgScale << std::endl;
std::cerr << "The following is the value printed by CodeML" << std::endl;
std::cerr << "FG: " << std::setprecision(8) << 1./mFgScale << " BG: " << 1./mBgScale << std::endl;
std::cerr << "Q0 " << mScaleQw0 << std::endl;
std::cerr << "Q1 " << mScaleQ1 << std::endl;
std::cerr << "Q2 " << mScaleQw2 << std::endl << std::endl;
std::cout << "FG: " << std::setprecision(8) << mFgScale << " BG: " << mBgScale << std::endl;
std::cout << "The following is the value printed by CodeML" << std::endl;
std::cout << "FG: " << std::setprecision(8) << 1./mFgScale << " BG: " << 1./mBgScale << std::endl;
std::cout << "Q0 " << mScaleQw0 << std::endl;
std::cout << "Q1 " << mScaleQ1 << std::endl;
std::cout << "Q2 " << mScaleQw2 << std::endl << std::endl;
}
// Combine the site likelihood into a single value
......@@ -822,12 +822,12 @@ double BranchSiteModelAltHyp::computeLikelihood(const std::vector<double>& aVar,
if(mExtraDebug > 0)
{
std::cerr << "FG: " << std::setprecision(8) << mFgScale << " BG: " << mBgScale << std::endl;
std::cerr << "The following is the value printed by CodeML" << std::endl;
std::cerr << "FG: " << std::setprecision(8) << 1./mFgScale << " BG: " << 1./mBgScale << std::endl;
std::cerr << "Q0 " << mScaleQw0 << std::endl;
std::cerr << "Q1 " << mScaleQ1 << std::endl;
std::cerr << "Q2 " << mScaleQw2 << std::endl << std::endl;
std::cout << "FG: " << std::setprecision(8) << mFgScale << " BG: " << mBgScale << std::endl;
std::cout << "The following is the value printed by CodeML" << std::endl;
std::cout << "FG: " << std::setprecision(8) << 1./mFgScale << " BG: " << 1./mBgScale << std::endl;
std::cout << "Q0 " << mScaleQw0 << std::endl;
std::cout << "Q1 " << mScaleQ1 << std::endl;
std::cout << "Q2 " << mScaleQw2 << std::endl << std::endl;
}
// Combine the site likelihood into a single value
......@@ -887,12 +887,12 @@ double BranchSiteModelAltHyp::combineSiteLikelihoods(void)
#endif
if(mExtraDebug > 1)
{
std::cerr << std::setw(4) << site << ' ';
std::cerr << std::scientific << std::setw(14) << likelihoods[0*num_sites+site] << ' ';
std::cerr << std::scientific << std::setw(14) << likelihoods[1*num_sites+site] << ' ';
std::cerr << std::scientific << std::setw(14) << likelihoods[2*num_sites+site] << ' ';
std::cerr << std::scientific << std::setw(14) << likelihoods[3*num_sites+site] << " -> ";
std::cerr << std::fixed << std::setw(14) << x*mult[site] << std::endl;
std::cout << std::setw(4) << site << ' ';
std::cout << std::scientific << std::setw(14) << likelihoods[0*num_sites+site] << ' ';
std::cout << std::scientific << std::setw(14) << likelihoods[1*num_sites+site] << ' ';
std::cout << std::scientific << std::setw(14) << likelihoods[2*num_sites+site] << ' ';
std::cout << std::scientific << std::setw(14) << likelihoods[3*num_sites+site] << " -> ";
std::cout << std::fixed << std::setw(14) << x*mult[site] << std::endl;
}
}
#ifdef USE_GLOBAL_SCALING
......@@ -1038,15 +1038,15 @@ double BranchSiteModel::maximizeLikelihood(size_t aFgBranch, bool aStopIfBigger,
// Print starting values
if(mTrace)
{
std::cerr << std::endl;
std::cerr << "*****************************************" << std::endl;
std::cerr << "*** Starting branch " << aFgBranch << std::endl;
std::cout << std::endl;
std::cout << "*****************************************" << std::endl;
std::cout << "*** Starting branch " << aFgBranch << std::endl;
printVar(mVar);
std::cerr << "*** Upper" << std::endl;
std::cout << "*** Upper" << std::endl;
printVar(mUpperBound);
std::cerr << "*** Lower" << std::endl;
std::cout << "*** Lower" << std::endl;
printVar(mLowerBound);
std::cerr << std::endl;
std::cout << std::endl;
}
// Initialize the maximum value found and the function evaluations counter
......@@ -1069,8 +1069,8 @@ double BranchSiteModel::maximizeLikelihood(size_t aFgBranch, bool aStopIfBigger,
if(mTrace)
{
std::cerr << std::endl << "Function invocations: " << mNumEvaluations << std::endl;
std::cerr << "Final log-likelihood value: " << maxl << std::endl;
std::cout << std::endl << "Function invocations: " << mNumEvaluations << std::endl;
std::cout << "Final log-likelihood value: " << maxl << std::endl;
printVar(mVar);
}
return maxl;
......@@ -1146,43 +1146,43 @@ double BranchSiteModel::maximizeLikelihood(size_t aFgBranch, bool aStopIfBigger,
// Print the final optimum value
if(mTrace)
{
std::cerr << std::endl << "Function invocations: " << mNumEvaluations << std::endl;
std::cout << std::endl << "Function invocations: " << mNumEvaluations << std::endl;
switch(result)
{
case nlopt::SUCCESS:
break;
case nlopt::STOPVAL_REACHED:
std::cerr << "Optimization stopped because stopval was reached." << std::endl;
std::cout << "Optimization stopped because stopval was reached." << std::endl;
break;
case nlopt::FTOL_REACHED:
std::cerr << "Optimization stopped because ftol_rel or ftol_abs was reached." << std::endl;
std::cout << "Optimization stopped because ftol_rel or ftol_abs was reached." << std::endl;
break;
case nlopt::XTOL_REACHED:
std::cerr << "Optimization stopped because xtol_rel or xtol_abs was reached." << std::endl;
std::cout << "Optimization stopped because xtol_rel or xtol_abs was reached." << std::endl;
break;
case nlopt::MAXEVAL_REACHED:
std::cerr << "Optimization stopped because maxeval was reached." << std::endl;
std::cout << "Optimization stopped because maxeval was reached." << std::endl;
break;
case nlopt::MAXTIME_REACHED:
std::cerr << "Optimization stopped because maxtime was reached." << std::endl;
std::cout << "Optimization stopped because maxtime was reached." << std::endl;
break;
default:
std::cerr << "Other reason: " << static_cast<unsigned int>(result) << std::endl;
std::cout << "Other reason: " << static_cast<unsigned int>(result) << std::endl;
break;
}
std::cerr << "Final log-likelihood value: " << maxl << std::endl;
std::cout << "Final log-likelihood value: " << maxl << std::endl;
printVar(mVar);
}
}
catch(const nlopt::forced_stop&)
{
if(mTrace) std::cerr << "Optimization stopped because LRT not satisfied" << std::endl;
if(mTrace) std::cout << "Optimization stopped because LRT not satisfied" << std::endl;
return DBL_MAX;
}
catch(const nlopt::roundoff_limited&)
......
......@@ -91,13 +91,13 @@ public:
/// @param[in] aLnl The likelihood value to be printed
/// @param[in] aOut The stream on which the variables should be printed
///
void printVar(const std::vector<double>& aVars, double aLnl=DBL_MAX, std::ostream& aOut=std::cerr) const;
void printVar(const std::vector<double>& aVars, double aLnl=DBL_MAX, std::ostream& aOut=std::cout) const;
/// Formatted print of the maximized variables
///
/// @param[in] aOut The stream on which the variables should be printed
///
void printFinalVars(std::ostream& aOut=std::cerr) const;
void printFinalVars(std::ostream& aOut=std::cout) const;
/// Compute the maximum likelihood for the given forest
///
......
......@@ -56,12 +56,12 @@ void CmdLine::CmdLineImpl::showHelp(const CSimpleOpt::SOption *aParserOptions)
if(done[i]) continue;
done[i] = true;
std::cerr << aParserOptions[i].pszArg;
std::cout << aParserOptions[i].pszArg;
for(j=i+1; j < cnt; ++j)
{
if(done[j] || aParserOptions[j].nId != aParserOptions[i].nId) continue;
done[j] = true;
std::cerr << " " << aParserOptions[j].pszArg;
std::cout << " " << aParserOptions[j].pszArg;
}
// Translate the kind of argument
......@@ -90,8 +90,8 @@ void CmdLine::CmdLineImpl::showHelp(const CSimpleOpt::SOption *aParserOptions)
break;
}
std::cerr << " " << type << std::endl;
std::cerr << " " << aParserOptions[i].pszHelp << std::endl << std::endl;
std::cout << " " << type << std::endl;
std::cout << " " << aParserOptions[i].pszHelp << std::endl << std::endl;
}
}
......@@ -235,8 +235,8 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
default:
case OPT_HELP:
std::cerr << "Usage:" << std::endl;
std::cerr << " " << usage_msg << std::endl << std::endl;
std::cout << "Usage:" << std::endl;
std::cout << " " << usage_msg << std::endl << std::endl;
mCmdLineImpl->showHelp(parser_options);
throw FastCodeMLSuccess();
......@@ -343,13 +343,13 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
switch(args.FileCount())
{
case 0:
std::cerr << "Missing NEWICK TREE file" << std::endl;
std::cout << "Missing NEWICK TREE file" << std::endl;
// Falltrough
case 1:
std::cerr << "Missing GENE file" << std::endl << std::endl;
std::cerr << "Usage:" << std::endl;
std::cerr << " " << usage_msg << std::endl << std::endl;
std::cout << "Missing GENE file" << std::endl << std::endl;
std::cout << "Usage:" << std::endl;
std::cout << " " << usage_msg << std::endl << std::endl;
mCmdLineImpl->showHelp(parser_options);
throw FastCodeMLFatal();
......
......@@ -69,14 +69,14 @@ double Ming2::minimizeFunction(std::vector<double>& aVars)
std::vector<double> space(np*(np*2+9+2));
std::vector<int> ispace(2*np);
bool sy = std::cerr.sync_with_stdio(true);
bool sy = std::cout.sync_with_stdio(true);
mNoisy = mTrace ? 9 : 0;
mAlwaysCenter = false;
double lnL = 0;
int sts = ming2(mTrace ? stdout : NULL, &lnL, &aVars[0], &mLowerBound[0], &mUpperBound[0], &space[0], &ispace[0], mRelativeError, np);
if(sts < 0) std::cerr << "Check ming2 convergence" << std::endl;
std::cerr.sync_with_stdio(sy);
if(sts < 0) std::cout << "Check ming2 convergence" << std::endl;
std::cout.sync_with_stdio(sy);
return -lnL;
}
......
......@@ -35,11 +35,11 @@ void CodonFrequencies::setCodonFrequenciesF3x4(const std::vector<unsigned int>&
for(k=0; k < N64; ++k)
{
int id = codon64to61(k);
if(id < 0) std::cerr << std::setw(5) << 0;
else std::cerr << std::setw(5) << aCodonCount[id];
if(k % 4 == 3) std::cerr << std::endl;
if(id < 0) std::cout << std::setw(5) << 0;
else std::cout << std::setw(5) << aCodonCount[id];
if(k % 4 == 3) std::cout << std::endl;
}
std::cerr << std::endl;
std::cout << std::endl;
#endif
// Compute the 3x4 table
......@@ -67,10 +67,10 @@ void CodonFrequencies::setCodonFrequenciesF3x4(const std::vector<unsigned int>&
#ifdef CHECK_ALGO
for(k=0; k < 12; ++k)
{
std::cerr << std::fixed << std::setprecision(8) << std::setw(12) << fb3x4sg[k];
if(k % 4 == 3) std::cerr << std::endl;
std::cout << std::fixed << std::setprecision(8) << std::setw(12) << fb3x4sg[k];
if(k % 4 == 3) std::cout << std::endl;
}
std::cerr << std::endl;
std::cout << std::endl;
#endif
// Compute codon frequency from the 3x4 table
......@@ -90,8 +90,8 @@ void CodonFrequencies::setCodonFrequenciesF3x4(const std::vector<unsigned int>&
{
int kk = codon64to61(k);
double v = (kk < 0) ? 0.0 : mCodonFrequencies[kk];
std::cerr << std::fixed << std::setprecision(8) << std::setw(12) << v;
if(k % 4 == 3) std::cerr << std::endl;
std::cout << std::fixed << std::setprecision(8) << std::setw(12) << v;
if(k % 4 == 3) std::cout << std::endl;
}
#endif
}
......
......@@ -39,7 +39,7 @@ void DAGScheduler::endLoadDependencies(unsigned int aNumCodonSets)
mRefCounterSave = mRefCounter;
// For debugging dump the DAG content
//dumpDAG(std::cerr);
//dumpDAG(std::cout);
}
......@@ -86,7 +86,7 @@ void DAGScheduler::dumpDAG(std::ostream& aOut) const
{
size_t k = reinterpret_cast<size_t>(irc->first);
int cnt = irc->second;
std::cerr << std::hex << k << ' ' << std::dec << std::setw(6) << cnt << std::endl;
std::cout << std::hex << k << ' ' << std::dec << std::setw(6) << cnt << std::endl;
}
}
......
......@@ -65,7 +65,7 @@ void FatVectorTransform::setBranchDependencies(const std::vector< std::vector<Fo
void FatVectorTransform::printCountGoodElements(void) const
{
std::cerr << std::endl;
std::cout << std::endl;
for(unsigned int b=0; b < mNumBranches; ++b)
{
size_t begin_idx = 0;
......@@ -92,31 +92,31 @@ void FatVectorTransform::printCountGoodElements(void) const
unsigned int cnt = 0;
for(size_t k=begin_idx; k < end_idx; ++k) if(mNodeStatus[b*mNumSites+k] == FatVectorTransform::SITE_EXISTS) ++cnt;
std::cerr << std::setw(2) << b << ": " << std::setw(4) << begin_idx << '-' << std::setw(4) << end_idx-1 << " (" << cnt << ")" << std::endl;
std::cout << std::setw(2) << b << ": " << std::setw(4) << begin_idx << '-' << std::setw(4) << end_idx-1 << " (" << cnt << ")" << std::endl;
}
}
void FatVectorTransform::printBranchVisitSequence(void) const
{
std::cerr << std::endl << "Branch at level" << std::endl;
std::cout << std::endl << "Branch at level" << std::endl;
unsigned int level = 1;
std::vector< std::vector<unsigned int> >::const_iterator inbl=mBranchByLevel.begin();
const std::vector< std::vector<unsigned int> >::const_iterator end=mBranchByLevel.end();
for(; inbl != end; ++inbl, ++level)
{
std::cerr << level << ": ";
std::cout << level << ": ";
std::vector<unsigned int>::const_iterator ifn=inbl->begin();
for(; ifn != inbl->end(); ++ifn) std::cerr << (*ifn) << ' ';
for(; ifn != inbl->end(); ++ifn) std::cout << (*ifn) << ' ';
std::cerr << std::endl;
std::cout << std::endl;
}
std::cerr << std::endl << "Parent node for branch" << std::endl;
std::cout << std::endl << "Parent node for branch" << std::endl;
for(unsigned int i=0; i < mNumBranches; ++i)
{
std::cerr << std::setw(2) << i << " -> " << std::setw(2) << mParentNode[i] << std::endl;
std::cout << std::setw(2) << i << " -> " << std::setw(2) << mParentNode[i] << std::endl;
}
}
......@@ -124,19 +124,19 @@ void FatVectorTransform::printBranchVisitSequence(void) const
void FatVectorTransform::printNodeStatus(void) const
{
std::cerr << std::endl;
std::cout << std::endl;
for(unsigned int b=0; b < mNumBranches; ++b)
{
std::cerr << "Branch " << b << std::endl;