-//***************************************************************************************************************
-void ChimeraCheckRDP::createProcessesIS() {
- try {
- #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
- int process = 0;
- vector<int> processIDS;
-
- //loop through and create all the processes you want
- while (process != processors) {
- int pid = fork();
-
- if (pid > 0) {
- processIDS.push_back(pid);
- process++;
- }else if (pid == 0){
-
- for (int i = lines[process]->start; i < lines[process]->end; i++) {
- IS[i] = findIS(i);
- }
-
- //write out data to file so parent can read it
- ofstream out;
- string s = toString(getpid()) + ".temp";
- openOutputFile(s, out);
-
- //output pairs
- for (int i = lines[process]->start; i < lines[process]->end; i++) {
- out << IS[i].size() << endl;
- for (int j = 0; j < IS[i].size(); j++) {
- out << IS[i][j].leftParent << '\t'<< IS[i][j].rightParent << '\t' << IS[i][j].midpoint << '\t' << IS[i][j].score << endl;
- }
- }
-
- out.close();
-
- exit(0);
- }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
- }
-
- //force parent to wait until all the processes are done
- for (int i=0;i<processors;i++) {
- int temp = processIDS[i];
- wait(&temp);
- }
-
- //get data created by processes
- for (int i=0;i<processors;i++) {
- ifstream in;
- string s = toString(processIDS[i]) + ".temp";
- openInputFile(s, in);
-
- //get pairs
- for (int k = lines[i]->start; k < lines[i]->end; k++) {
-
- int size;
- in >> size; gobble(in);
-
- string left, right;
- int mid;
- float score;
-
- IS[k].clear();
-
- for (int j = 0; j < size; j++) {
- in >> left >> right >> mid >> score; gobble(in);
-
- sim temp;
- temp.leftParent = left;
- temp.rightParent = right;
- temp.midpoint = mid;
- temp.score = score;
-
- IS[k].push_back(temp);
- }
- }
-
- in.close();
- remove(s.c_str());
- }
-#else
- for (int i = 0; i < querySeqs.size(); i++) {
- IS[i] = findIS(i);
- }
-#endif
- }
- catch(exception& e) {
- errorOut(e, "ChimeraCheckRDP", "createProcessesIS");
- exit(1);
- }
-}
-
-//***************************************************************************************************************