5 * Created by Sarah Westcott on 3/25/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
12 //**********************************************************************************************************************
13 HeatMap::HeatMap(string sort, string scale, int num, int fsize, string dir, string i){
15 m = MothurOut::getInstance();
16 // format = globaldata->getFormat();
25 m->errorOut(e, "HeatMap", "HeatMap");
30 //**********************************************************************************************************************
32 string HeatMap::getPic(RAbundVector* rabund) {
35 int numBinsToDisplay = rabund->getNumBins();
37 if (numOTU != 0) { //user want to display a portion of the otus
38 if (numOTU < numBinsToDisplay) { numBinsToDisplay = numOTU; }
41 //sort lookup so shared bins are on top
42 if (sorted != "none") { sortRabund(rabund); }
44 float maxRelAbund = 0.0;
46 for(int i=0;i<rabund->size();i++){
47 float relAbund = rabund->get(i) / (float)rabund->getNumSeqs();
48 if(relAbund > maxRelAbund){ maxRelAbund = relAbund; }
51 vector<string> scaleRelAbund(numBinsToDisplay, "");
53 for(int i=0;i<numBinsToDisplay;i++){
54 float relAbund = rabund->get(i) / (float)rabund->getNumSeqs();
56 if (m->control_pressed) { return "control"; }
58 if (rabund->get(i) != 0) { //don't want log value of 0.
59 if (scaler == "log10") {
60 scaleRelAbund[i] = toHex(int(255 * log10(relAbund) / log10(maxRelAbund))) + "0000";
61 }else if (scaler == "log2") {
62 scaleRelAbund[i] = toHex(int(255 * log2(relAbund) / log2(maxRelAbund))) + "0000";
63 }else if (scaler == "linear") {
64 scaleRelAbund[i] = toHex(int(255 * relAbund / maxRelAbund)) + "0000";
65 }else { //if user enters invalid scaler option.
66 scaleRelAbund[i] = toHex(int(255 * log10(relAbund / log10(maxRelAbund)))) + "0000";
69 else { scaleRelAbund[i] = "FFFFFF"; }
73 string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + rabund->getLabel() + ".heatmap.bin.svg";
74 m->openOutputFile(filenamesvg, outsvg);
77 outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(300) + " " + toString((numBinsToDisplay*5 + 120)) + "\">\n";
81 outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(300) + "\" height=\"" + toString((numBinsToDisplay*5 + 120)) + "\"/>";
82 outsvg << "<text fill=\"black\" class=\"seri\" text-anchor=\"middle\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString((150) - 40) + "\" y=\"25\">Heatmap at distance " + rabund->getLabel() + "</text>\n";
84 //output legend and color labels
87 int y = 103 + (numBinsToDisplay*5);
88 printLegend(y, maxRelAbund);
92 for (int i = 0; i < scaleRelAbund.size(); i++) {
93 if (m->control_pressed) { outsvg.close(); return "control"; }
95 outsvg << "<rect fill=\"#" + scaleRelAbund[i] + "\" stroke=\"#" + scaleRelAbund[i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
99 outsvg << "</g>\n</svg>\n";
104 catch(exception& e) {
105 m->errorOut(e, "HeatMap", "getPic");
110 //**********************************************************************************************************************
112 string HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
115 int numBinsToDisplay = lookup[0]->size();
117 if (numOTU != 0) { //user want to display a portion of the otus
118 if (numOTU < numBinsToDisplay) { numBinsToDisplay = numOTU; }
121 //sort lookup so shared bins are on top
122 if (sorted != "none") { sortSharedVectors(lookup); }
124 vector<vector<string> > scaleRelAbund;
125 vector<float> maxRelAbund(lookup[0]->size(), 0.0);
126 float superMaxRelAbund = 0;
128 for(int i = 0; i < lookup.size(); i++){
129 for(int j=0; j<lookup[i]->size(); j++){
131 float relAbund = lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs();
132 if(relAbund > maxRelAbund[i]){ maxRelAbund[i] = relAbund; }
134 if(maxRelAbund[i] > superMaxRelAbund){ superMaxRelAbund = maxRelAbund[i]; }
137 scaleRelAbund.resize(lookup.size());
138 for(int i=0;i<lookup.size();i++){
139 scaleRelAbund[i].assign(numBinsToDisplay, "");
140 for(int j=0;j<numBinsToDisplay;j++){
141 if (m->control_pressed) { return "control"; }
142 float relAbund = lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs();
144 if (lookup[i]->getAbundance(j) != 0) { //don't want log value of 0.
145 if (scaler == "log10") {
146 scaleRelAbund[i][j] = toHex(int(255 * log10(relAbund) / log10(maxRelAbund[i]))) + "0000";
147 }else if (scaler == "log2") {
148 scaleRelAbund[i][j] = toHex(int(255 * log2(relAbund) / log2(maxRelAbund[i]))) + "0000";
149 }else if (scaler == "linear") {
150 scaleRelAbund[i][j] = toHex(int(255 * relAbund / maxRelAbund[i])) + "0000";
151 }else { //if user enters invalid scaler option.
152 scaleRelAbund[i][j] = toHex(int(255 * log10(relAbund / log10(maxRelAbund[i])))) + "0000";
154 }else { scaleRelAbund[i][j] = "FFFFFF"; }
159 string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + lookup[0]->getLabel() + ".heatmap.bin.svg";
160 m->openOutputFile(filenamesvg, outsvg);
163 outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(lookup.size() * 300) + " " + toString((numBinsToDisplay*5 + 120)) + "\">\n";
167 outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(lookup.size() * 300) + "\" height=\"" + toString((numBinsToDisplay*5 + 120)) + "\"/>";
168 outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" text-anchor=\"middle\" x=\"" + toString((lookup.size() * 150) - 40) + "\" y=\"25\">Heatmap at distance " + lookup[0]->getLabel() + "</text>\n";
171 for (int h = 0; h < lookup.size(); h++) {
172 outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(((300 * (h+1)) - 150) - ((int)lookup[h]->getGroup().length() / 2)) + "\" y=\"50\">" + lookup[h]->getGroup() + "</text>\n";
175 //output legend and color labels
178 int y = 103 + (numBinsToDisplay*5);
179 printLegend(y, superMaxRelAbund);
182 for (int i = 0; i < numBinsToDisplay; i++) {
183 for (int j = 0; j < scaleRelAbund.size(); j++) {
184 if (m->control_pressed) { outsvg.close(); return "control"; }
186 outsvg << "<rect fill=\"#" + scaleRelAbund[j][i] + "\" stroke=\"#" + scaleRelAbund[j][i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
193 outsvg << "</g>\n</svg>\n";
199 catch(exception& e) {
200 m->errorOut(e, "HeatMap", "getPic");
205 //**********************************************************************************************************************
206 int HeatMap::sortSharedVectors(vector<SharedRAbundVector*>& lookup){
209 vector<SharedRAbundVector*> looktemp;
210 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
211 map<int, int>::iterator it;
213 /****************** find order of otus **********************/
214 if (sorted == "shared") {
215 place = orderShared(lookup);
216 }else if (sorted == "topotu") {
217 place = orderTopOtu(lookup);
218 }else if (sorted == "topgroup") {
219 place = orderTopGroup(lookup);
220 }else { m->mothurOut("Error: invalid sort option."); m->mothurOutEndLine(); return 1; }
223 /******************* create copy of lookup *********************/
224 //create and initialize looktemp as a copy of lookup
225 for (int i = 0; i < lookup.size(); i++) {
226 SharedRAbundVector* temp = new SharedRAbundVector(lookup[i]->getNumBins());
227 temp->setLabel(lookup[i]->getLabel());
228 temp->setGroup(lookup[i]->getGroup());
229 //copy lookup i's info
230 for (int j = 0; j < lookup[i]->size(); j++) {
231 temp->set(j, lookup[i]->getAbundance(j), lookup[i]->getGroup());
233 looktemp.push_back(temp);
236 /************************ fill lookup in order given by place *********************/
238 for (int i = 0; i < looktemp[0]->size(); i++) { //place
239 //fill lookup // 2 -> 1
240 for (int j = 0; j < looktemp.size(); j++) { // 3 -> 2
241 int newAbund = looktemp[j]->getAbundance(i); // 1 -> 3
242 lookup[j]->set(place[i], newAbund, looktemp[j]->getGroup()); //binNumber, abundance, group
246 //delete looktemp -- Sarah look at - this is causing segmentation faults
247 for (int j = 0; j < looktemp.size(); j++) {
248 // delete looktemp[j];
254 catch(exception& e) {
255 m->errorOut(e, "HeatMap", "sortSharedVectors");
259 //**********************************************************************************************************************
260 map<int, int> HeatMap::orderShared(vector<SharedRAbundVector*>& lookup){
263 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
264 map<int, int>::iterator it;
266 vector<int> sharedBins;
267 vector<int> uniqueBins;
270 for (int i = 0; i < lookup[0]->size(); i++) {
274 for (int j = 0; j < lookup.size(); j++) { if (lookup[j]->getAbundance(i) != 0) { count++; } }
276 if (count < 2) { uniqueBins.push_back(i); }
277 else { sharedBins.push_back(i); }
281 for (int i = 0; i < sharedBins.size(); i++) { place[sharedBins[i]] = i; }
282 for (int i = 0; i < uniqueBins.size(); i++) { place[uniqueBins[i]] = (sharedBins.size() + i); }
287 catch(exception& e) {
288 m->errorOut(e, "HeatMap", "orderShared");
292 //**********************************************************************************************************************
293 map<int, int> HeatMap::orderTopOtu(vector<SharedRAbundVector*>& lookup){
296 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
297 map<int, int>::iterator it;
299 vector<binCount> totals;
302 for (int i = 0; i < lookup[0]->size(); i++) {
305 for (int j = 0; j < lookup.size(); j++) { total += lookup[j]->getAbundance(i); }
307 binCount temp(i, total);
309 totals.push_back(temp);
312 sort(totals.begin(), totals.end(), comparebinCounts);
315 for (int i = 0; i < totals.size(); i++) { place[totals[i].bin] = i; }
320 catch(exception& e) {
321 m->errorOut(e, "HeatMap", "orderTopOtu");
325 //**********************************************************************************************************************
326 map<int, int> HeatMap::orderTopGroup(vector<SharedRAbundVector*>& lookup){
329 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
330 map<int, int>::iterator it;
332 vector < vector<binCount> > totals; //totals[0] = bin totals for group 0, totals[1] = bin totals for group 1, ...
333 totals.resize(lookup.size());
336 for (int i = 0; i < lookup[0]->size(); i++) {
337 for (int j = 0; j < lookup.size(); j++) {
338 binCount temp(i, (lookup[j]->getAbundance(i)));
339 totals[j].push_back(temp);
343 for (int i = 0; i < totals.size(); i++) { sort(totals[i].begin(), totals[i].end(), comparebinCounts); }
346 //grab the top otu for each group adding it if its not already added
348 for (int i = 0; i < totals[0].size(); i++) {
350 for (int j = 0; j < totals.size(); j++) {
351 it = place.find(totals[j][i].bin);
353 if (it == place.end()) { //not added yet
354 place[totals[j][i].bin] = count;
363 catch(exception& e) {
364 m->errorOut(e, "HeatMap", "orderTopGroup");
368 //**********************************************************************************************************************
370 void HeatMap::printLegend(int y, float maxbin) {
373 //output legend and color labels
374 //go through map and give each score a color value
379 for (int i = 1; i < 255; i++) {
380 color = toHex(int((float)(i)));
381 outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"1\" height=\"10\"/>\n";
385 //prints legend labels
387 for (int i = 1; i<=5; i++) {
389 if(scaler== "log10") { label = maxbin * log10(51*i) / log10(255); }
390 else if(scaler== "log2") { label = maxbin * log2(51*i) / log2(255); }
391 else if(scaler== "linear") { label = maxbin * 51 * i / 255; }
392 else { label = maxbin * log10(51*i) / log10(255); }
393 label = int(label * 1000 + 0.5);
395 string text = toString(label, 3);
397 outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(x) + "\" y=\"" + toString(y-3) + "\">" + text + "</text>\n";
402 catch(exception& e) {
403 m->errorOut(e, "HeatMap", "printLegend");
407 //**********************************************************************************************************************
409 string HeatMap::getPic(vector<SharedRAbundFloatVector*> lookup) {
412 int numBinsToDisplay = lookup[0]->size();
414 if (numOTU != 0) { //user want to display a portion of the otus
415 if (numOTU < numBinsToDisplay) { numBinsToDisplay = numOTU; }
418 //sort lookup so shared bins are on top
419 if (sorted != "none") { sortSharedVectors(lookup); }
421 vector<vector<string> > scaleRelAbund;
422 vector<float> maxRelAbund(lookup.size(), 0.0);
423 float superMaxRelAbund = 0;
425 for(int i = 0; i < lookup.size(); i++){
426 for(int j=0; j<lookup[i]->size(); j++){
428 float relAbund = lookup[i]->getAbundance(j);
429 if(relAbund > maxRelAbund[i]){ maxRelAbund[i] = relAbund; }
431 if(maxRelAbund[i] > superMaxRelAbund){ superMaxRelAbund = maxRelAbund[i]; }
434 scaleRelAbund.resize(lookup.size());
435 for(int i=0;i<lookup.size();i++){
436 scaleRelAbund[i].assign(numBinsToDisplay, "");
437 for(int j=0;j<numBinsToDisplay;j++){
438 if (m->control_pressed) { return "control"; }
439 float relAbund = lookup[i]->getAbundance(j);
441 if (lookup[i]->getAbundance(j) != 0) { //don't want log value of 0.
442 if (scaler == "log10") {
443 scaleRelAbund[i][j] = toHex(int(255 * log10(relAbund) / log10(maxRelAbund[i]))) + "0000";
444 }else if (scaler == "log2") {
445 scaleRelAbund[i][j] = toHex(int(255 * log2(relAbund) / log2(maxRelAbund[i]))) + "0000";
446 }else if (scaler == "linear") {
447 scaleRelAbund[i][j] = toHex(int(255 * relAbund / maxRelAbund[i])) + "0000";
448 }else { //if user enters invalid scaler option.
449 scaleRelAbund[i][j] = toHex(int(255 * log10(relAbund / log10(maxRelAbund[i])))) + "0000";
451 }else { scaleRelAbund[i][j] = "FFFFFF"; }
456 string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + lookup[0]->getLabel() + ".heatmap.bin.svg";
457 m->openOutputFile(filenamesvg, outsvg);
460 outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(lookup.size() * 300) + " " + toString((numBinsToDisplay*5 + 120)) + "\">\n";
464 outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(lookup.size() * 300) + "\" height=\"" + toString((numBinsToDisplay*5 + 120)) + "\"/>";
465 outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" text-anchor=\"middle\" x=\"" + toString((lookup.size() * 150) - 40) + "\" y=\"25\">Heatmap at distance " + lookup[0]->getLabel() + "</text>\n";
468 for (int h = 0; h < lookup.size(); h++) {
469 outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(((300 * (h+1)) - 150) - ((int)lookup[h]->getGroup().length() / 2)) + "\" y=\"50\">" + lookup[h]->getGroup() + "</text>\n";
472 //output legend and color labels
475 int y = 103 + (numBinsToDisplay*5);
476 printLegend(y, superMaxRelAbund);
479 for (int i = 0; i < numBinsToDisplay; i++) {
480 for (int j = 0; j < scaleRelAbund.size(); j++) {
481 if (m->control_pressed) { outsvg.close(); return "control"; }
483 outsvg << "<rect fill=\"#" + scaleRelAbund[j][i] + "\" stroke=\"#" + scaleRelAbund[j][i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
490 outsvg << "</g>\n</svg>\n";
496 catch(exception& e) {
497 m->errorOut(e, "HeatMap", "getPic");
501 //**********************************************************************************************************************
502 int HeatMap::sortSharedVectors(vector<SharedRAbundFloatVector*>& lookup){
505 vector<SharedRAbundFloatVector*> looktemp;
506 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
507 map<int, int>::iterator it;
509 /****************** find order of otus **********************/
510 if (sorted == "shared") {
511 place = orderShared(lookup);
512 }else if (sorted == "topotu") {
513 place = orderTopOtu(lookup);
514 }else if (sorted == "topgroup") {
515 place = orderTopGroup(lookup);
516 }else { m->mothurOut("Error: invalid sort option."); m->mothurOutEndLine(); return 1; }
519 /******************* create copy of lookup *********************/
520 //create and initialize looktemp as a copy of lookup
521 for (int i = 0; i < lookup.size(); i++) {
522 SharedRAbundFloatVector* temp = new SharedRAbundFloatVector(lookup[i]->getNumBins());
523 temp->setLabel(lookup[i]->getLabel());
524 temp->setGroup(lookup[i]->getGroup());
525 //copy lookup i's info
526 for (int j = 0; j < lookup[i]->size(); j++) {
527 temp->set(j, lookup[i]->getAbundance(j), lookup[i]->getGroup());
529 looktemp.push_back(temp);
532 /************************ fill lookup in order given by place *********************/
534 for (int i = 0; i < looktemp[0]->size(); i++) { //place
535 //fill lookup // 2 -> 1
536 for (int j = 0; j < looktemp.size(); j++) { // 3 -> 2
537 float newAbund = looktemp[j]->getAbundance(i); // 1 -> 3
538 lookup[j]->set(place[i], newAbund, looktemp[j]->getGroup()); //binNumber, abundance, group
542 //delete looktemp -- Sarah look at - this is causing segmentation faults
543 for (int j = 0; j < looktemp.size(); j++) {
544 // delete looktemp[j];
550 catch(exception& e) {
551 m->errorOut(e, "HeatMap", "sortSharedVectors");
555 //**********************************************************************************************************************
556 int HeatMap::sortRabund(RAbundVector*& r){
558 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
559 map<int, int>::iterator it;
561 /****************** find order of otus **********************/
562 vector<binCount> totals;
565 for (int i = 0; i < r->getNumBins(); i++) {
566 binCount temp(i, r->get(i));
568 totals.push_back(temp);
571 sort(totals.begin(), totals.end(), comparebinCounts);
574 for (int i = 0; i < totals.size(); i++) { place[totals[i].bin] = i; }
576 /******************* create copy of lookup *********************/
577 //create and initialize rtemp as a copy of r
579 RAbundVector* rtemp = new RAbundVector(r->getNumBins());
580 for (int i = 0; i < r->size(); i++) { rtemp->set(i, r->get(i)); }
581 rtemp->setLabel(r->getLabel());
583 /************************ fill lookup in order given by place *********************/
585 for (int i = 0; i < rtemp->size(); i++) { //place
586 //fill lookup // 2 -> 1
588 int newAbund = rtemp->get(i); // 1 -> 3
589 r->set(place[i], newAbund); //binNumber, abundance
595 catch(exception& e) {
596 m->errorOut(e, "HeatMap", "sortRabund");
600 //**********************************************************************************************************************
601 map<int, int> HeatMap::orderShared(vector<SharedRAbundFloatVector*>& lookup){
604 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
605 map<int, int>::iterator it;
607 vector<int> sharedBins;
608 vector<int> uniqueBins;
611 for (int i = 0; i < lookup[0]->size(); i++) {
615 for (int j = 0; j < lookup.size(); j++) { if (lookup[j]->getAbundance(i) != 0) { count++; } }
617 if (count < 2) { uniqueBins.push_back(i); }
618 else { sharedBins.push_back(i); }
622 for (int i = 0; i < sharedBins.size(); i++) { place[sharedBins[i]] = i; }
623 for (int i = 0; i < uniqueBins.size(); i++) { place[uniqueBins[i]] = (sharedBins.size() + i); }
628 catch(exception& e) {
629 m->errorOut(e, "HeatMap", "orderShared");
633 //**********************************************************************************************************************
634 map<int, int> HeatMap::orderTopOtu(vector<SharedRAbundFloatVector*>& lookup){
637 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
638 map<int, int>::iterator it;
640 vector<binCountFloat> totals;
643 for (int i = 0; i < lookup[0]->size(); i++) {
646 for (int j = 0; j < lookup.size(); j++) { total += lookup[j]->getAbundance(i); }
648 binCountFloat temp(i, total);
650 totals.push_back(temp);
653 sort(totals.begin(), totals.end(), comparebinFloatCounts);
656 for (int i = 0; i < totals.size(); i++) { place[totals[i].bin] = i; }
661 catch(exception& e) {
662 m->errorOut(e, "HeatMap", "orderTopOtu");
666 //**********************************************************************************************************************
667 map<int, int> HeatMap::orderTopGroup(vector<SharedRAbundFloatVector*>& lookup){
670 map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
671 map<int, int>::iterator it;
673 vector < vector<binCountFloat> > totals; //totals[0] = bin totals for group 0, totals[1] = bin totals for group 1, ...
674 totals.resize(lookup.size());
677 for (int i = 0; i < lookup[0]->size(); i++) {
678 for (int j = 0; j < lookup.size(); j++) {
679 binCountFloat temp(i, (lookup[j]->getAbundance(i)));
680 totals[j].push_back(temp);
684 for (int i = 0; i < totals.size(); i++) { sort(totals[i].begin(), totals[i].end(), comparebinFloatCounts); }
687 //grab the top otu for each group adding it if its not already added
689 for (int i = 0; i < totals[0].size(); i++) {
691 for (int j = 0; j < totals.size(); j++) {
692 it = place.find(totals[j][i].bin);
694 if (it == place.end()) { //not added yet
695 place[totals[j][i].bin] = count;
704 catch(exception& e) {
705 m->errorOut(e, "HeatMap", "orderTopGroup");
709 //**********************************************************************************************************************