1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
//
// contigsreport.cpp
// Mothur
//
// Created by Sarah Westcott on 7/17/20.
// Copyright © 2020 Schloss Lab. All rights reserved.
//
#include "contigsreport.hpp"
//Name Length Overlap_Length Overlap_Start Overlap_End MisMatches Num_Ns Expected_Errors
/******************************************************************************************************************/
ContigsReport::ContigsReport() : Report() {
try {
fillHeaders();
}
catch(exception& e) {
m->errorOut(e, "ContigsReport", "ContigsReport");
exit(1);
}
}
/**************************************************************************************************/
void ContigsReport::read(ifstream& repFile){
try {
repFile >> name;
repFile >> length;
repFile >> overlapLength;
repFile >> overlapStart;
repFile >> overlapEnd;
repFile >> misMatches;
repFile >> numsNs;
repFile >> expectedErrors;
gobble(repFile);
}
catch(exception& e) {
m->errorOut(e, "ContigsReport", "read");
exit(1);
}
}
/******************************************************************************************************************/
void ContigsReport::print(ofstream& reportFile){
try {
reportFile << name << '\t' << length << '\t' << overlapLength << '\t';
reportFile << overlapStart << '\t' << overlapEnd << '\t';
reportFile << misMatches << '\t' << numsNs << '\t';
reportFile << setprecision(6) << expectedErrors << endl;
}
catch(exception& e) {
m->errorOut(e, "ContigsReport", "print");
exit(1);
}
}
/******************************************************************************************************************/
string ContigsReport::getSeqReport(){
try {
string output = "";
output += name + '\t' + toString(length) + '\t' + toString(overlapLength) + '\t';
output += toString(overlapStart) + '\t' + toString(overlapEnd) + '\t';
output += toString(misMatches) + '\t' + toString(numsNs) + '\t';
string temp = toString(expectedErrors);
int pos = temp.find_last_of('.'); //find deicmal point if their is one
//if there is a decimal
if (pos != -1) { temp = temp.substr(0, pos+6); } //set precision to 5 places
else{ temp += ".00000"; }
output += temp + '\n';
return output;
}
catch(exception& e) {
m->errorOut(e, "ContigsReport", "getSeqReport");
exit(1);
}
}
/******************************************************************************************************************/
void ContigsReport::fillHeaders() {
try {
reportHeaders.push_back("Name"); reportHeaders.push_back("Length");
reportHeaders.push_back("Overlap_Length");
reportHeaders.push_back("Overlap_Start"); reportHeaders.push_back("Overlap_End");
reportHeaders.push_back("MisMatches");
reportHeaders.push_back("Num_Ns"); reportHeaders.push_back("Expected_Errors");
}
catch(exception& e) {
m->errorOut(e, "ContigsReport", "fillHeaders");
exit(1);
}
}
/******************************************************************************************************************/
|