5 * Created by Sarah Westcott on 7/9/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
11 #include "ignoregaps.h"
12 #include "eachgapdist.h"
14 //********************************************************************************************************************
15 //sorts lowest to highest
16 inline bool compareQuanMembers(quanMember left, quanMember right){
17 return (left.score < right.score);
19 //***************************************************************************************************************
21 Pintail::Pintail(string filename, string temp) { fastafile = filename; templateFile = temp; }
22 //***************************************************************************************************************
26 for (int i = 0; i < querySeqs.size(); i++) { delete querySeqs[i]; }
27 for (int i = 0; i < templateSeqs.size(); i++) { delete templateSeqs[i]; }
28 for (int i = 0; i < bestfit.size(); i++) { delete bestfit[i]; }
31 errorOut(e, "Pintail", "~Pintail");
35 //***************************************************************************************************************
36 void Pintail::print(ostream& out) {
41 for (int i = 0; i < querySeqs.size(); i++) {
43 int index = ceil(deviation[i]);
45 //is your DE value higher than the 95%
47 if (quantiles[index][4] == 0.0) {
48 chimera = "Your template does not include sequences that provide quantile values at distance " + toString(index);
50 if (DE[i] > quantiles[index][4]) { chimera = "Yes"; }
51 else { chimera = "No"; }
54 out << querySeqs[i]->getName() << '\t' << "div: " << deviation[i] << "\tstDev: " << DE[i] << "\tchimera flag: " << chimera << endl;
55 if (chimera == "Yes") {
56 mothurOut(querySeqs[i]->getName() + "\tdiv: " + toString(deviation[i]) + "\tstDev: " + toString(DE[i]) + "\tchimera flag: " + chimera); mothurOutEndLine();
60 for (int j = 0; j < obsDistance[i].size(); j++) { out << obsDistance[i][j] << '\t'; }
65 for (int m = 0; m < expectedDistance[i].size(); m++) { out << expectedDistance[i][m] << '\t'; }
71 errorOut(e, "Pintail", "print");
76 //***************************************************************************************************************
77 void Pintail::getChimeras() {
80 //read in query sequences and subject sequences
81 mothurOut("Reading sequences and template file... "); cout.flush();
82 querySeqs = readSeqs(fastafile);
83 templateSeqs = readSeqs(templateFile);
84 mothurOut("Done."); mothurOutEndLine();
86 int numSeqs = querySeqs.size();
88 obsDistance.resize(numSeqs);
89 expectedDistance.resize(numSeqs);
90 seqCoef.resize(numSeqs);
93 bestfit.resize(numSeqs);
94 deviation.resize(numSeqs);
95 trimmed.resize(numSeqs);
96 windowSizes.resize(numSeqs, window);
97 windowSizesTemplate.resize(templateSeqs.size(), window);
98 windowsForeachQuery.resize(numSeqs);
100 quantiles.resize(100); //one for every percent mismatch
101 quantilesMembers.resize(100); //one for every percent mismatch
103 //break up file if needed
104 int linesPerProcess = numSeqs / processors ;
106 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
107 //find breakup of sequences for all times we will Parallelize
108 if (processors == 1) { lines.push_back(new linePair(0, numSeqs)); }
111 for (int i = 0; i < (processors-1); i++) {
112 lines.push_back(new linePair((i*linesPerProcess), ((i*linesPerProcess) + linesPerProcess)));
114 //this is necessary to get remainder of processors / numSeqs so you don't miss any lines at the end
115 int i = processors - 1;
116 lines.push_back(new linePair((i*linesPerProcess), numSeqs));
119 //find breakup of templatefile for quantiles
120 if (processors == 1) { templateLines.push_back(new linePair(0, templateSeqs.size())); }
122 for (int i = 0; i < processors; i++) {
123 templateLines.push_back(new linePair());
124 templateLines[i]->start = int (sqrt(float(i)/float(processors)) * templateSeqs.size());
125 templateLines[i]->end = int (sqrt(float(i+1)/float(processors)) * templateSeqs.size());
129 lines.push_back(new linePair(0, numSeqs));
130 templateLines.push_back(new linePair(0, templateSeqs.size()));
133 distcalculator = new eachGapDist();
134 decalc = new DeCalculator();
136 //if the user does enter a mask then you want to keep all the spots in the alignment
137 if (seqMask.length() == 0) { decalc->setAlignmentLength(querySeqs[0]->getAligned().length()); }
138 else { decalc->setAlignmentLength(seqMask.length()); }
140 decalc->setMask(seqMask);
143 if (processors == 1) {
144 mothurOut("Finding closest sequence in template to each sequence... "); cout.flush();
145 bestfit = findPairs(lines[0]->start, lines[0]->end);
146 mothurOut("Done."); mothurOutEndLine();
147 }else { createProcessesPairs(); }
149 string o = "closestmatch.eachgap.fasta";
151 openOutputFile(o, out7);
153 for (int i = 0; i < bestfit.size(); i++) {
154 out7 << ">" << querySeqs[i]->getName() << "-"<< bestfit[i]->getName() << endl;
155 out7 << bestfit[i]->getAligned() << endl;
159 mothurOut("Getting conservation... "); cout.flush();
160 if (consfile == "") {
161 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();
162 probabilityProfile = decalc->calcFreq(templateSeqs, templateFile);
163 mothurOut("Done."); mothurOutEndLine();
164 }else { probabilityProfile = readFreq(); }
167 for (int i = 0; i < probabilityProfile.size(); i++) { probabilityProfile[i] = 1 - probabilityProfile[i]; } //cout << i << '\t' << probabilityProfile[i] << endl;
168 mothurOut("Done."); mothurOutEndLine();
170 //mask sequences if the user wants to
173 for (int i = 0; i < querySeqs.size(); i++) {
174 decalc->runMask(querySeqs[i]);
178 for (int i = 0; i < templateSeqs.size(); i++) {
179 decalc->runMask(templateSeqs[i]);
182 for (int i = 0; i < bestfit.size(); i++) {
183 decalc->runMask(bestfit[i]);
189 vector<Sequence*> temp = templateSeqs;
190 for (int i = 0; i < querySeqs.size(); i++) { temp.push_back(querySeqs[i]); }
194 runFilter(querySeqs);
195 runFilter(templateSeqs);
200 if (processors == 1) {
202 for (int j = 0; j < bestfit.size(); j++) {
203 decalc->trimSeqs(querySeqs[j], bestfit[j], trimmed[j]);
206 mothurOut("Finding window breaks... "); cout.flush();
207 for (int i = lines[0]->start; i < lines[0]->end; i++) {
208 it = trimmed[i].begin();
209 vector<int> win = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
210 windowsForeachQuery[i] = win;
212 mothurOut("Done."); mothurOutEndLine();
214 }else { createProcessesSpots(); }
216 if (processors == 1) {
218 mothurOut("Calculating observed distance... "); cout.flush();
219 for (int i = lines[0]->start; i < lines[0]->end; i++) {
220 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
222 obsDistance[i] = obsi;
224 mothurOut("Done."); mothurOutEndLine();
227 mothurOut("Finding variability... "); cout.flush();
228 for (int i = lines[0]->start; i < lines[0]->end; i++) {
229 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
233 mothurOut("Done."); mothurOutEndLine();
236 mothurOut("Calculating alpha... "); cout.flush();
237 for (int i = lines[0]->start; i < lines[0]->end; i++) {
238 float alpha = decalc->getCoef(obsDistance[i], Qav[i]);
241 mothurOut("Done."); mothurOutEndLine();
244 mothurOut("Calculating expected distance... "); cout.flush();
245 for (int i = lines[0]->start; i < lines[0]->end; i++) {
246 vector<float> exp = decalc->calcExpected(Qav[i], seqCoef[i]);
247 expectedDistance[i] = exp;
249 mothurOut("Done."); mothurOutEndLine();
252 mothurOut("Finding deviation... "); cout.flush();
253 for (int i = lines[0]->start; i < lines[0]->end; i++) {
254 float de = decalc->calcDE(obsDistance[i], expectedDistance[i]);
257 it = trimmed[i].begin();
258 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
261 mothurOut("Done."); mothurOutEndLine();
264 else { createProcesses(); }
266 //quantiles are used to determine whether the de values found indicate a chimera
267 //if you have to calculate them, its time intensive because you are finding the de and deviation values for each
268 //combination of sequences in the template
269 if (quanfile != "") { quantiles = readQuantiles(); }
272 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();
273 if (processors == 1) {
274 quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
275 }else { createProcessesQuan(); }
279 string noOutliers, outliers;
281 if ((!filter) && (seqMask == "")) {
282 noOutliers = getRootName(templateFile) + "pintail.quan";
283 }else if ((filter) && (seqMask == "")) {
284 noOutliers = getRootName(templateFile) + "pintail.filtered.quan";
285 }else if ((!filter) && (seqMask != "")) {
286 noOutliers = getRootName(templateFile) + "pintail.masked.quan";
287 }else if ((filter) && (seqMask != "")) {
288 noOutliers = getRootName(templateFile) + "pintail.filtered.masked.quan";
291 //outliers = getRootName(templateFile) + "pintail.quanYESOUTLIERS";
293 /*openOutputFile(outliers, out4);
296 for (int i = 0; i < quantilesMembers.size(); i++) {
299 if (quantilesMembers[i].size() == 0) {
300 //in case this is not a distance found in your template files
301 for (int g = 0; g < 6; g++) {
306 sort(quantilesMembers[i].begin(), quantilesMembers[i].end(), compareQuanMembers);
309 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.10)].score);
311 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.25)].score);
313 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.5)].score);
315 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.75)].score);
317 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.95)].score);
319 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.99)].score);
325 for (int u = 0; u < temp.size(); u++) { out4 << temp[u] << '\t'; }
334 decalc->removeObviousOutliers(quantilesMembers, templateSeqs.size());
336 openOutputFile(noOutliers, out5);
339 for (int i = 0; i < quantilesMembers.size(); i++) {
342 if (quantilesMembers[i].size() == 0) {
343 //in case this is not a distance found in your template files
344 for (int g = 0; g < 6; g++) {
349 sort(quantilesMembers[i].begin(), quantilesMembers[i].end(), compareQuanMembers);
352 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.10)].score);
354 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.25)].score);
356 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.5)].score);
358 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.75)].score);
360 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.95)].score);
362 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.99)].score);
368 for (int u = 0; u < temp.size(); u++) { out5 << temp[u] << '\t'; }
375 mothurOut("Done."); mothurOutEndLine();
380 for (int i = 0; i < lines.size(); i++) { delete lines[i]; }
381 for (int i = 0; i < templateLines.size(); i++) { delete templateLines[i]; }
383 delete distcalculator;
386 catch(exception& e) {
387 errorOut(e, "Pintail", "getChimeras");
392 //***************************************************************************************************************
394 vector<float> Pintail::readFreq() {
398 openInputFile(consfile, in);
401 set<int> h = decalc->getPos(); //positions of bases in masking sequence
403 //read in probabilities and store in vector
410 if (h.count(pos) > 0) {
412 Pi = (num - 0.25) / 0.75;
414 //cannot have probability less than 0.
415 if (Pi < 0) { Pi = 0.0; }
417 //do you want this spot
428 catch(exception& e) {
429 errorOut(e, "Pintail", "readFreq");
434 //***************************************************************************************************************
435 //calculate the distances from each query sequence to all sequences in the template to find the closest sequence
436 vector<Sequence*> Pintail::findPairs(int start, int end) {
439 vector<Sequence*> seqsMatches;
441 for(int i = start; i < end; i++){
443 float smallest = 10000.0;
444 Sequence query = *(querySeqs[i]);
447 for(int j = 0; j < templateSeqs.size(); j++){
449 Sequence temp = *(templateSeqs[j]);
451 distcalculator->calcDist(query, temp);
452 float dist = distcalculator->getDist();
454 if (dist < smallest) {
455 match = templateSeqs[j];
460 //make copy so trimSeqs doesn't overtrim
461 Sequence* copy = new Sequence(match->getName(), match->getAligned());
463 seqsMatches.push_back(copy);
469 catch(exception& e) {
470 errorOut(e, "Pintail", "findPairs");
475 /**************************************************************************************************/
477 void Pintail::createProcessesSpots() {
479 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
481 vector<int> processIDS;
483 //loop through and create all the processes you want
484 while (process != processors) {
488 processIDS.push_back(pid);
492 for (int j = lines[process]->start; j < lines[process]->end; j++) {
494 //chops off beginning and end of sequences so they both start and end with a base
497 decalc->trimSeqs(querySeqs[j], bestfit[j], trim);
502 mothurOut("Finding window breaks for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
503 for (int i = lines[process]->start; i < lines[process]->end; i++) {
504 it = trimmed[i].begin();
505 windowsForeachQuery[i] = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
507 mothurOut("Done finding window breaks for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
509 //write out data to file so parent can read it
511 string s = toString(getpid()) + ".temp";
512 openOutputFile(s, out);
514 //output windowsForeachQuery
515 for (int i = lines[process]->start; i < lines[process]->end; i++) {
516 out << windowsForeachQuery[i].size() << '\t';
517 for (int j = 0; j < windowsForeachQuery[i].size(); j++) {
518 out << windowsForeachQuery[i][j] << '\t';
524 for (int i = lines[process]->start; i < lines[process]->end; i++) {
525 out << windowSizes[i] << '\t';
529 //output trimmed values
530 for (int i = lines[process]->start; i < lines[process]->end; i++) {
531 it = trimmed[i].begin();
532 out << it->first << '\t' << it->second << endl;
537 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
540 //force parent to wait until all the processes are done
541 for (int i=0;i<processors;i++) {
542 int temp = processIDS[i];
546 //get data created by processes
547 for (int i=0;i<processors;i++) {
549 string s = toString(processIDS[i]) + ".temp";
550 openInputFile(s, in);
552 int size = lines[i]->end - lines[i]->start;
554 int count = lines[i]->start;
555 for (int m = 0; m < size; m++) {
559 vector<int> win; int w;
560 for (int j = 0; j < num; j++) {
565 windowsForeachQuery[count] = win;
571 count = lines[i]->start;
572 for (int m = 0; m < size; m++) {
576 windowSizes[count] = num;
582 count = lines[i]->start;
583 for (int m = 0; m < size; m++) {
604 for (int j = 0; j < bestfit.size(); j++) {
605 //chops off beginning and end of sequences so they both start and end with a base
606 decalc->trimSeqs(querySeqs[j], bestfit[j], trimmed[j]);
609 for (int i = lines[0]->start; i < lines[0]->end; i++) {
610 it = trimmed[i].begin();
611 vector<int> win = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
612 windowsForeachQuery[i] = win;
617 catch(exception& e) {
618 errorOut(e, "Pintail", "createProcessesSpots");
622 /**************************************************************************************************/
624 void Pintail::createProcessesPairs() {
626 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
628 vector<int> processIDS;
630 //loop through and create all the processes you want
631 while (process != processors) {
635 processIDS.push_back(pid);
639 mothurOut("Finding pairs for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
640 bestfit = findPairs(lines[process]->start, lines[process]->end);
641 mothurOut("Done finding pairs for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
643 //write out data to file so parent can read it
645 string s = toString(getpid()) + ".temp";
646 openOutputFile(s, out);
648 //output range and size
649 out << bestfit.size() << endl;
652 for (int i = 0; i < bestfit.size(); i++) {
653 out << ">" << bestfit[i]->getName() << endl << bestfit[i]->getAligned() << endl;
658 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
661 //force parent to wait until all the processes are done
662 for (int i=0;i<processors;i++) {
663 int temp = processIDS[i];
667 //get data created by processes
668 for (int i=0;i<processors;i++) {
670 string s = toString(processIDS[i]) + ".temp";
671 openInputFile(s, in);
674 in >> size; gobble(in);
677 int count = lines[i]->start;
678 for (int m = 0; m < size; m++) {
679 Sequence* temp = new Sequence(in);
680 bestfit[count] = temp;
692 bestfit = findPairs(lines[0]->start, lines[0]->end);
695 catch(exception& e) {
696 errorOut(e, "Pintail", "createProcessesPairs");
700 /**************************************************************************************************/
702 void Pintail::createProcesses() {
704 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
706 vector<int> processIDS;
708 //loop through and create all the processes you want
709 while (process != processors) {
713 processIDS.push_back(pid);
717 mothurOut("Calculating observed, expected and de values for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
718 for (int i = lines[process]->start; i < lines[process]->end; i++) {
720 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
721 obsDistance[i] = obsi;
724 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
727 float alpha = decalc->getCoef(obsDistance[i], q);
730 vector<float> exp = decalc->calcExpected(q, alpha);
731 expectedDistance[i] = exp;
733 //get de and deviation
734 float dei = decalc->calcDE(obsi, exp);
737 it = trimmed[i].begin();
738 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
741 mothurOut("Done calculating observed, expected and de values for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
743 //write out data to file so parent can read it
745 string s = toString(getpid()) + ".temp";
746 openOutputFile(s, out);
748 int size = lines[process]->end - lines[process]->start;
751 //output observed distances
752 for (int i = lines[process]->start; i < lines[process]->end; i++) {
753 out << obsDistance[i].size() << '\t';
754 for (int j = 0; j < obsDistance[i].size(); j++) {
755 out << obsDistance[i][j] << '\t';
761 //output expected distances
762 for (int i = lines[process]->start; i < lines[process]->end; i++) {
763 out << expectedDistance[i].size() << '\t';
764 for (int j = 0; j < expectedDistance[i].size(); j++) {
765 out << expectedDistance[i][j] << '\t';
772 for (int i = lines[process]->start; i < lines[process]->end; i++) {
773 out << DE[i] << '\t';
778 for (int i = lines[process]->start; i < lines[process]->end; i++) {
779 out << deviation[i] << '\t';
786 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
789 //force parent to wait until all the processes are done
790 for (int i=0;i<processors;i++) {
791 int temp = processIDS[i];
795 //get data created by processes
796 for (int i=0;i<processors;i++) {
798 string s = toString(processIDS[i]) + ".temp";
799 openInputFile(s, in);
802 in >> size; gobble(in);
804 //get observed distances
805 int count = lines[i]->start;
806 for (int m = 0; m < size; m++) {
810 vector<float> obs; float w;
811 for (int j = 0; j < num; j++) {
816 obsDistance[count] = obs;
823 //get expected distances
824 count = lines[i]->start;
825 for (int m = 0; m < size; m++) {
829 vector<float> exp; float w;
830 for (int j = 0; j < num; j++) {
835 expectedDistance[count] = exp;
842 count = lines[i]->start;
843 for (int m = 0; m < size; m++) {
853 count = lines[i]->start;
854 for (int m = 0; m < size; m++) {
858 deviation[count] = num;
868 mothurOut("Calculating observed distance... "); cout.flush();
869 for (int i = lines[0]->start; i < lines[0]->end; i++) {
870 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
871 obsDistance[i] = obsi;
873 mothurOut("Done."); mothurOutEndLine();
877 mothurOut("Finding variability... "); cout.flush();
878 for (int i = lines[0]->start; i < lines[0]->end; i++) {
879 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
882 mothurOut("Done."); mothurOutEndLine();
886 mothurOut("Calculating alpha... "); cout.flush();
887 for (int i = lines[0]->start; i < lines[0]->end; i++) {
888 float alpha = decalc->getCoef(obsDistance[i], Qav[i]);
889 seqCoef.push_back(alpha);
891 mothurOut("Done."); mothurOutEndLine();
895 mothurOut("Calculating expected distance... "); cout.flush();
896 for (int i = lines[0]->start; i < lines[0]->end; i++) {
897 vector<float> exp = decalc->calcExpected(Qav[i], seqCoef[i]);
898 expectedDistance[i] = exp;
900 mothurOut("Done."); mothurOutEndLine();
904 mothurOut("Finding deviation... "); cout.flush();
905 for (int i = lines[0]->start; i < lines[0]->end; i++) {
906 float de = decalc->calcDE(obsDistance[i], expectedDistance[i]);
909 it = trimmed[i].begin();
910 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
913 mothurOut("Done."); mothurOutEndLine();
917 catch(exception& e) {
918 errorOut(e, "Pintail", "createProcesses");
924 /**************************************************************************************************/
926 void Pintail::createProcessesQuan() {
928 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
930 vector<int> processIDS;
932 //loop through and create all the processes you want
933 while (process != processors) {
937 processIDS.push_back(pid);
941 quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, templateLines[process]->start, templateLines[process]->end);
943 //write out data to file so parent can read it
945 string s = toString(getpid()) + ".temp";
946 openOutputFile(s, out);
949 //output observed distances
950 for (int i = 0; i < quantilesMembers.size(); i++) {
951 out << quantilesMembers[i].size() << '\t';
952 for (int j = 0; j < quantilesMembers[i].size(); j++) {
953 out << quantilesMembers[i][j].score << '\t' << quantilesMembers[i][j].member1 << '\t' << quantilesMembers[i][j].member2 << '\t';
961 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
964 //force parent to wait until all the processes are done
965 for (int i=0;i<processors;i++) {
966 int temp = processIDS[i];
970 //get data created by processes
971 for (int i=0;i<processors;i++) {
973 string s = toString(processIDS[i]) + ".temp";
974 openInputFile(s, in);
976 vector< vector<quanMember> > quan;
980 for (int m = 0; m < quan.size(); m++) {
986 vector<quanMember> q; float w; int b, n;
987 for (int j = 0; j < num; j++) {
989 //cout << w << '\t' << b << '\t' n << endl;
990 quanMember newMember(w, b, n);
991 q.push_back(newMember);
993 //cout << "here" << endl;
995 //cout << "now here" << endl;
1000 //save quan in quantiles
1001 for (int j = 0; j < quan.size(); j++) {
1002 //put all values of q[i] into quan[i]
1003 for (int l = 0; l < quan[j].size(); l++) { quantilesMembers[j].push_back(quan[j][l]); }
1004 //quantilesMembers[j].insert(quantilesMembers[j].begin(), quan[j].begin(), quan[j].end());
1012 quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
1015 catch(exception& e) {
1016 errorOut(e, "Pintail", "createProcessesQuan");
1022 //***************************************************************************************************************