X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothurout.cpp;h=65296221759fa879e591bb0967b0f20872106adc;hb=64581f6d0e63e67d4e119601bea695ebb3f52a13;hp=59e4fdcc080fe91e946dbc7d3b2a66d9e1dc02a0;hpb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;p=mothur.git diff --git a/mothurout.cpp b/mothurout.cpp index 59e4fdc..6529622 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -46,6 +46,40 @@ void MothurOut::printCurrentFiles() { exit(1); } } +/*********************************************************************************************/ +bool MothurOut::hasCurrentFiles() { + try { + bool hasCurrent = false; + + if (accnosfile != "") { return true; } + if (columnfile != "") { return true; } + if (designfile != "") { return true; } + if (fastafile != "") { return true; } + if (groupfile != "") { return true; } + if (listfile != "") { return true; } + if (namefile != "") { return true; } + if (oligosfile != "") { return true; } + if (orderfile != "") { return true; } + if (ordergroupfile != "") { return true; } + if (phylipfile != "") { return true; } + if (qualfile != "") { return true; } + if (rabundfile != "") { return true; } + if (relabundfile != "") { return true; } + if (sabundfile != "") { return true; } + if (sfffile != "") { return true; } + if (sharedfile != "") { return true; } + if (taxonomyfile != "") { return true; } + if (treefile != "") { return true; } + + return hasCurrent; + + } + catch(exception& e) { + errorOut(e, "MothurOut", "hasCurrentFiles"); + exit(1); + } +} + /*********************************************************************************************/ void MothurOut::clearCurrentFiles() { try { @@ -1183,6 +1217,42 @@ map MothurOut::readNames(string namefile) { exit(1); } } +/**********************************************************************************************************************/ +int MothurOut::readNames(string namefile, vector& nameVector, map& fastamap) { + try { + int error = 0; + + //open input file + ifstream in; + openInputFile(namefile, in); + + while (!in.eof()) { + if (control_pressed) { break; } + + string firstCol, secondCol; + in >> firstCol >> secondCol; gobble(in); + + int num = getNumNames(secondCol); + + map::iterator it = fastamap.find(firstCol); + if (it == fastamap.end()) { + error = 1; + mothurOut("[ERROR]: " + firstCol + " is not in your fastafile, but is in your namesfile, please correct."); mothurOutEndLine(); + }else { + seqPriorityNode temp(num, it->second, firstCol); + nameVector.push_back(temp); + } + } + in.close(); + + return error; + + } + catch(exception& e) { + errorOut(e, "MothurOut", "readNames"); + exit(1); + } +} /***********************************************************************/ @@ -1731,6 +1801,23 @@ bool MothurOut::checkReleaseVersion(ifstream& file, string version) { } } /**************************************************************************************************/ +bool MothurOut::isContainingOnlyDigits(string input) { + try{ + + //are you a digit in ascii code + for (int i = 0;i < input.length(); i++){ + if( input[i]>47 && input[i]<58){} + else { return false; } + } + + return true; + } + catch(exception& e) { + errorOut(e, "MothurOut", "isContainingOnlyDigits"); + exit(1); + } +} +/**************************************************************************************************/