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 = "foronlinepintailpairs-eachgap";
151 openOutputFile(o, out7);
153 for (int i = 0; i < bestfit.size(); i++) {
154 out7 << querySeqs[i]->getName() << endl;
155 out7 << querySeqs[i]->getUnaligned() << endl << endl;
157 out7 << bestfit[i]->getName() << endl;
158 out7 << bestfit[i]->getUnaligned() << endl << endl << 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();
173 //mask sequences if the user wants to
176 for (int i = 0; i < querySeqs.size(); i++) {
177 decalc->runMask(querySeqs[i]);
181 for (int i = 0; i < templateSeqs.size(); i++) {
182 decalc->runMask(templateSeqs[i]);
185 for (int i = 0; i < bestfit.size(); i++) {
186 decalc->runMask(bestfit[i]);
192 vector<Sequence*> temp = templateSeqs;
193 for (int i = 0; i < querySeqs.size(); i++) { temp.push_back(querySeqs[i]); }
197 runFilter(querySeqs);
198 runFilter(templateSeqs);
203 if (processors == 1) {
205 for (int j = 0; j < bestfit.size(); j++) {
206 decalc->trimSeqs(querySeqs[j], bestfit[j], trimmed[j]);
209 mothurOut("Finding window breaks... "); cout.flush();
210 for (int i = lines[0]->start; i < lines[0]->end; i++) {
211 it = trimmed[i].begin();
212 vector<int> win = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
213 windowsForeachQuery[i] = win;
215 mothurOut("Done."); mothurOutEndLine();
217 }else { createProcessesSpots(); }
219 if (processors == 1) {
221 mothurOut("Calculating observed distance... "); cout.flush();
222 for (int i = lines[0]->start; i < lines[0]->end; i++) {
223 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
225 obsDistance[i] = obsi;
227 mothurOut("Done."); mothurOutEndLine();
230 mothurOut("Finding variability... "); cout.flush();
231 for (int i = lines[0]->start; i < lines[0]->end; i++) {
232 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
236 mothurOut("Done."); mothurOutEndLine();
239 mothurOut("Calculating alpha... "); cout.flush();
240 for (int i = lines[0]->start; i < lines[0]->end; i++) {
241 float alpha = decalc->getCoef(obsDistance[i], Qav[i]);
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]);
260 it = trimmed[i].begin();
261 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
264 mothurOut("Done."); mothurOutEndLine();
267 else { createProcesses(); }
269 //quantiles are used to determine whether the de values found indicate a chimera
270 //if you have to calculate them, its time intensive because you are finding the de and deviation values for each
271 //combination of sequences in the template
272 if (quanfile != "") { quantiles = readQuantiles(); }
275 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();
276 if (processors == 1) {
277 quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
278 }else { createProcessesQuan(); }
282 string noOutliers, outliers;
284 if ((!filter) && (seqMask == "")) {
285 noOutliers = getRootName(templateFile) + "pintail.quan";
286 }else if ((filter) && (seqMask == "")) {
287 noOutliers = getRootName(templateFile) + "pintail.filtered.quan";
288 }else if ((!filter) && (seqMask != "")) {
289 noOutliers = getRootName(templateFile) + "pintail.masked.quan";
290 }else if ((filter) && (seqMask != "")) {
291 noOutliers = getRootName(templateFile) + "pintail.filtered.masked.quan";
294 //outliers = getRootName(templateFile) + "pintail.quanYESOUTLIERS";
296 /*openOutputFile(outliers, out4);
299 for (int i = 0; i < quantilesMembers.size(); i++) {
302 if (quantilesMembers[i].size() == 0) {
303 //in case this is not a distance found in your template files
304 for (int g = 0; g < 6; g++) {
309 sort(quantilesMembers[i].begin(), quantilesMembers[i].end(), compareQuanMembers);
312 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.10)].score);
314 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.25)].score);
316 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.5)].score);
318 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.75)].score);
320 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.95)].score);
322 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.99)].score);
328 for (int u = 0; u < temp.size(); u++) { out4 << temp[u] << '\t'; }
337 decalc->removeObviousOutliers(quantilesMembers, templateSeqs.size());
339 openOutputFile(noOutliers, out5);
342 for (int i = 0; i < quantilesMembers.size(); i++) {
345 if (quantilesMembers[i].size() == 0) {
346 //in case this is not a distance found in your template files
347 for (int g = 0; g < 6; g++) {
352 sort(quantilesMembers[i].begin(), quantilesMembers[i].end(), compareQuanMembers);
355 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.10)].score);
357 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.25)].score);
359 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.5)].score);
361 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.75)].score);
363 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.95)].score);
365 temp.push_back(quantilesMembers[i][int(quantilesMembers[i].size() * 0.99)].score);
371 for (int u = 0; u < temp.size(); u++) { out5 << temp[u] << '\t'; }
378 mothurOut("Done."); mothurOutEndLine();
383 for (int i = 0; i < lines.size(); i++) { delete lines[i]; }
384 for (int i = 0; i < templateLines.size(); i++) { delete templateLines[i]; }
386 delete distcalculator;
389 catch(exception& e) {
390 errorOut(e, "Pintail", "getChimeras");
395 //***************************************************************************************************************
397 vector<float> Pintail::readFreq() {
401 openInputFile(consfile, in);
404 set<int> h = decalc->getPos(); //positions of bases in masking sequence
406 //read in probabilities and store in vector
413 if (h.count(pos) > 0) {
415 Pi = (num - 0.25) / 0.75;
417 //cannot have probability less than 0.
418 if (Pi < 0) { Pi = 0.0; }
420 //do you want this spot
431 catch(exception& e) {
432 errorOut(e, "Pintail", "readFreq");
437 //***************************************************************************************************************
438 //calculate the distances from each query sequence to all sequences in the template to find the closest sequence
439 vector<Sequence*> Pintail::findPairs(int start, int end) {
442 vector<Sequence*> seqsMatches;
444 for(int i = start; i < end; i++){
446 float smallest = 10000.0;
447 Sequence query = *(querySeqs[i]);
450 for(int j = 0; j < templateSeqs.size(); j++){
452 Sequence temp = *(templateSeqs[j]);
454 distcalculator->calcDist(query, temp);
455 float dist = distcalculator->getDist();
457 if (dist < smallest) {
458 match = templateSeqs[j];
463 //make copy so trimSeqs doesn't overtrim
464 Sequence* copy = new Sequence(match->getName(), match->getAligned());
466 seqsMatches.push_back(copy);
472 catch(exception& e) {
473 errorOut(e, "Pintail", "findPairs");
478 /**************************************************************************************************/
480 void Pintail::createProcessesSpots() {
482 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
484 vector<int> processIDS;
486 //loop through and create all the processes you want
487 while (process != processors) {
491 processIDS.push_back(pid);
495 for (int j = lines[process]->start; j < lines[process]->end; j++) {
497 //chops off beginning and end of sequences so they both start and end with a base
500 decalc->trimSeqs(querySeqs[j], bestfit[j], trim);
505 mothurOut("Finding window breaks for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
506 for (int i = lines[process]->start; i < lines[process]->end; i++) {
507 it = trimmed[i].begin();
508 windowsForeachQuery[i] = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
510 mothurOut("Done finding window breaks for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
512 //write out data to file so parent can read it
514 string s = toString(getpid()) + ".temp";
515 openOutputFile(s, out);
517 //output windowsForeachQuery
518 for (int i = lines[process]->start; i < lines[process]->end; i++) {
519 out << windowsForeachQuery[i].size() << '\t';
520 for (int j = 0; j < windowsForeachQuery[i].size(); j++) {
521 out << windowsForeachQuery[i][j] << '\t';
527 for (int i = lines[process]->start; i < lines[process]->end; i++) {
528 out << windowSizes[i] << '\t';
532 //output trimmed values
533 for (int i = lines[process]->start; i < lines[process]->end; i++) {
534 it = trimmed[i].begin();
535 out << it->first << '\t' << it->second << endl;
540 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
543 //force parent to wait until all the processes are done
544 for (int i=0;i<processors;i++) {
545 int temp = processIDS[i];
549 //get data created by processes
550 for (int i=0;i<processors;i++) {
552 string s = toString(processIDS[i]) + ".temp";
553 openInputFile(s, in);
555 int size = lines[i]->end - lines[i]->start;
557 int count = lines[i]->start;
558 for (int m = 0; m < size; m++) {
562 vector<int> win; int w;
563 for (int j = 0; j < num; j++) {
568 windowsForeachQuery[count] = win;
574 count = lines[i]->start;
575 for (int m = 0; m < size; m++) {
579 windowSizes[count] = num;
585 count = lines[i]->start;
586 for (int m = 0; m < size; m++) {
607 for (int j = 0; j < bestfit.size(); j++) {
608 //chops off beginning and end of sequences so they both start and end with a base
609 decalc->trimSeqs(querySeqs[j], bestfit[j], trimmed[j]);
612 for (int i = lines[0]->start; i < lines[0]->end; i++) {
613 it = trimmed[i].begin();
614 vector<int> win = decalc->findWindows(querySeqs[i], it->first, it->second, windowSizes[i], increment);
615 windowsForeachQuery[i] = win;
620 catch(exception& e) {
621 errorOut(e, "Pintail", "createProcessesSpots");
625 /**************************************************************************************************/
627 void Pintail::createProcessesPairs() {
629 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
631 vector<int> processIDS;
633 //loop through and create all the processes you want
634 while (process != processors) {
638 processIDS.push_back(pid);
642 mothurOut("Finding pairs for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
643 bestfit = findPairs(lines[process]->start, lines[process]->end);
644 mothurOut("Done finding pairs for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
646 //write out data to file so parent can read it
648 string s = toString(getpid()) + ".temp";
649 openOutputFile(s, out);
651 //output range and size
652 out << bestfit.size() << endl;
655 for (int i = 0; i < bestfit.size(); i++) {
656 out << ">" << bestfit[i]->getName() << endl << bestfit[i]->getAligned() << endl;
661 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
664 //force parent to wait until all the processes are done
665 for (int i=0;i<processors;i++) {
666 int temp = processIDS[i];
670 //get data created by processes
671 for (int i=0;i<processors;i++) {
673 string s = toString(processIDS[i]) + ".temp";
674 openInputFile(s, in);
677 in >> size; gobble(in);
680 int count = lines[i]->start;
681 for (int m = 0; m < size; m++) {
682 Sequence* temp = new Sequence(in);
683 bestfit[count] = temp;
695 bestfit = findPairs(lines[0]->start, lines[0]->end);
698 catch(exception& e) {
699 errorOut(e, "Pintail", "createProcessesPairs");
703 /**************************************************************************************************/
705 void Pintail::createProcesses() {
707 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
709 vector<int> processIDS;
711 //loop through and create all the processes you want
712 while (process != processors) {
716 processIDS.push_back(pid);
720 mothurOut("Calculating observed, expected and de values for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
721 for (int i = lines[process]->start; i < lines[process]->end; i++) {
723 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
724 obsDistance[i] = obsi;
727 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
730 float alpha = decalc->getCoef(obsDistance[i], q);
733 vector<float> exp = decalc->calcExpected(q, alpha);
734 expectedDistance[i] = exp;
736 //get de and deviation
737 float dei = decalc->calcDE(obsi, exp);
740 it = trimmed[i].begin();
741 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
744 mothurOut("Done calculating observed, expected and de values for sequences " + toString(lines[process]->start) + " to " + toString(lines[process]->end)); mothurOutEndLine();
746 //write out data to file so parent can read it
748 string s = toString(getpid()) + ".temp";
749 openOutputFile(s, out);
751 int size = lines[process]->end - lines[process]->start;
754 //output observed distances
755 for (int i = lines[process]->start; i < lines[process]->end; i++) {
756 out << obsDistance[i].size() << '\t';
757 for (int j = 0; j < obsDistance[i].size(); j++) {
758 out << obsDistance[i][j] << '\t';
764 //output expected distances
765 for (int i = lines[process]->start; i < lines[process]->end; i++) {
766 out << expectedDistance[i].size() << '\t';
767 for (int j = 0; j < expectedDistance[i].size(); j++) {
768 out << expectedDistance[i][j] << '\t';
775 for (int i = lines[process]->start; i < lines[process]->end; i++) {
776 out << DE[i] << '\t';
781 for (int i = lines[process]->start; i < lines[process]->end; i++) {
782 out << deviation[i] << '\t';
789 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
792 //force parent to wait until all the processes are done
793 for (int i=0;i<processors;i++) {
794 int temp = processIDS[i];
798 //get data created by processes
799 for (int i=0;i<processors;i++) {
801 string s = toString(processIDS[i]) + ".temp";
802 openInputFile(s, in);
805 in >> size; gobble(in);
807 //get observed distances
808 int count = lines[i]->start;
809 for (int m = 0; m < size; m++) {
813 vector<float> obs; float w;
814 for (int j = 0; j < num; j++) {
819 obsDistance[count] = obs;
826 //get expected distances
827 count = lines[i]->start;
828 for (int m = 0; m < size; m++) {
832 vector<float> exp; float w;
833 for (int j = 0; j < num; j++) {
838 expectedDistance[count] = exp;
845 count = lines[i]->start;
846 for (int m = 0; m < size; m++) {
856 count = lines[i]->start;
857 for (int m = 0; m < size; m++) {
861 deviation[count] = num;
871 mothurOut("Calculating observed distance... "); cout.flush();
872 for (int i = lines[0]->start; i < lines[0]->end; i++) {
873 vector<float> obsi = decalc->calcObserved(querySeqs[i], bestfit[i], windowsForeachQuery[i], windowSizes[i]);
874 obsDistance[i] = obsi;
876 mothurOut("Done."); mothurOutEndLine();
880 mothurOut("Finding variability... "); cout.flush();
881 for (int i = lines[0]->start; i < lines[0]->end; i++) {
882 vector<float> q = decalc->findQav(windowsForeachQuery[i], windowSizes[i], probabilityProfile);
885 mothurOut("Done."); mothurOutEndLine();
889 mothurOut("Calculating alpha... "); cout.flush();
890 for (int i = lines[0]->start; i < lines[0]->end; i++) {
891 float alpha = decalc->getCoef(obsDistance[i], Qav[i]);
892 seqCoef.push_back(alpha);
894 mothurOut("Done."); mothurOutEndLine();
898 mothurOut("Calculating expected distance... "); cout.flush();
899 for (int i = lines[0]->start; i < lines[0]->end; i++) {
900 vector<float> exp = decalc->calcExpected(Qav[i], seqCoef[i]);
901 expectedDistance[i] = exp;
903 mothurOut("Done."); mothurOutEndLine();
907 mothurOut("Finding deviation... "); cout.flush();
908 for (int i = lines[0]->start; i < lines[0]->end; i++) {
909 float de = decalc->calcDE(obsDistance[i], expectedDistance[i]);
912 it = trimmed[i].begin();
913 float dist = decalc->calcDist(querySeqs[i], bestfit[i], it->first, it->second);
916 mothurOut("Done."); mothurOutEndLine();
920 catch(exception& e) {
921 errorOut(e, "Pintail", "createProcesses");
927 /**************************************************************************************************/
929 void Pintail::createProcessesQuan() {
931 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
933 vector<int> processIDS;
935 //loop through and create all the processes you want
936 while (process != processors) {
940 processIDS.push_back(pid);
944 quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, templateLines[process]->start, templateLines[process]->end);
946 //write out data to file so parent can read it
948 string s = toString(getpid()) + ".temp";
949 openOutputFile(s, out);
952 //output observed distances
953 for (int i = 0; i < quantilesMembers.size(); i++) {
954 out << quantilesMembers[i].size() << '\t';
955 for (int j = 0; j < quantilesMembers[i].size(); j++) {
956 out << quantilesMembers[i][j].score << '\t' << quantilesMembers[i][j].member1 << '\t' << quantilesMembers[i][j].member2 << '\t';
964 }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
967 //force parent to wait until all the processes are done
968 for (int i=0;i<processors;i++) {
969 int temp = processIDS[i];
973 //get data created by processes
974 for (int i=0;i<processors;i++) {
976 string s = toString(processIDS[i]) + ".temp";
977 openInputFile(s, in);
979 vector< vector<quanMember> > quan;
983 for (int m = 0; m < quan.size(); m++) {
989 vector<quanMember> q; float w; int b, n;
990 for (int j = 0; j < num; j++) {
992 //cout << w << '\t' << b << '\t' n << endl;
993 quanMember newMember(w, b, n);
994 q.push_back(newMember);
996 //cout << "here" << endl;
998 //cout << "now here" << endl;
1003 //save quan in quantiles
1004 for (int j = 0; j < quan.size(); j++) {
1005 //put all values of q[i] into quan[i]
1006 for (int l = 0; l < quan[j].size(); l++) { quantilesMembers[j].push_back(quan[j][l]); }
1007 //quantilesMembers[j].insert(quantilesMembers[j].begin(), quan[j].begin(), quan[j].end());
1015 quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
1018 catch(exception& e) {
1019 errorOut(e, "Pintail", "createProcessesQuan");
1025 //***************************************************************************************************************