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, string o) { fastafile = filename; templateFile = temp; outputDir = o; }
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 int 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 if (unaligned) { mothurOut("Your sequences need to be aligned when you use the pintail method."); mothurOutEndLine(); return 1; }
90 obsDistance.resize(numSeqs);
91 expectedDistance.resize(numSeqs);
92 seqCoef.resize(numSeqs);
95 bestfit.resize(numSeqs);
96 deviation.resize(numSeqs);
97 trimmed.resize(numSeqs);
98 windowSizes.resize(numSeqs, window);
99 windowSizesTemplate.resize(templateSeqs.size(), window);
100 windowsForeachQuery.resize(numSeqs);
102 quantiles.resize(100); //one for every percent mismatch
103 quantilesMembers.resize(100); //one for every percent mismatch
105 //break up file if needed
106 int linesPerProcess = numSeqs / processors ;
108 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
109 //find breakup of sequences for all times we will Parallelize
110 if (processors == 1) { lines.push_back(new linePair(0, numSeqs)); }
113 for (int i = 0; i < (processors-1); i++) {
114 lines.push_back(new linePair((i*linesPerProcess), ((i*linesPerProcess) + linesPerProcess)));
116 //this is necessary to get remainder of processors / numSeqs so you don't miss any lines at the end
117 int i = processors - 1;
118 lines.push_back(new linePair((i*linesPerProcess), numSeqs));
121 //find breakup of templatefile for quantiles
122 if (processors == 1) { templateLines.push_back(new linePair(0, templateSeqs.size())); }
124 for (int i = 0; i < processors; i++) {
125 templateLines.push_back(new linePair());
126 templateLines[i]->start = int (sqrt(float(i)/float(processors)) * templateSeqs.size());
127 templateLines[i]->end = int (sqrt(float(i+1)/float(processors)) * templateSeqs.size());
131 lines.push_back(new linePair(0, numSeqs));
132 templateLines.push_back(new linePair(0, templateSeqs.size()));
135 distcalculator = new eachGapDist();
136 decalc = new DeCalculator();
138 //if the user does enter a mask then you want to keep all the spots in the alignment
139 if (seqMask.length() == 0) { decalc->setAlignmentLength(querySeqs[0]->getAligned().length()); }
140 else { decalc->setAlignmentLength(seqMask.length()); }
142 decalc->setMask(seqMask);
145 if (processors == 1) {
146 mothurOut("Finding closest sequence in template to each sequence... "); cout.flush();
147 bestfit = findPairs(lines[0]->start, lines[0]->end);
148 mothurOut("Done."); mothurOutEndLine();
149 }else { createProcessesPairs(); }
151 //string o = "closestmatch.eachgap.fasta";
153 //openOutputFile(o, out7);
155 //for (int i = 0; i < bestfit.size(); i++) {
156 //out7 << ">" << querySeqs[i]->getName() << "-"<< bestfit[i]->getName() << endl;
157 //out7 << bestfit[i]->getAligned() << endl;
161 mothurOut("Getting conservation... "); cout.flush();
162 if (consfile == "") {
163 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();
164 probabilityProfile = decalc->calcFreq(templateSeqs, outputDir + getSimpleName(templateFile));
165 mothurOut("Done."); mothurOutEndLine();
166 }else { probabilityProfile = readFreq(); }
169 for (int i = 0; i < probabilityProfile.size(); i++) { probabilityProfile[i] = 1 - probabilityProfile[i]; } //cout << i << '\t' << probabilityProfile[i] << endl;
170 mothurOut("Done."); mothurOutEndLine();
172 //mask sequences if the user wants to
175 for (int i = 0; i < querySeqs.size(); i++) {
176 decalc->runMask(querySeqs[i]);
180 for (int i = 0; i < templateSeqs.size(); i++) {
181 decalc->runMask(templateSeqs[i]);
184 for (int i = 0; i < bestfit.size(); i++) {
185 decalc->runMask(bestfit[i]);
191 vector<Sequence*> temp = templateSeqs;
192 for (int i = 0; i < querySeqs.size(); i++) { temp.push_back(querySeqs[i]); }
196 runFilter(querySeqs);
197 runFilter(templateSeqs);
202 if (processors == 1) {
204 for (int j = 0; j < bestfit.size(); j++) {
205 decalc->trimSeqs(querySeqs[j], bestfit[j], trimmed[j]);
208 mothurOut("Finding window breaks... "); cout.flush();
209 for (int i = lines[0]->start; i < lines[0]->end; i++) {
210 it = trimmed[i].begin();
211 vector<int> win = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
212 windowsForeachQuery[i] = win;
214 mothurOut("Done."); mothurOutEndLine();
216 }else { createProcessesSpots(); }
218 if (processors == 1) {
220 mothurOut("Calculating observed distance... "); cout.flush();
221 for (int i = lines[0]->start; i < lines[0]->end; i++) {
222 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
224 obsDistance[i] = obsi;
226 mothurOut("Done."); mothurOutEndLine();
229 mothurOut("Finding variability... "); cout.flush();
230 for (int i = lines[0]->start; i < lines[0]->end; i++) {
231 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
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]);
243 mothurOut("Done."); mothurOutEndLine();
246 mothurOut("Calculating expected distance... "); cout.flush();
247 for (int i = lines[0]->start; i < lines[0]->end; i++) {
248 vector<float> exp = decalc->calcExpected(Qav[i], seqCoef[i]);
249 expectedDistance[i] = exp;
251 mothurOut("Done."); mothurOutEndLine();
254 mothurOut("Finding deviation... "); cout.flush();
255 for (int i = lines[0]->start; i < lines[0]->end; i++) {
256 float de = decalc->calcDE(obsDistance[i], expectedDistance[i]);
259 it = trimmed[i].begin();
260 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
263 mothurOut("Done."); mothurOutEndLine();
266 else { createProcesses(); }
268 //quantiles are used to determine whether the de values found indicate a chimera
269 //if you have to calculate them, its time intensive because you are finding the de and deviation values for each
270 //combination of sequences in the template
271 if (quanfile != "") { quantiles = readQuantiles(); }
274 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();
275 if (processors == 1) {
276 quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
277 }else { createProcessesQuan(); }
281 string noOutliers, outliers;
283 if ((!filter) && (seqMask == "")) {
284 noOutliers = outputDir + getRootName(getSimpleName(templateFile)) + "pintail.quan";
285 }else if ((filter) && (seqMask == "")) {
286 noOutliers = outputDir + getRootName(getSimpleName(templateFile)) + "pintail.filtered.quan";
287 }else if ((!filter) && (seqMask != "")) {
288 noOutliers = outputDir + getRootName(getSimpleName(templateFile)) + "pintail.masked.quan";
289 }else if ((filter) && (seqMask != "")) {
290 noOutliers = outputDir + getRootName(getSimpleName(templateFile)) + "pintail.filtered.masked.quan";
293 //outliers = getRootName(templateFile) + "pintail.quanYESOUTLIERS";
295 /*openOutputFile(outliers, out4);
298 for (int i = 0; i < quantilesMembers.size(); i++) {
301 if (quantilesMembers[i].size() == 0) {
302 //in case this is not a distance found in your template files
303 for (int g = 0; g < 6; g++) {
308 sort(quantilesMembers[i].begin(), quantilesMembers[i].end(), compareQuanMembers);
311 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.10)].score);
313 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.25)].score);
315 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.5)].score);
317 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.75)].score);
319 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.95)].score);
321 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.99)].score);
327 for (int u = 0; u < temp.size(); u++) { out4 << temp[u] << '\t'; }
336 decalc->removeObviousOutliers(quantilesMembers, templateSeqs.size());
338 openOutputFile(noOutliers, out5);
341 for (int i = 0; i < quantilesMembers.size(); i++) {
344 if (quantilesMembers[i].size() == 0) {
345 //in case this is not a distance found in your template files
346 for (int g = 0; g < 6; g++) {
351 sort(quantilesMembers[i].begin(), quantilesMembers[i].end(), compareQuanMembers);
354 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.10)].score);
356 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.25)].score);
358 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.5)].score);
360 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.75)].score);
362 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.95)].score);
364 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.99)].score);
370 for (int u = 0; u < temp.size(); u++) { out5 << temp[u] << '\t'; }
377 mothurOut("Done."); mothurOutEndLine();
382 for (int i = 0; i < lines.size(); i++) { delete lines[i]; }
383 for (int i = 0; i < templateLines.size(); i++) { delete templateLines[i]; }
385 delete distcalculator;
390 catch(exception& e) {
391 errorOut(e, "Pintail", "getChimeras");
396 //***************************************************************************************************************
398 vector<float> Pintail::readFreq() {
402 openInputFile(consfile, in);
405 set<int> h = decalc->getPos(); //positions of bases in masking sequence
407 //read in probabilities and store in vector
414 if (h.count(pos) > 0) {
416 Pi = (num - 0.25) / 0.75;
418 //cannot have probability less than 0.
419 if (Pi < 0) { Pi = 0.0; }
421 //do you want this spot
432 catch(exception& e) {
433 errorOut(e, "Pintail", "readFreq");
438 //***************************************************************************************************************
439 //calculate the distances from each query sequence to all sequences in the template to find the closest sequence
440 vector<Sequence*> Pintail::findPairs(int start, int end) {
443 vector<Sequence*> seqsMatches;
445 for(int i = start; i < end; i++){
447 vector<Sequence*> copy = decalc->findClosest(querySeqs[i], templateSeqs, 1);
448 seqsMatches.push_back(copy[0]);
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
482 decalc->trimSeqs(querySeqs[j], bestfit[j], trim);
487 mothurOut("Finding window breaks for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
488 for (int i = lines[process]->start; i < lines[process]->end; i++) {
489 it = trimmed[i].begin();
490 windowsForeachQuery[i] = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
492 mothurOut("Done finding window breaks for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
494 //write out data to file so parent can read it
496 string s = toString(getpid()) + ".temp";
497 openOutputFile(s, out);
499 //output windowsForeachQuery
500 for (int i = lines[process]->start; i < lines[process]->end; i++) {
501 out << windowsForeachQuery[i].size() << '\t';
502 for (int j = 0; j < windowsForeachQuery[i].size(); j++) {
503 out << windowsForeachQuery[i][j] << '\t';
509 for (int i = lines[process]->start; i < lines[process]->end; i++) {
510 out << windowSizes[i] << '\t';
514 //output trimmed values
515 for (int i = lines[process]->start; i < lines[process]->end; i++) {
516 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 quantilesMembers = 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 < quantilesMembers.size(); i++) {
936 out << quantilesMembers[i].size() << '\t';
937 for (int j = 0; j < quantilesMembers[i].size(); j++) {
938 out << quantilesMembers[i][j].score << '\t' << quantilesMembers[i][j].member1 << '\t' << quantilesMembers[i][j].member2 << '\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<quanMember> > quan;
965 for (int m = 0; m < quan.size(); m++) {
971 vector<quanMember> q; float w; int b, n;
972 for (int j = 0; j < num; j++) {
974 //cout << w << '\t' << b << '\t' n << endl;
975 quanMember newMember(w, b, n);
976 q.push_back(newMember);
978 //cout << "here" << endl;
980 //cout << "now here" << endl;
985 //save quan in quantiles
986 for (int j = 0; j < quan.size(); j++) {
987 //put all values of q[i] into quan[i]
988 for (int l = 0; l < quan[j].size(); l++) { quantilesMembers[j].push_back(quan[j][l]); }
989 //quantilesMembers[j].insert(quantilesMembers[j].begin(), quan[j].begin(), quan[j].end());
997 quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
1000 catch(exception& e) {
1001 errorOut(e, "Pintail", "createProcessesQuan");
1007 //***************************************************************************************************************