X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getsharedotucommand.cpp;h=492195d702286af6cc82d919311aae7a59260596;hb=260ae19c36cb11a53ddc5a75b5e507f8dd8b31d6;hp=7f8755645ce6664c5a299073e0ae1cbc6e875025;hpb=aa9238c0a9e6e7aa0ed8b8b606b08ad4fd7dcfe3;p=mothur.git diff --git a/getsharedotucommand.cpp b/getsharedotucommand.cpp index 7f87556..492195d 100644 --- a/getsharedotucommand.cpp +++ b/getsharedotucommand.cpp @@ -50,7 +50,7 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option) { it = parameters.find("fasta"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["fasta"] = inputDir + it->second; } } @@ -58,7 +58,7 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option) { it = parameters.find("list"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["list"] = inputDir + it->second; } } @@ -66,7 +66,7 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option) { it = parameters.find("group"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["group"] = inputDir + it->second; } } @@ -90,7 +90,7 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option) { label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { - if(label != "all") { splitAtDash(label, labels); allLines = 0; } + if(label != "all") { m->splitAtDash(label, labels); allLines = 0; } else { allLines = 1; } } @@ -101,7 +101,7 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option) { if (groups == "not found") { groups = ""; } else { userGroups = "unique." + groups; - splitAtDash(groups, Groups); + m->splitAtDash(groups, Groups); globaldata->Groups = Groups; } @@ -110,7 +110,7 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option) { if (groups == "not found") { groups = ""; } else { userGroups = groups; - splitAtDash(groups, Groups); + m->splitAtDash(groups, Groups); globaldata->Groups = Groups; unique = false; } @@ -188,12 +188,12 @@ int GetSharedOTUCommand::execute(){ if (fastafile != "") { ifstream inFasta; - openInputFile(fastafile, inFasta); + m->openInputFile(fastafile, inFasta); while(!inFasta.eof()) { if (m->control_pressed) { inFasta.close(); delete groupMap; return 0; } - Sequence seq(inFasta); gobble(inFasta); + Sequence seq(inFasta); m->gobble(inFasta); if (seq.getName() != "") { seqs.push_back(seq); } } inFasta.close(); @@ -207,7 +207,7 @@ int GetSharedOTUCommand::execute(){ set userLabels = labels; ifstream in; - openInputFile(listfile, in); + m->openInputFile(listfile, in); //as long as you are not at the end of the file or done wih the lines you want while((!in.eof()) && ((allLines == 1) || (userLabels.size() != 0))) { @@ -228,7 +228,7 @@ int GetSharedOTUCommand::execute(){ userLabels.erase(list->getLabel()); } - if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { + if ((m->anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { string saveLabel = list->getLabel(); m->mothurOut(lastlist->getLabel()); @@ -302,13 +302,13 @@ int GetSharedOTUCommand::process(ListVector* shared) { ofstream outNames; string outputFileNames; - if (outputDir == "") { outputDir += hasPath(listfile); } + if (outputDir == "") { outputDir += m->hasPath(listfile); } if (output != "accnos") { - outputFileNames = outputDir + getRootName(getSimpleName(listfile)) + shared->getLabel() + userGroups + ".shared.seqs"; + outputFileNames = outputDir + m->getRootName(m->getSimpleName(listfile)) + shared->getLabel() + userGroups + ".shared.seqs"; }else { - outputFileNames = outputDir + getRootName(getSimpleName(listfile)) + shared->getLabel() + userGroups + ".accnos"; + outputFileNames = outputDir + m->getRootName(m->getSimpleName(listfile)) + shared->getLabel() + userGroups + ".accnos"; } - openOutputFile(outputFileNames, outNames); + m->openOutputFile(outputFileNames, outNames); bool wroteSomething = false; int num = 0; @@ -334,7 +334,7 @@ int GetSharedOTUCommand::process(ListVector* shared) { //find group string seqGroup = groupMap->getGroup(name); if (output != "accnos") { - namesOfSeqsInThisBin.push_back((name + "\t" + seqGroup + "\t" + toString(i+1))); + namesOfSeqsInThisBin.push_back((name + "|" + seqGroup + "|" + toString(i+1))); }else { namesOfSeqsInThisBin.push_back(name); } if (seqGroup == "not found") { m->mothurOut(name + " is not in your groupfile. Please correct."); m->mothurOutEndLine(); exit(1); } @@ -348,7 +348,7 @@ int GetSharedOTUCommand::process(ListVector* shared) { //get last name string seqGroup = groupMap->getGroup(names); if (output != "accnos") { - namesOfSeqsInThisBin.push_back((names + "\t" + seqGroup + "\t" + toString(i+1))); + namesOfSeqsInThisBin.push_back((names + "|" + seqGroup + "|" + toString(i+1))); }else { namesOfSeqsInThisBin.push_back(names); } if (seqGroup == "not found") { m->mothurOut(names + " is not in your groupfile. Please correct."); m->mothurOutEndLine(); exit(1); } @@ -379,8 +379,8 @@ int GetSharedOTUCommand::process(ListVector* shared) { if (fastafile != "") { if (output != "accnos") { - string seqName = namesOfSeqsInThisBin[j].substr(0,namesOfSeqsInThisBin[j].find_last_of('\t')); - seqName = seqName.substr(0,seqName.find_last_of('\t')); + string seqName = namesOfSeqsInThisBin[j].substr(0,namesOfSeqsInThisBin[j].find_last_of('|')); + seqName = seqName.substr(0,seqName.find_last_of('|')); fastaMap[seqName] = namesOfSeqsInThisBin[j]; //fastaMap needs to contain just the seq name for output later }else { fastaMap[namesOfSeqsInThisBin[j]] = namesOfSeqsInThisBin[j]; @@ -410,10 +410,10 @@ int GetSharedOTUCommand::process(ListVector* shared) { //if fasta file provided output new fasta file if ((fastafile != "") && wroteSomething) { - if (outputDir == "") { outputDir += hasPath(fastafile); } - string outputFileFasta = outputDir + getRootName(getSimpleName(fastafile)) + shared->getLabel() + userGroups + ".shared.fasta"; + if (outputDir == "") { outputDir += m->hasPath(fastafile); } + string outputFileFasta = outputDir + m->getRootName(m->getSimpleName(fastafile)) + shared->getLabel() + userGroups + ".shared.fasta"; ofstream outFasta; - openOutputFile(outputFileFasta, outFasta); + m->openOutputFile(outputFileFasta, outFasta); outputNames.push_back(outputFileFasta); for (int k = 0; k < seqs.size(); k++) {