X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=raredisplay.cpp;h=b82127c51e6a64b50480a0f9b359cda3cd8e75f0;hp=5922822d57a5e0245129e63f30844cf746a88b41;hb=1a20e24ee786195ab0e1cccd4f5aede7a88f3f4e;hpb=74844a60d80c6dd06e3fb02ee9b928424f9019b0 diff --git a/raredisplay.cpp b/raredisplay.cpp index 5922822..b82127c 100644 --- a/raredisplay.cpp +++ b/raredisplay.cpp @@ -135,6 +135,55 @@ void RareDisplay::close(){ exit(1); } } +/***********************************************************************/ + +void RareDisplay::inputTempFiles(string filename){ + try { + ifstream in; + m->openInputFile(filename, in); + + int thisIters; + in >> thisIters; m->gobble(in); + + for (int i = 0; i < seqs.size(); i++) { + double tempresult, tempvar; + in >> tempresult >> tempvar; m->gobble(in); + + //find weighted result + results[i] = ((nIters * results[i]) + (thisIters * tempresult)) / (float)(nIters + thisIters); + + var[i] = ((nIters * var[i]) + (thisIters * tempvar)) / (float)(nIters + thisIters); + } + + in.close(); + } + catch(exception& e) { + m->errorOut(e, "RareDisplay", "inputTempFiles"); + exit(1); + } +} + +/***********************************************************************/ + +void RareDisplay::outputTempFiles(string filename){ + try { + ofstream out; + m->openOutputFile(filename, out); + + out << nIters << endl; + + for (int i = 0; i < seqs.size(); i++) { + out << results[i] << '\t' << var[i] << endl; + } + + out.close(); + } + catch(exception& e) { + m->errorOut(e, "RareDisplay", "outputTempFiles"); + exit(1); + } +} + /***********************************************************************/