int MergeGroupsCommand::execute(){ try { if (abort) { if (calledHelp) { return 0; } return 2; } designMap = new DesignMap(designfile); if (method != "sum") { string defaultClass = designMap->getDefaultClass(); vector<string> treatments = designMap->getCategory(defaultClass); set<int> numGroupsPerTreatment; for (int i = 0; i < treatments.size(); i++) { if (m->getControl_pressed()) { break; } map<string, vector<string> > checkTreatments; vector<string> temp; temp.push_back(treatments[i]); checkTreatments[defaultClass] = temp; numGroupsPerTreatment.insert(designMap->getNumUnique(checkTreatments)); } if (numGroupsPerTreatment.size() > 1) { m->mothurOut("[ERROR]: The median and average methods require you to have the same number of sequences in each treatment, quitting.\n"); delete designMap; return 0; } } if (groupfile != "") { processGroupFile(designMap); } if (sharedfile != "") { processSharedFile(designMap); } if (countfile != "") { processCountFile(designMap); } //reset groups parameter delete designMap; if (m->getControl_pressed()) { for (int i = 0; i < outputNames.size(); i++) { util.mothurRemove(outputNames[i]); } return 0;} //set shared file as new current sharedfile string currentName = ""; itTypes = outputTypes.find("shared"); if (itTypes != outputTypes.end()) { if ((itTypes->second).size() != 0) { currentName = (itTypes->second)[0]; current->setSharedFile(currentName); } } itTypes = outputTypes.find("group"); if (itTypes != outputTypes.end()) { if ((itTypes->second).size() != 0) { currentName = (itTypes->second)[0]; current->setGroupFile(currentName); } } itTypes = outputTypes.find("count"); if (itTypes != outputTypes.end()) { if ((itTypes->second).size() != 0) { currentName = (itTypes->second)[0]; current->setCountFile(currentName); } } m->mothurOut("\nOutput File Names: \n"); for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i] +"\n"); } m->mothurOutEndLine(); return 0; } catch(exception& e) { m->errorOut(e, "MergeGroupsCommand", "execute"); exit(1); } }
/** * init and run the application */ int main(int argc, char *argv[]) { if(argc < 2) { printf("signalCount: usage: signalCounter [endpoint] (trigger_interval_ms)\n"); return 1; } // store endpoint strcpy(endPointUrl, argv[1]); printf("Using [%s] as endpoint URL\n", endPointUrl); // store trigger interval, if we have one if(argc == 3) { char* p; // will be set to the "first invalid character" set by strtol errno = 0; triggerInterval = strtol(argv[2], &p, 10); if (*p != '\0' || errno != 0) { fprintf(stderr, "invalid trigger interval [%s]\n", argv[2]); return 1; } } printf("Using [%d] for trigger interval\n", triggerInterval); // init the wiringPi library if (wiringPiSetup () < 0) { fprintf(stderr, "Unable to setup wiringPi: %s\n", strerror (errno)); return 1 ; } // set up an interrupt on our input pin if (wiringPiISR(PIN_INPUT, INT_EDGE_BOTH, &signalIsr) < 0) { fprintf(stderr, "Unable to setup ISR: %s\n", strerror (errno)); return 1 ; } // configure the output pin for output. Output output output pinMode(PIN_OUTPUT, OUTPUT); pinMode(PIN_INPUT, INPUT); // pull the internal logic gate down to 0v - we don't want it floating around pullUpDnControl(PIN_INPUT, PUD_DOWN); // blink 3 times - we're ready to go ledBlink(300); delay(300); ledBlink(300); delay(300); ledBlink(300); // send a test signal count with the current timestamp fileRecordSignalCount(getCurrentMilliseconds()); printf("signalCount started\n"); for(;;) { delay(1000); // this thread will submit any count files that have not been sent printf("about to run cleanup thread\n"); processCountFile(); } return 0; }