Commit 30942407 authored by Jean-Benoist Leger's avatar Jean-Benoist Leger
Browse files

Merge branch 'stderr'

parents b0d186ff c449cc13
......@@ -43,8 +43,6 @@ void AddTabs(std::string FileName) {
InputFile.close();
OutputFile.close();
std::remove(FileName.c_str());
if (std::rename(OutputFileName.c_str(), FileName.c_str()))
std::cerr << "RN3ERROR" << std::endl;
}
// In the next function:
......@@ -149,7 +147,6 @@ void Transpose(std::string InputFileName, std::string OutputFileName,
unsigned int ElementSize, unsigned int LineL) {
unsigned int AllowedMemory = 1000000000;
// std::cerr << "Opening file " << InputFileName << std::endl;
std::ifstream InputFile(InputFileName.c_str(),
std::ifstream::in | std::ifstream::binary);
assert(InputFile.is_open());
......@@ -260,29 +257,19 @@ void CheckFile(std::ifstream &File, std::string OutputFileName) {
std::ofstream OutputFile(OutputFileName.c_str(),
std::ofstream::out | std::ofstream::binary);
if (!OutputFile.is_open()) {
// std::cerr << "Pas pu ouvrir le fichier " << OutputFileName <<
// std::endl; exit(52);
}
bool Correct = true;
char *Buffer;
unsigned int FileSize;
unsigned int LineL = LineLength(File, FileSize);
// std::cerr << "Filesize = " << FileSize << " and Line length = " << LineL
// << std::endl;
Buffer = new char[LineL];
File.seekg(0, std::ios::beg);
if (FileSize % LineL != 0)
// std::cerr << "Warning: Line length does NOT seem constant in this
// file." << std::endl;
for (unsigned int i = 0; i < (FileSize + LineL - 1) / LineL; i++) {
File.read(Buffer, LineL);
for (unsigned int j = 0; j < LineL - 1; j++)
if (Buffer[j] == '\n') {
Correct = false;
// std::cerr << "I found a return char at line " << i
// << " and column " << j << std::endl;
for (unsigned int k = j + 1; k < LineL; k++)
Buffer[k - j - 1] = Buffer[k];
File.read(Buffer + LineL - j, (j + 1));
......@@ -292,14 +279,10 @@ void CheckFile(std::ifstream &File, std::string OutputFileName) {
}
if (Buffer[LineL - 1] != '\n') {
Correct = false;
// std::cerr << "I DID NOT find a return char at line " <<
// i << " and column " << LineL - 1 << std::endl;
}
}
delete[] Buffer;
// std::cerr << "Checked file" << std::endl;
if (Correct)
// std::cerr << "Everything went ok" << std::endl;
OutputFile << '\n' << '\n';
OutputFile.close();
}
......
......@@ -287,8 +287,6 @@ void Imputator::MoveForwardBackward() {
Transpose(CharsProbasFileName, Aux);
AddTabs(Aux);
std::remove(CharsProbasFileName.c_str());
if (std::rename(Aux.c_str(), CharsProbasFileName.c_str()))
std::cerr << "RN1ERROR" << std::endl;
}
if (DoViterbi) {
ViterbiFile.close();
......@@ -296,8 +294,6 @@ void Imputator::MoveForwardBackward() {
Transpose(ViterbiFileName, Aux);
AddTabs(Aux);
std::remove(ViterbiFileName.c_str());
if (std::rename(Aux.c_str(), ViterbiFileName.c_str()))
std::cerr << "RN2ERROR" << std::endl;
}
if (CheckTauCoherence)
CheckTausFile.close();
......@@ -387,10 +383,6 @@ void Imputator::Viterbi(char *Ind) {
char c = '0' + (LastLetterCopy % 2);
int CurrentIndex = NbMarkers + DigitIndex - MyMarkovChainOrder;
if ((Ind[CurrentIndex] != '2') && (Ind[CurrentIndex] != c)) {
// std::cerr << "Erreur" << std::endl;
}
Ind[CurrentIndex] = '0' + (LastLetterCopy % 2);
LastLetterCopy /= 2;
}
......@@ -400,9 +392,6 @@ void Imputator::Viterbi(char *Ind) {
for (int Locus = NbMarkers - MyMarkovChainOrder - 1; Locus >= 0; Locus--) {
CurrentLetter = GetG(Locus + 1, CurrentLetter);
char c = '0' + (CurrentLetter % 2);
if ((Ind[Locus] != '2') && (Ind[Locus] != c)) {
// std::cerr << "Erreur " << std::endl;
}
Ind[Locus] = c;
}
ViterbiFile.write(Ind, NbMarkers);
......@@ -547,15 +536,6 @@ void Imputator::WriteProbasImputation(char *Ind) {
c = '0';
else if (P1 > Threshold)
c = '1';
if (((Ind[LetterPosition] == '0') && (P1 > 0)) ||
((Ind[LetterPosition] == '1') && (P1 < 1))) {
// std::cerr << "Error in proba (type 1)" << std::endl;
// std::cerr << "Initial letter = " << Ind[LetterPosition] <<
// ", P = " << P1 << std::endl;
}
if ((Ind[LetterPosition] != '2') && (c != Ind[LetterPosition])) {
// std::cerr << "Erreur d'imputation par proba" << std::endl;
}
ProbasCharsFile << c;
ProbasHRNumbersFile << P1 << '\t';
ProbasBinaryFile.write((char *)&P1, sizeof(double));
......
......@@ -97,16 +97,8 @@ void ToBinaryTransformer::CreateFile(unsigned int &NbInd,
unsigned int &NbMarkers) {
std::ifstream InputFile(InputFileName.c_str(),
std::ifstream::in | std::ifstream::binary);
if (!InputFile.is_open()) {
// std::cerr << "Pas pu ouvrir le fichier en lecture. Je sors." <<
// std::endl; exit(172);
}
std::ofstream OutputFile(OutputFileName.c_str(),
std::ofstream::out | std::ofstream::binary);
if (!OutputFile.is_open()) {
// std::cerr << "Pas pu ouvrir le fichier en ecriture. Je sors." <<
// std::endl; exit(172);
}
NbInd = 0;
NbMarkers = 0;
......@@ -131,8 +123,6 @@ void ToBinaryTransformer::CreateFile(unsigned int &NbInd,
Residu = BufferSize - BufferPosition;
assert(Residu >= 0);
}
// std::cout << "Rate of unknown values = " << 100 * ((double) NbPoints /
// TotalDataSize) << " %" << std::endl;
delete[] Buffer;
Buffer = NULL;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment