5 * Created by Sarah Westcott on 7/9/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
11 #include "ignoregaps.h"
13 //***************************************************************************************************************
15 Pintail::Pintail(string filename, string temp) { fastafile = filename; templateFile = temp; }
16 //***************************************************************************************************************
20 for (int i = 0; i < querySeqs.size(); i++) { delete querySeqs[i]; }
21 for (int i = 0; i < templateSeqs.size(); i++) { delete templateSeqs[i]; }
23 if (processors != 1) { for (int i = 0; i < bestfit.size(); i++) { delete bestfit[i]; } }
26 errorOut(e, "Pintail", "~Pintail");
30 //***************************************************************************************************************
31 void Pintail::print(ostream& out) {
34 for (int i = 0; i < querySeqs.size(); i++) {
36 int index = ceil(deviation[i]);
37 float quan = 2.64 * log10(deviation[i]) + 1.46;
38 cout << "dist = " << index << endl;
39 cout << "de = " << DE[i] << endl;
40 cout << "mallard quantile = " << quan << endl;
41 cout << "my quantile = " << quantiles[index][4] << endl;
43 //is your DE value higher than the 95%
45 if (DE[i] > quantiles[index][4]) { chimera = "Yes"; }
46 else { chimera = "No"; }
48 out << querySeqs[i]->getName() << '\t' << "div: " << deviation[i] << "\tstDev: " << DE[i] << "\tchimera flag: " << chimera << endl;
49 if (chimera == "Yes") {
50 mothurOut(querySeqs[i]->getName() + "\tdiv: " + toString(deviation[i]) + "\tstDev: " + toString(DE[i]) + "\tchimera flag: " + chimera); mothurOutEndLine();
54 for (int j = 0; j < obsDistance[i].size(); j++) { out << obsDistance[i][j] << '\t'; }
59 for (int m = 0; m < expectedDistance[i].size(); m++) { out << expectedDistance[i][m] << '\t'; }
65 errorOut(e, "Pintail", "print");
70 //***************************************************************************************************************
71 void Pintail::getChimeras() {
74 //read in query sequences and subject sequences
75 mothurOut("Reading sequences and template file... "); cout.flush();
76 querySeqs = readSeqs(fastafile);
77 templateSeqs = readSeqs(templateFile);
78 mothurOut("Done."); mothurOutEndLine();
80 int numSeqs = querySeqs.size();
82 obsDistance.resize(numSeqs);
83 expectedDistance.resize(numSeqs);
84 seqCoef.resize(numSeqs);
87 bestfit.resize(numSeqs);
88 deviation.resize(numSeqs);
89 trimmed.resize(numSeqs);
90 windowSizes.resize(numSeqs, window);
91 windowSizesTemplate.resize(templateSeqs.size(), window);
92 windowsForeachQuery.resize(numSeqs);
94 quantiles.resize(100); //one for every percent mismatch
96 //break up file if needed
97 int linesPerProcess = numSeqs / processors ;
99 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
100 //find breakup of sequences for all times we will Parallelize
101 if (processors == 1) { lines.push_back(new linePair(0, numSeqs)); }
104 for (int i = 0; i < (processors-1); i++) {
105 lines.push_back(new linePair((i*linesPerProcess), ((i*linesPerProcess) + linesPerProcess)));
107 //this is necessary to get remainder of processors / numSeqs so you don't miss any lines at the end
108 int i = processors - 1;
109 lines.push_back(new linePair((i*linesPerProcess), numSeqs));
112 //find breakup of templatefile for quantiles
113 if (processors == 1) { templateLines.push_back(new linePair(0, templateSeqs.size())); }
115 for (int i = 0; i < processors; i++) {
116 templateLines.push_back(new linePair());
117 templateLines[i]->start = int (sqrt(float(i)/float(processors)) * templateSeqs.size());
118 templateLines[i]->end = int (sqrt(float(i+1)/float(processors)) * templateSeqs.size());
122 lines.push_back(new linePair(0, numSeqs));
123 templateLines.push_back(new linePair(0, templateSeqs.size()));
126 distcalculator = new ignoreGaps();
127 decalc = new DeCalculator();
129 //if the user does enter a mask then you want to keep all the spots in the alignment
130 if (seqMask.length() == 0) { decalc->setAlignmentLength(querySeqs[0]->getAligned().length()); }
131 else { decalc->setAlignmentLength(seqMask.length()); }
133 decalc->setMask(seqMask);
136 if (processors == 1) {
137 mothurOut("Finding closest sequence in template to each sequence... "); cout.flush();
138 bestfit = findPairs(lines[0]->start, lines[0]->end);
139 mothurOut("Done."); mothurOutEndLine();
140 }else { createProcessesPairs(); }
143 for (int j = 0; j < bestfit.size(); j++) {
144 //chops off beginning and end of sequences so they both start and end with a base
146 string s = querySeqs[j]->getName();
148 openOutputFile(s, out);
149 out << ">" << querySeqs[j]->getName() << endl;
150 out << querySeqs[j]->getAligned() << endl;
153 string t =querySeqs[j]->getName() + ".ref";
154 openOutputFile(t, out);
155 out << ">" << bestfit[j]->getName() << endl;
156 out << bestfit[j]->getAligned() << endl;
162 mothurOut("Getting conservation... "); cout.flush();
163 if (consfile == "") {
164 mothurOut("Calculating probability of conservation for your template sequences. This can take a while... I will output the frequency of the highest base in each position to a .freq file so that you can input them using the conservation parameter next time you run this command. Providing the .freq file will improve speed. "); cout.flush();
165 probabilityProfile = decalc->calcFreq(templateSeqs, templateFile);
166 mothurOut("Done."); mothurOutEndLine();
167 }else { probabilityProfile = readFreq(); }
170 for (int i = 0; i < probabilityProfile.size(); i++) { probabilityProfile[i] = 1 - probabilityProfile[i]; } //cout << i << '\t' << probabilityProfile[i] << endl;
171 mothurOut("Done."); mothurOutEndLine();
174 for (int i = 0; i < querySeqs.size(); i++) {
175 //cout << querySeqs[i]->getName() << " before mask = " << querySeqs[i]->getAligned() << endl << endl;
176 decalc->runMask(querySeqs[i]);
177 //cout << querySeqs[i]->getName() << " after mask = " << querySeqs[i]->getAligned() << endl << endl;
181 for (int i = 0; i < templateSeqs.size(); i++) {
182 decalc->runMask(templateSeqs[i]);
185 //for (int i = 0; i < lines.size(); i++) { cout << "line pair " << i << " = " << lines[i]->start << '\t' << lines[i]->end << endl; }
187 if (processors == 1) {
189 for (int j = 0; j < bestfit.size(); j++) {
190 //cout << querySeqs[j]->getName() << " after mask = " << querySeqs[j]->getAligned() << endl << endl;
191 ///cout << bestfit[j]->getName() << " after mask = " << bestfit[j]->getAligned() << endl << endl;
192 decalc->trimSeqs(querySeqs[j], bestfit[j], trimmed[j]);
195 mothurOut("Finding window breaks... "); cout.flush();
196 for (int i = lines[0]->start; i < lines[0]->end; i++) {
197 it = trimmed[i].begin();
198 //cout << querySeqs[i]->getName() << '\t' << "trimmed = " << it->first << '\t' << it->second << endl;
199 vector<int> win = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
200 windowsForeachQuery[i] = win;
202 mothurOut("Done."); mothurOutEndLine();
204 }else { createProcessesSpots(); }
207 if (processors == 1) {
209 mothurOut("Calculating observed distance... "); cout.flush();
210 for (int i = lines[0]->start; i < lines[0]->end; i++) {
211 //cout << querySeqs[i]->getName() << '\t' << bestfit[i]->getName() << " windows = " << windowsForeachQuery[i].size() << " size = " << windowSizes[i] << endl;
212 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
214 for (int j = 0; j < obsi.size(); j++) {
215 //cout << obsi[j] << '\t';
218 obsDistance[i] = obsi;
220 mothurOut("Done."); mothurOutEndLine();
223 mothurOut("Finding variability... "); cout.flush();
224 for (int i = lines[0]->start; i < lines[0]->end; i++) {
225 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
228 //cout << querySeqs[i]->getName() << endl;
229 for (int j = 0; j < Qav[i].size(); j++) {
230 //cout << Qav[i][j] << '\t';
232 //cout << endl << endl;
235 mothurOut("Done."); mothurOutEndLine();
238 mothurOut("Calculating alpha... "); cout.flush();
239 for (int i = lines[0]->start; i < lines[0]->end; i++) {
240 float alpha = decalc->getCoef(obsDistance[i], Qav[i]);
241 //cout << querySeqs[i]->getName() << "\tcoef = " << alpha << endl;
244 mothurOut("Done."); mothurOutEndLine();
247 mothurOut("Calculating expected distance... "); cout.flush();
248 for (int i = lines[0]->start; i < lines[0]->end; i++) {
249 vector<float> exp = decalc->calcExpected(Qav[i], seqCoef[i]);
250 expectedDistance[i] = exp;
252 mothurOut("Done."); mothurOutEndLine();
255 mothurOut("Finding deviation... "); cout.flush();
256 for (int i = lines[0]->start; i < lines[0]->end; i++) {
257 float de = decalc->calcDE(obsDistance[i], expectedDistance[i]);
259 //cout << querySeqs[i]->getName() << '\t' << "de value = " << de << endl;
260 it = trimmed[i].begin();
261 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
262 //cout << querySeqs[i]->getName() << '\t' << "dist value = " << dist << endl;
265 mothurOut("Done."); mothurOutEndLine();
268 else { createProcesses(); }
271 //quantiles are used to determine whether the de values found indicate a chimera
272 //if you have to calculate them, its time intensive because you are finding the de and deviation values for each
273 //combination of sequences in the template
274 if (quanfile != "") { quantiles = readQuantiles(); }
277 mothurOut("Calculating quantiles for your template. This can take a while... I will output the quantiles to a .quan file that you can input them using the quantiles parameter next time you run this command. Providing the .quan file will dramatically improve speed. "); cout.flush();
278 if (processors == 1) {
279 quantiles = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
280 }else { createProcessesQuan(); }
283 decalc->removeObviousOutliers(quantiles);
286 string o = getRootName(templateFile) + "quan";
288 openOutputFile(o, out4);
291 for (int i = 0; i < quantiles.size(); i++) {
292 if (quantiles[i].size() == 0) {
293 //in case this is not a distance found in your template files
294 for (int g = 0; g < 6; g++) {
295 quantiles[i].push_back(0.0);
299 sort(quantiles[i].begin(), quantiles[i].end());
303 temp.push_back(quantiles[i][int(quantiles[i].size() * 0.10)]);
305 temp.push_back(quantiles[i][int(quantiles[i].size() * 0.25)]);
307 temp.push_back(quantiles[i][int(quantiles[i].size() * 0.5)]);
309 temp.push_back(quantiles[i][int(quantiles[i].size() * 0.75)]);
311 temp.push_back(quantiles[i][int(quantiles[i].size() * 0.95)]);
313 temp.push_back(quantiles[i][int(quantiles[i].size() * 0.99)]);
320 for (int u = 0; u < quantiles[i].size(); u++) { out4 << quantiles[i][u] << '\t'; }
325 mothurOut("Done."); mothurOutEndLine();
329 for (int i = 0; i < lines.size(); i++) { delete lines[i]; }
330 for (int i = 0; i < templateLines.size(); i++) { delete templateLines[i]; }
332 delete distcalculator;
335 catch(exception& e) {
336 errorOut(e, "Pintail", "getChimeras");
341 //***************************************************************************************************************
343 vector<float> Pintail::readFreq() {
347 openInputFile(consfile, in);
350 set<int> h = decalc->getPos(); //positions of bases in masking sequence
352 //read in probabilities and store in vector
359 if (h.count(pos) > 0) {
361 Pi = (num - 0.25) / 0.75;
363 //cannot have probability less than 0.
364 if (Pi < 0) { Pi = 0.0; }
366 //do you want this spot
377 catch(exception& e) {
378 errorOut(e, "Pintail", "readFreq");
383 //***************************************************************************************************************
385 vector< vector<float> > Pintail::readQuantiles() {
389 openInputFile(quanfile, in);
391 vector< vector<float> > quan;
393 int num; float ten, twentyfive, fifty, seventyfive, ninetyfive, ninetynine;
397 in >> num >> ten >> twentyfive >> fifty >> seventyfive >> ninetyfive >> ninetynine;
402 temp.push_back(twentyfive);
403 temp.push_back(fifty);
404 temp.push_back(seventyfive);
405 temp.push_back(ninetyfive);
406 temp.push_back(ninetynine);
408 quan.push_back(temp);
417 catch(exception& e) {
418 errorOut(e, "Pintail", "readQuantiles");
422 //***************************************************************************************************************
423 //calculate the distances from each query sequence to all sequences in the template to find the closest sequence
424 vector<Sequence*> Pintail::findPairs(int start, int end) {
427 vector<Sequence*> seqsMatches;
429 for(int i = start; i < end; i++){
431 float smallest = 10000.0;
432 Sequence query = *(querySeqs[i]);
435 for(int j = 0; j < templateSeqs.size(); j++){
437 Sequence temp = *(templateSeqs[j]);
439 distcalculator->calcDist(query, temp);
440 float dist = distcalculator->getDist();
442 if (dist < smallest) {
443 match = templateSeqs[j];
448 seqsMatches.push_back(match);
454 catch(exception& e) {
455 errorOut(e, "Pintail", "findPairs");
460 /**************************************************************************************************/
462 void Pintail::createProcessesSpots() {
464 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
466 vector<int> processIDS;
468 //loop through and create all the processes you want
469 while (process != processors) {
473 processIDS.push_back(pid);
477 for (int j = lines[process]->start; j < lines[process]->end; j++) {
479 //chops off beginning and end of sequences so they both start and end with a base
481 decalc->trimSeqs(querySeqs[j], bestfit[j], trim);
486 mothurOut("Finding window breaks for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
487 for (int i = lines[process]->start; i < lines[process]->end; i++) {
488 it = trimmed[i].begin();
489 windowsForeachQuery[i] = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
491 mothurOut("Done finding window breaks for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
493 //write out data to file so parent can read it
495 string s = toString(getpid()) + ".temp";
496 openOutputFile(s, out);
498 //output windowsForeachQuery
499 for (int i = lines[process]->start; i < lines[process]->end; i++) {
500 out << windowsForeachQuery[i].size() << '\t';
501 for (int j = 0; j < windowsForeachQuery[i].size(); j++) {
502 out << windowsForeachQuery[i][j] << '\t';
508 for (int i = lines[process]->start; i < lines[process]->end; i++) {
509 out << windowSizes[i] << '\t';
513 //output trimmed values
514 for (int i = lines[process]->start; i < lines[process]->end; i++) {
515 it = trimmed[i].begin();
517 out << it->first << '\t' << it->second << endl;
522 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
525 //force parent to wait until all the processes are done
526 for (int i=0;i<processors;i++) {
527 int temp = processIDS[i];
531 //get data created by processes
532 for (int i=0;i<processors;i++) {
534 string s = toString(processIDS[i]) + ".temp";
535 openInputFile(s, in);
537 int size = lines[i]->end - lines[i]->start;
539 int count = lines[i]->start;
540 for (int m = 0; m < size; m++) {
544 vector<int> win; int w;
545 for (int j = 0; j < num; j++) {
550 windowsForeachQuery[count] = win;
556 count = lines[i]->start;
557 for (int m = 0; m < size; m++) {
561 windowSizes[count] = num;
567 count = lines[i]->start;
568 for (int m = 0; m < size; m++) {
589 for (int j = 0; j < bestfit.size(); j++) {
590 //chops off beginning and end of sequences so they both start and end with a base
591 decalc->trimSeqs(querySeqs[j], bestfit[j], trimmed[j]);
594 for (int i = lines[0]->start; i < lines[0]->end; i++) {
595 it = trimmed[i].begin();
596 vector<int> win = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
597 windowsForeachQuery[i] = win;
602 catch(exception& e) {
603 errorOut(e, "Pintail", "createProcessesSpots");
607 /**************************************************************************************************/
609 void Pintail::createProcessesPairs() {
611 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
613 vector<int> processIDS;
615 //loop through and create all the processes you want
616 while (process != processors) {
620 processIDS.push_back(pid);
624 mothurOut("Finding pairs for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
625 bestfit = findPairs(lines[process]->start, lines[process]->end);
626 mothurOut("Done finding pairs for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
628 //write out data to file so parent can read it
630 string s = toString(getpid()) + ".temp";
631 openOutputFile(s, out);
633 //output range and size
634 out << bestfit.size() << endl;
637 for (int i = 0; i < bestfit.size(); i++) {
638 out << ">" << bestfit[i]->getName() << endl << bestfit[i]->getAligned() << endl;
643 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
646 //force parent to wait until all the processes are done
647 for (int i=0;i<processors;i++) {
648 int temp = processIDS[i];
652 //get data created by processes
653 for (int i=0;i<processors;i++) {
655 string s = toString(processIDS[i]) + ".temp";
656 openInputFile(s, in);
659 in >> size; gobble(in);
662 int count = lines[i]->start;
663 for (int m = 0; m < size; m++) {
664 Sequence* temp = new Sequence(in);
665 bestfit[count] = temp;
677 bestfit = findPairs(lines[0]->start, lines[0]->end);
680 catch(exception& e) {
681 errorOut(e, "Pintail", "createProcessesPairs");
685 /**************************************************************************************************/
687 void Pintail::createProcesses() {
689 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
691 vector<int> processIDS;
693 //loop through and create all the processes you want
694 while (process != processors) {
698 processIDS.push_back(pid);
702 mothurOut("Calculating observed, expected and de values for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
703 for (int i = lines[process]->start; i < lines[process]->end; i++) {
705 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
706 obsDistance[i] = obsi;
709 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
712 float alpha = decalc->getCoef(obsDistance[i], q);
715 vector<float> exp = decalc->calcExpected(q, alpha);
716 expectedDistance[i] = exp;
718 //get de and deviation
719 float dei = decalc->calcDE(obsi, exp);
722 it = trimmed[i].begin();
723 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
726 mothurOut("Done calculating observed, expected and de values for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
728 //write out data to file so parent can read it
730 string s = toString(getpid()) + ".temp";
731 openOutputFile(s, out);
733 int size = lines[process]->end - lines[process]->start;
736 //output observed distances
737 for (int i = lines[process]->start; i < lines[process]->end; i++) {
738 out << obsDistance[i].size() << '\t';
739 for (int j = 0; j < obsDistance[i].size(); j++) {
740 out << obsDistance[i][j] << '\t';
746 //output expected distances
747 for (int i = lines[process]->start; i < lines[process]->end; i++) {
748 out << expectedDistance[i].size() << '\t';
749 for (int j = 0; j < expectedDistance[i].size(); j++) {
750 out << expectedDistance[i][j] << '\t';
757 for (int i = lines[process]->start; i < lines[process]->end; i++) {
758 out << DE[i] << '\t';
763 for (int i = lines[process]->start; i < lines[process]->end; i++) {
764 out << deviation[i] << '\t';
771 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
774 //force parent to wait until all the processes are done
775 for (int i=0;i<processors;i++) {
776 int temp = processIDS[i];
780 //get data created by processes
781 for (int i=0;i<processors;i++) {
783 string s = toString(processIDS[i]) + ".temp";
784 openInputFile(s, in);
787 in >> size; gobble(in);
789 //get observed distances
790 int count = lines[i]->start;
791 for (int m = 0; m < size; m++) {
795 vector<float> obs; float w;
796 for (int j = 0; j < num; j++) {
801 obsDistance[count] = obs;
808 //get expected distances
809 count = lines[i]->start;
810 for (int m = 0; m < size; m++) {
814 vector<float> exp; float w;
815 for (int j = 0; j < num; j++) {
820 expectedDistance[count] = exp;
827 count = lines[i]->start;
828 for (int m = 0; m < size; m++) {
838 count = lines[i]->start;
839 for (int m = 0; m < size; m++) {
843 deviation[count] = num;
853 mothurOut("Calculating observed distance... "); cout.flush();
854 for (int i = lines[0]->start; i < lines[0]->end; i++) {
855 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
856 obsDistance[i] = obsi;
858 mothurOut("Done."); mothurOutEndLine();
862 mothurOut("Finding variability... "); cout.flush();
863 for (int i = lines[0]->start; i < lines[0]->end; i++) {
864 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
867 mothurOut("Done."); mothurOutEndLine();
871 mothurOut("Calculating alpha... "); cout.flush();
872 for (int i = lines[0]->start; i < lines[0]->end; i++) {
873 float alpha = decalc->getCoef(obsDistance[i], Qav[i]);
874 seqCoef.push_back(alpha);
876 mothurOut("Done."); mothurOutEndLine();
880 mothurOut("Calculating expected distance... "); cout.flush();
881 for (int i = lines[0]->start; i < lines[0]->end; i++) {
882 vector<float> exp = decalc->calcExpected(Qav[i], seqCoef[i]);
883 expectedDistance[i] = exp;
885 mothurOut("Done."); mothurOutEndLine();
889 mothurOut("Finding deviation... "); cout.flush();
890 for (int i = lines[0]->start; i < lines[0]->end; i++) {
891 float de = decalc->calcDE(obsDistance[i], expectedDistance[i]);
894 it = trimmed[i].begin();
895 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
898 mothurOut("Done."); mothurOutEndLine();
902 catch(exception& e) {
903 errorOut(e, "Pintail", "createProcesses");
909 /**************************************************************************************************/
911 void Pintail::createProcessesQuan() {
913 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
915 vector<int> processIDS;
917 //loop through and create all the processes you want
918 while (process != processors) {
922 processIDS.push_back(pid);
926 quantiles = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, templateLines[process]->start, templateLines[process]->end);
928 //write out data to file so parent can read it
930 string s = toString(getpid()) + ".temp";
931 openOutputFile(s, out);
934 //output observed distances
935 for (int i = 0; i < quantiles.size(); i++) {
936 out << quantiles[i].size() << '\t';
937 for (int j = 0; j < quantiles[i].size(); j++) {
938 out << quantiles[i][j] << '\t';
946 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
949 //force parent to wait until all the processes are done
950 for (int i=0;i<processors;i++) {
951 int temp = processIDS[i];
955 //get data created by processes
956 for (int i=0;i<processors;i++) {
958 string s = toString(processIDS[i]) + ".temp";
959 openInputFile(s, in);
961 vector< vector<float> > quan; quan.resize(100);
964 for (int m = 0; m < quan.size(); m++) {
968 vector<float> q; float w;
969 for (int j = 0; j < num; j++) {
979 //save quan in quantiles
980 for (int i = 0; i < quan.size(); i++) {
981 //put all values of q[i] into quan[i]
982 quantiles[i].insert(quantiles[i].begin(), quan[i].begin(), quan[i].end());
990 quantiles = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
993 catch(exception& e) {
994 errorOut(e, "Pintail", "createProcessesQuan");
1000 //***************************************************************************************************************