globaldata->gTreemap = tmap;
while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
-
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); return 0; }
+
if(allLines == 1 || labels.count(order->getLabel()) == 1){
m->mothurOut(order->getLabel()); m->mothurOutEndLine();
- process(order);
+ int error = process(order);
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); return 0; }
processedLabels.insert(order->getLabel());
userLabels.erase(order->getLabel());
delete order;
order = input->getSharedOrderVector(lastLabel);
m->mothurOut(order->getLabel()); m->mothurOutEndLine();
- process(order);
+ int error = process(order);
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); return 0; }
processedLabels.insert(order->getLabel());
userLabels.erase(order->getLabel());
order = input->getSharedOrderVector();
}
+
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); return 0; }
+
//output error messages about any remaining user labels
set<string>::iterator it;
bool needToRun = false;
}
}
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); return 0; }
+
//run last line if you need to
if (needToRun == true) {
if (order != NULL) { delete order; }
order = input->getSharedOrderVector(lastLabel);
m->mothurOut(order->getLabel()); m->mothurOutEndLine();
- process(order);
+ int error = process(order);
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); return 0; }
+
delete order;
}
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); return 0; }
+
//reset groups parameter
globaldata->Groups.clear();
}
//**********************************************************************************************************************
-void BootSharedCommand::createTree(ostream* out, Tree* t){
+int BootSharedCommand::createTree(ostream* out, Tree* t){
try {
//do merges and create tree structure by setting parents and children
//there are numGroups - 1 merges to do
for (int i = 0; i < (numGroups - 1); i++) {
+ if (m->control_pressed) { return 1; }
+
float largest = -1000.0;
int row, column;
//find largest value in sims matrix by searching lower triangle
//assemble tree
t->assembleTree();
+
+ if (m->control_pressed) { return 1; }
//print newick file
t->print(*out);
+
+ return 0;
}
catch(exception& e) {
}
}
/***********************************************************/
-void BootSharedCommand::process(SharedOrderVector* order) {
+int BootSharedCommand::process(SharedOrderVector* order) {
try{
EstOutput data;
vector<SharedRAbundVector*> subset;
//create a file for each calculator with the 1000 trees in it.
for (int p = 0; p < iters; p++) {
+ if (m->control_pressed) { return 1; }
+
util->getSharedVectorswithReplacement(globaldata->Groups, lookup, order); //fills group vectors from order vector.
//for each calculator
for(int i = 0 ; i < treeCalculators.size(); i++) {
-
+
+ if (m->control_pressed) { return 1; }
+
//initialize simMatrix
simMatrix.clear();
simMatrix.resize(numGroups);
- for (int m = 0; m < simMatrix.size(); m++) {
+ for (int o = 0; o < simMatrix.size(); o++) {
for (int j = 0; j < simMatrix.size(); j++) {
- simMatrix[m].push_back(0.0);
+ simMatrix[o].push_back(0.0);
}
}
tempTree = new Tree();
+ if (m->control_pressed) { delete tempTree; return 1; }
+
//creates tree from similarity matrix and write out file
createTree(out[i], tempTree);
+ if (m->control_pressed) { delete tempTree; return 1; }
+
//save trees for consensus command.
trees[i].push_back(tempTree);
}
m->mothurOut("Generating consensus tree for " + treeCalculators[k]->getName()); m->mothurOutEndLine();
+ if (m->control_pressed) { return 1; }
+
//set global data to calc trees
globaldata->gTree = trees[k];
//close ostream for each calc
for (int z = 0; z < treeCalculators.size(); z++) { out[z]->close(); }
+
+ return 0;
}
catch(exception& e) {