types.insert("tree");
types.insert("flow");
types.insert("biom");
- types.insert("counttable");
+ types.insert("count");
types.insert("processors");
return types;
if (treefile != "") { mothurOut("tree=" + treefile); mothurOutEndLine(); }
if (flowfile != "") { mothurOut("flow=" + flowfile); mothurOutEndLine(); }
if (biomfile != "") { mothurOut("biom=" + biomfile); mothurOutEndLine(); }
- if (counttablefile != "") { mothurOut("counttable=" + counttablefile); mothurOutEndLine(); }
+ if (counttablefile != "") { mothurOut("count=" + counttablefile); mothurOutEndLine(); }
if (processors != "1") { mothurOut("processors=" + processors); mothurOutEndLine(); }
}
int MothurOut::renameFile(string oldName, string newName){
try {
+
+ if (oldName == newName) { return 0; }
+
ifstream inTest;
int exist = openInputFile(newName, inTest, "");
inTest.close();
//**********************************************************************************************************************
int MothurOut::readTax(string namefile, map<string, string>& taxMap) {
try {
-
//open input file
ifstream in;
openInputFile(namefile, in);
}
}
in.close();
+
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+
+ for (int i = 0; i < pieces.size(); i++) {
+ if (columnOne) { firstCol = pieces[i]; columnOne=false; }
+ else { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+
+ if (pairDone) {
+ //are there confidence scores, if so remove them
+ if (secondCol.find_first_of('(') != -1) { removeConfidences(secondCol); }
+ taxMap[firstCol] = secondCol;
+ if (debug) { mothurOut("[DEBUG]: name = '" + firstCol + "' tax = '" + secondCol + "'\n"); }
+ pairDone = false;
+ }
+ }
+ }
return taxMap.size();
/**********************************************************************************************************************/
int MothurOut::readNames(string namefile, map<string, string>& nameMap, bool redund) {
try {
-
//open input file
ifstream in;
openInputFile(namefile, in);
}
}
in.close();
+
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+
+ for (int i = 0; i < pieces.size(); i++) {
+ if (columnOne) { firstCol = pieces[i]; columnOne=false; }
+ else { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+
+ if (pairDone) {
+ //parse names into vector
+ vector<string> theseNames;
+ splitAtComma(secondCol, theseNames);
+ for (int i = 0; i < theseNames.size(); i++) { nameMap[theseNames[i]] = firstCol; }
+ pairDone = false;
+ }
+ }
+ }
return nameMap.size();
/**********************************************************************************************************************/
int MothurOut::readNames(string namefile, map<string, string>& nameMap, int flip) {
try {
-
//open input file
ifstream in;
openInputFile(namefile, in);
}
}
in.close();
+
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+
+ for (int i = 0; i < pieces.size(); i++) {
+ if (columnOne) { firstCol = pieces[i]; columnOne=false; }
+ else { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+
+ if (pairDone) {
+ nameMap[secondCol] = firstCol;
+ pairDone = false;
+ }
+ }
+ }
return nameMap.size();
/**********************************************************************************************************************/
int MothurOut::readNames(string namefile, map<string, string>& nameMap, map<string, int>& nameCount) {
try {
- nameMap.clear(); nameCount.clear();
+ nameMap.clear(); nameCount.clear();
//open input file
ifstream in;
openInputFile(namefile, in);
}
in.close();
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+
+ for (int i = 0; i < pieces.size(); i++) {
+ if (columnOne) { firstCol = pieces[i]; columnOne=false; }
+ else { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+
+ if (pairDone) {
+ //parse names into vector
+ vector<string> theseNames;
+ splitAtComma(secondCol, theseNames);
+ for (int i = 0; i < theseNames.size(); i++) { nameMap[theseNames[i]] = firstCol; }
+ nameCount[firstCol] = theseNames.size();
+ pairDone = false;
+ }
+ }
+
+ }
return nameMap.size();
}
/**********************************************************************************************************************/
int MothurOut::readNames(string namefile, map<string, string>& nameMap) {
try {
-
//open input file
ifstream in;
openInputFile(namefile, in);
}
}
in.close();
+
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+
+ for (int i = 0; i < pieces.size(); i++) {
+ if (columnOne) { firstCol = pieces[i]; columnOne=false; }
+ else { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+
+ if (pairDone) { nameMap[firstCol] = secondCol; pairDone = false; }
+ }
+ }
return nameMap.size();
}
/**********************************************************************************************************************/
int MothurOut::readNames(string namefile, map<string, vector<string> >& nameMap) {
- try {
-
+ try {
//open input file
ifstream in;
openInputFile(namefile, in);
}
in.close();
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+
+ for (int i = 0; i < pieces.size(); i++) {
+ if (columnOne) { firstCol = pieces[i]; columnOne=false; }
+ else { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+
+ if (pairDone) {
+ vector<string> temp;
+ splitAtComma(secondCol, temp);
+ nameMap[firstCol] = temp;
+ pairDone = false;
+ }
+ }
+ }
+
return nameMap.size();
}
catch(exception& e) {
/**********************************************************************************************************************/
map<string, int> MothurOut::readNames(string namefile) {
try {
-
map<string, int> nameMap;
//open input file
}
}
in.close();
+
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+ for (int i = 0; i < pieces.size(); i++) {
+ if (columnOne) { firstCol = pieces[i]; columnOne=false; }
+ else { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+
+ if (pairDone) {
+ int num = getNumNames(secondCol);
+ nameMap[firstCol] = num;
+ pairDone = false;
+ }
+ }
+ }
return nameMap;
}
in.close();
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+
+ for (int i = 0; i < pieces.size(); i++) {
+ if (columnOne) { firstCol = pieces[i]; columnOne=false; }
+ else { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+
+ if (pairDone) {
+ int num = getNumNames(secondCol);
+
+ map<string, string>::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);
+ }
+
+ pairDone = false;
+ }
+ }
+ }
return error;
}
catch(exception& e) {
//**********************************************************************************************************************
set<string> MothurOut::readAccnos(string accnosfile){
try {
- set<string> names;
+ set<string> names;
ifstream in;
openInputFile(accnosfile, in);
string name;
}
in.close();
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+ for (int i = 0; i < pieces.size(); i++) { names.insert(pieces[i]); }
+ }
return names;
}
catch(exception& e) {
for (int i = 0; i < pieces.size(); i++) { names.push_back(pieces[i]); }
}
in.close();
+
+ if (rest != "") {
+ vector<string> pieces = splitWhiteSpace(rest);
+ for (int i = 0; i < pieces.size(); i++) { names.push_back(pieces[i]); }
+ }
return 0;
}