int error = groupMap->readMap();
if (error == 1) { delete groupMap; return 0; }
+ if (m->control_pressed) { delete groupMap; return 0; }
+
globaldata->gGroupmap = groupMap;
if (Groups.size() == 0) {
openInputFile(fastafile, inFasta);
while(!inFasta.eof()) {
+ if (m->control_pressed) { inFasta.close(); delete groupMap; return 0; }
+
Sequence seq(inFasta); gobble(inFasta);
if (seq.getName() != "") { seqs.push_back(seq); }
}
//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))) {
+ if (m->control_pressed) {
+ if (lastlist != NULL) { delete lastlist; }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ delete groupMap; return 0;
+ }
+
list = new ListVector(in);
if(allLines == 1 || labels.count(list->getLabel()) == 1){
if (lastlist != NULL) { delete lastlist; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete groupMap; return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
}
}
/***********************************************************/
-void GetSharedOTUCommand::process(ListVector* shared) {
+int GetSharedOTUCommand::process(ListVector* shared) {
try {
map<string, string> fastaMap;
//go through each bin, find out if shared
for (int i = 0; i < shared->getNumBins(); i++) {
+ if (m->control_pressed) { outNames.close(); remove(outputFileNames.c_str()); return 0; }
bool uniqueOTU = true;
//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); }
//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); }
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];
outputNames.push_back(outputFileFasta);
for (int k = 0; k < seqs.size(); k++) {
+ if (m->control_pressed) { outFasta.close(); return 0; }
+
//if this is a sequence we want, output it
it = fastaMap.find(seqs[k].getName());
if (it != fastaMap.end()) {
outFasta.close();
}
-
+
+ return 0;
}
catch(exception& e) {