]> git.donarmstrong.com Git - mothur.git/blob - heatmapsimcommand.cpp
Revert to previous commit
[mothur.git] / heatmapsimcommand.cpp
1 /*
2  *  heatmapsimcommand.cpp
3  *  Mothur
4  *
5  *  Created by Sarah Westcott on 6/8/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "heatmapsimcommand.h"
11 #include "sharedjabund.h"
12 #include "sharedsorabund.h"
13 #include "sharedjclass.h"
14 #include "sharedsorclass.h"
15 #include "sharedjest.h"
16 #include "sharedsorest.h"
17 #include "sharedthetayc.h"
18 #include "sharedthetan.h"
19 #include "sharedmorisitahorn.h"
20 #include "sharedbraycurtis.h"
21
22
23 //**********************************************************************************************************************
24 vector<string> HeatMapSimCommand::setParameters(){      
25         try {
26                 CommandParameter pshared("shared", "InputTypes", "", "", "PhylipColumnShared", "PhylipColumnShared", "none",false,false); parameters.push_back(pshared);        
27                 CommandParameter pphylip("phylip", "InputTypes", "", "", "PhylipColumnShared", "PhylipColumnShared", "none",false,false); parameters.push_back(pphylip);
28                 CommandParameter pname("name", "InputTypes", "", "", "none", "none", "ColumnName",false,false); parameters.push_back(pname);
29                 CommandParameter pcolumn("column", "InputTypes", "", "", "PhylipColumnShared", "PhylipColumnShared", "ColumnName",false,false); parameters.push_back(pcolumn);          
30                 CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
31                 CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
32                 CommandParameter pcalc("calc", "Multiple", "jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-morisitahorn-braycurtis", "jest-thetayc", "", "", "",true,false); parameters.push_back(pcalc);
33                 CommandParameter pfontsize("fontsize", "Number", "", "24", "", "", "",false,false); parameters.push_back(pfontsize);
34                 CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
35                 CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
36                 
37                 vector<string> myArray;
38                 for (int i = 0; i < parameters.size(); i++) {   myArray.push_back(parameters[i].name);          }
39                 return myArray;
40         }
41         catch(exception& e) {
42                 m->errorOut(e, "HeatMapSimCommand", "setParameters");
43                 exit(1);
44         }
45 }
46 //**********************************************************************************************************************
47 string HeatMapSimCommand::getHelpString(){      
48         try {
49                 string helpString = "";
50                 ValidCalculators validCalculator;
51                 helpString += "The heatmap.sim command parameters are shared, phylip, column, name, groups, calc, fontsize and label.  shared or phylip or column and name are required unless valid current files exist.\n";
52                 helpString += "There are two ways to use the heatmap.sim command. The first is with the read.otu command. \n";
53                 helpString += "With the read.otu command you may use the groups, label and calc parameters. \n";
54                 helpString += "The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap.\n";
55                 helpString += "The group names are separated by dashes. The label parameter allows you to select what distance levels you would like a heatmap created for, and is also separated by dashes.\n";
56                 helpString += "The fontsize parameter allows you to adjust the font size of the picture created, default=24.\n";
57                 helpString += "The heatmap.sim command should be in the following format: heatmap.sim(groups=yourGroups, calc=yourCalc, label=yourLabels).\n";
58                 helpString += "Example heatmap.sim(groups=A-B-C, calc=jabund).\n";
59                 helpString += "The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n";
60                 helpString +=  validCalculator.printCalc("heat");
61                 helpString += "The default value for calc is jclass-thetayc.\n";
62                 helpString += "The heatmap.sim command outputs a .svg file for each calculator you choose at each label you specify.\n";
63                 helpString += "The second way to use the heatmap.sim command is with a distance file representing the distance bewteen your groups. \n";
64                 helpString += "Using the command this way, the phylip or column parameter are required, and only one may be used.  If you use a column file the name filename is required. \n";
65                 helpString += "The heatmap.sim command should be in the following format: heatmap.sim(phylip=yourDistanceFile).\n";
66                 helpString += "Example heatmap.sim(phylip=amazonGroups.dist).\n";
67                 helpString += "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n";
68                 return helpString;
69         }
70         catch(exception& e) {
71                 m->errorOut(e, "HeatMapSimCommand", "getHelpString");
72                 exit(1);
73         }
74 }
75 //**********************************************************************************************************************
76 HeatMapSimCommand::HeatMapSimCommand(){ 
77         try {
78                 abort = true; calledHelp = true; 
79                 setParameters();
80                 vector<string> tempOutNames;
81                 outputTypes["svg"] = tempOutNames;
82         }
83         catch(exception& e) {
84                 m->errorOut(e, "HeatMapSimCommand", "HeatMapSimCommand");
85                 exit(1);
86         }
87 }
88 //**********************************************************************************************************************
89
90 HeatMapSimCommand::HeatMapSimCommand(string option)  {
91         try {
92                 abort = false; calledHelp = false;   
93                 allLines = 1;
94                         
95                 //allow user to run help
96                 if(option == "help") {  help(); abort = true; calledHelp = true; }
97                 else if(option == "citation") { citation(); abort = true; calledHelp = true;}
98                 
99                 else {
100                         vector<string> myArray = setParameters();
101                         
102                         OptionParser parser(option);
103                         map<string,string> parameters = parser.getParameters();
104                         
105                         ValidParameters validParameter;
106                         map<string,string>::iterator it;
107                         
108                         //check to make sure all parameters are valid for command
109                         for (it = parameters.begin(); it != parameters.end(); it++) { 
110                                 if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
111                         }
112                         
113                         //initialize outputTypes
114                         vector<string> tempOutNames;
115                         outputTypes["svg"] = tempOutNames;
116                         
117                         format = "";
118                                 
119                         //if the user changes the input directory command factory will send this info to us in the output parameter 
120                         string inputDir = validParameter.validFile(parameters, "inputdir", false);              
121                         if (inputDir == "not found"){   inputDir = "";          }
122                         else {
123                                 string path;
124                                 it = parameters.find("phylip");
125                                 //user has given a template file
126                                 if(it != parameters.end()){ 
127                                         path = m->hasPath(it->second);
128                                         //if the user has not given a path then, add inputdir. else leave path alone.
129                                         if (path == "") {       parameters["phylip"] = inputDir + it->second;           }
130                                 }
131                                 
132                                 it = parameters.find("column");
133                                 //user has given a template file
134                                 if(it != parameters.end()){ 
135                                         path = m->hasPath(it->second);
136                                         //if the user has not given a path then, add inputdir. else leave path alone.
137                                         if (path == "") {       parameters["column"] = inputDir + it->second;           }
138                                 }
139                                 
140                                 it = parameters.find("name");
141                                 //user has given a template file
142                                 if(it != parameters.end()){ 
143                                         path = m->hasPath(it->second);
144                                         //if the user has not given a path then, add inputdir. else leave path alone.
145                                         if (path == "") {       parameters["name"] = inputDir + it->second;             }
146                                 }
147                                 
148                                 it = parameters.find("shared");
149                                 //user has given a template file
150                                 if(it != parameters.end()){ 
151                                         path = m->hasPath(it->second);
152                                         //if the user has not given a path then, add inputdir. else leave path alone.
153                                         if (path == "") {       parameters["shared"] = inputDir + it->second;           }
154                                 }
155                         }
156
157                         //required parameters
158                         phylipfile = validParameter.validFile(parameters, "phylip", true);
159                         if (phylipfile == "not open") { abort = true; }
160                         else if (phylipfile == "not found") { phylipfile = ""; }        
161                         else {  format = "phylip";      inputfile = phylipfile; m-> setPhylipFile(phylipfile); if (outputDir == "") { outputDir += m->hasPath(phylipfile); }  }
162                         
163                         columnfile = validParameter.validFile(parameters, "column", true);
164                         if (columnfile == "not open") { abort = true; } 
165                         else if (columnfile == "not found") { columnfile = ""; }
166                         else {  format = "column";      inputfile = columnfile; m->setColumnFile(columnfile); if (outputDir == "") { outputDir += m->hasPath(columnfile); } }
167                         
168                         sharedfile = validParameter.validFile(parameters, "shared", true);
169                         if (sharedfile == "not open") { abort = true; } 
170                         else if (sharedfile == "not found") { sharedfile = ""; }
171                         else {  format = "shared";      inputfile = sharedfile; m->setSharedFile(sharedfile); if (outputDir == "") { outputDir += m->hasPath(sharedfile); } }
172                         
173                         namefile = validParameter.validFile(parameters, "name", true);
174                         if (namefile == "not open") { abort = true; }   
175                         else if (namefile == "not found") { namefile = ""; }
176                         else { m->setNameFile(namefile); }
177                         
178                         
179                         //error checking on files                       
180                         if ((sharedfile == "") && ((phylipfile == "") && (columnfile == "")))   { 
181                                 sharedfile = m->getSharedFile(); 
182                                 if (sharedfile != "") { format = "shared"; inputfile = sharedfile; m->mothurOut("Using " + sharedfile + " as input file for the shared parameter."); m->mothurOutEndLine(); }
183                                 else { 
184                                         //is there are current file available for either of these?
185                                         //give priority to column, then phylip
186                                         columnfile = m->getColumnFile(); 
187                                         if (columnfile != "") {  format = "column"; inputfile = columnfile; m->mothurOut("Using " + columnfile + " as input file for the column parameter."); m->mothurOutEndLine(); }
188                                         else { 
189                                                 phylipfile = m->getPhylipFile(); 
190                                                 if (phylipfile != "") { format = "phylip";  inputfile = phylipfile; m->mothurOut("Using " + phylipfile + " as input file for the phylip parameter."); m->mothurOutEndLine(); }
191                                                 else { 
192                                                         m->mothurOut("No valid current files. You must provide a shared or phylip or column file."); m->mothurOutEndLine(); 
193                                                         abort = true;
194                                                 }
195                                         }
196                                 }
197                         }
198                         else if ((phylipfile != "") && (columnfile != "")) { m->mothurOut("When running the heatmap.sim command with a distance file you may not use both the column and the phylip parameters."); m->mothurOutEndLine(); abort = true; }
199                         
200                         if (columnfile != "") {
201                                 if (namefile == "") { 
202                                         namefile = m->getNameFile(); 
203                                         if (namefile != "") {  m->mothurOut("Using " + namefile + " as input file for the name parameter."); m->mothurOutEndLine(); }
204                                         else { 
205                                                 m->mothurOut("You need to provide a namefile if you are going to use the column format."); m->mothurOutEndLine(); 
206                                                 abort = true; 
207                                         }       
208                                 }
209                         }
210                         
211                         
212                         //if the user changes the output directory command factory will send this info to us in the output parameter 
213                         outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  outputDir = m->hasPath(inputfile);              }
214
215                         //check for optional parameter and set defaults
216                         // ...at some point should added some additional type checking...
217                                                         
218                         label = validParameter.validFile(parameters, "label", false);                   
219                         if (label == "not found") { label = ""; }
220                         else { 
221                                 if(label != "all") {  m->splitAtDash(label, labels);  allLines = 0;  }
222                                 else { allLines = 1;  }
223                         }
224                                 
225                         calc = validParameter.validFile(parameters, "calc", false);                     
226                         if (calc == "not found") { calc = "jest-thetayc";  }
227                         else { 
228                                 if (calc == "default")  {  calc = "jest-thetayc";  }
229                         }
230                         m->splitAtDash(calc, Estimators);
231                         if (m->inUsersGroups("citation", Estimators)) { 
232                                 ValidCalculators validCalc; validCalc.printCitations(Estimators); 
233                                 //remove citation from list of calcs
234                                 for (int i = 0; i < Estimators.size(); i++) { if (Estimators[i] == "citation") {  Estimators.erase(Estimators.begin()+i); break; } }
235                         }
236                                 
237                         groups = validParameter.validFile(parameters, "groups", false);                 
238                         if (groups == "not found") { groups = ""; }
239                         else { 
240                                 m->splitAtDash(groups, Groups);
241                                 m->setGroups(Groups);
242                         }
243                         
244                         string temp = validParameter.validFile(parameters, "fontsize", false);                          if (temp == "not found") { temp = "24"; }
245                         m->mothurConvert(temp, fontsize);
246                         
247                         if (abort == false) {
248                                 ValidCalculators validCalculator;
249                         
250                                 int i;
251                                 for (i=0; i<Estimators.size(); i++) {
252                                         if (validCalculator.isValidCalculator("heat", Estimators[i]) == true) { 
253                                                 if (Estimators[i] == "jabund") {        
254                                                         heatCalculators.push_back(new JAbund());
255                                                 }else if (Estimators[i] == "sorabund") { 
256                                                         heatCalculators.push_back(new SorAbund());
257                                                 }else if (Estimators[i] == "jclass") { 
258                                                         heatCalculators.push_back(new Jclass());
259                                                 }else if (Estimators[i] == "sorclass") { 
260                                                         heatCalculators.push_back(new SorClass());
261                                                 }else if (Estimators[i] == "jest") { 
262                                                         heatCalculators.push_back(new Jest());
263                                                 }else if (Estimators[i] == "sorest") { 
264                                                         heatCalculators.push_back(new SorEst());
265                                                 }else if (Estimators[i] == "thetayc") { 
266                                                         heatCalculators.push_back(new ThetaYC());
267                                                 }else if (Estimators[i] == "thetan") { 
268                                                         heatCalculators.push_back(new ThetaN());
269                                                 }else if (Estimators[i] == "morisitahorn") { 
270                                                         heatCalculators.push_back(new MorHorn());
271                                                 }else if (Estimators[i] == "braycurtis") { 
272                                                         heatCalculators.push_back(new BrayCurtis());
273                                                 }
274                                         }
275                                 }
276                                 
277                         }
278                 }
279
280                                 
281
282         }
283         catch(exception& e) {
284                 m->errorOut(e, "HeatMapSimCommand", "HeatMapSimCommand");
285                 exit(1);
286         }
287 }
288 //**********************************************************************************************************************
289
290 int HeatMapSimCommand::execute(){
291         try {
292         
293                 if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
294                 
295                 heatmap = new HeatMapSim(outputDir, inputfile, fontsize);
296                 
297                 if (format == "shared") {
298                         runCommandShared();
299                 }else{  runCommandDist();       }
300                 
301                 delete heatmap;
302                 
303                 if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        m->mothurRemove(outputNames[i]);  } outputTypes.clear(); return 0; }
304                 
305                 m->mothurOutEndLine();
306                 m->mothurOut("Output File Names: "); m->mothurOutEndLine();
307                 for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
308                 m->mothurOutEndLine();
309                 
310                 return 0;
311         }
312         catch(exception& e) {
313                 m->errorOut(e, "HeatMapSimCommand", "execute");
314                 exit(1);
315         }
316 }
317
318 //**********************************************************************************************************************
319 int HeatMapSimCommand::runCommandShared() {
320         try {
321                 //if the users entered no valid calculators don't execute command
322                 if (heatCalculators.size() == 0) { m->mothurOut("No valid calculators."); m->mothurOutEndLine(); return 0; }
323                 
324                 input = new InputData(sharedfile, "sharedfile");
325                 lookup = input->getSharedRAbundVectors();
326                 string lastLabel = lookup[0]->getLabel();
327                         
328                 if (lookup.size() < 2) { m->mothurOut("You have not provided enough valid groups.  I cannot run the command."); m->mothurOutEndLine(); return 0;}
329                                 
330                 //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
331                 set<string> processedLabels;
332                 set<string> userLabels = labels;
333                 
334                 if (m->control_pressed) {  delete input;  for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }  m->clearGroups(); return 0; }
335                 
336                 //as long as you are not at the end of the file or done wih the lines you want
337                 while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
338                         
339                         if (m->control_pressed) { delete input;  for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } m->clearGroups(); return 0; }
340
341                         if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
342         
343                                 m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
344                                 vector<string> outfilenames = heatmap->getPic(lookup, heatCalculators);
345                                 for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]);  outputTypes["svg"].push_back(outfilenames[i]); }
346                                         
347                                 processedLabels.insert(lookup[0]->getLabel());
348                                 userLabels.erase(lookup[0]->getLabel());
349                         }
350                                 
351                         if ((m->anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
352                                 string saveLabel = lookup[0]->getLabel();
353                         
354                                 for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
355                                 lookup = input->getSharedRAbundVectors(lastLabel);                              
356
357                                 m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
358                                 vector<string> outfilenames = heatmap->getPic(lookup, heatCalculators);
359                                 for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]);  }
360                                         
361                                 processedLabels.insert(lookup[0]->getLabel());
362                                 userLabels.erase(lookup[0]->getLabel());
363                                 
364                                 //restore real lastlabel to save below
365                                 lookup[0]->setLabel(saveLabel);
366                         }
367                                 
368                         //prevent memory leak
369                          
370                         lastLabel = lookup[0]->getLabel();                      
371
372                         //get next line to process
373                         for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
374                         lookup = input->getSharedRAbundVectors();
375
376                 }
377                 
378                         
379                 if (m->control_pressed) {  delete input;  m->clearGroups();  return 0; }
380
381                 //output error messages about any remaining user labels
382                 set<string>::iterator it;
383                 bool needToRun = false;
384                 for (it = userLabels.begin(); it != userLabels.end(); it++) {  
385                         m->mothurOut("Your file does not include the label " + *it); 
386                         if (processedLabels.count(lastLabel) != 1) {
387                                 m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
388                                 needToRun = true;
389                         }else {
390                                 m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
391                         }
392                 }
393                 
394                 if (m->control_pressed) {  delete input;  m->clearGroups(); return 0; }
395                 
396                 //run last label if you need to
397                 if (needToRun == true)  {
398                         for (int i = 0; i < lookup.size(); i++) {  if (lookup[i] != NULL) { delete lookup[i]; } } 
399                         lookup = input->getSharedRAbundVectors(lastLabel);                              
400
401                         m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
402                         vector<string> outfilenames = heatmap->getPic(lookup, heatCalculators);
403                         for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]);  }
404                         
405                         for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
406                 }
407                 
408                 if (m->control_pressed) {  delete input;  m->clearGroups(); return 0; }
409                         
410                 //reset groups parameter
411                 m->clearGroups();  
412                         
413                 delete input;  
414         
415                 return 0;
416         }
417         catch(exception& e) {
418                 m->errorOut(e, "HeatMapSimCommand", "runCommandShared");
419                 exit(1);
420         }
421 }
422 //**********************************************************************************************************************
423 int HeatMapSimCommand::runCommandDist() {
424         try {
425         
426                 vector< vector<double> > matrix;
427                 vector<string> names;
428                 ifstream in;
429                 
430                 //read distance file and create distance vector and names vector
431                 if (format == "phylip") {
432                         //read phylip file
433                         m->openInputFile(phylipfile, in);
434                         
435                         string name;
436                         int numSeqs;
437                         in >> numSeqs >> name; 
438                         
439                         //save name
440                         names.push_back(name);
441                 
442                         //resize the matrix and fill with zeros
443                         matrix.resize(numSeqs); 
444                         for(int i = 0; i < numSeqs; i++) {
445                                 matrix[i].resize(numSeqs, 0.0);
446                         }
447                                         
448                         //determine if matrix is square or lower triangle
449                         //if it is square read the distances for the first sequence
450                         char d;
451                         bool square;
452                         while((d=in.get()) != EOF){
453                                 
454                                 //is d a number meaning its square
455                                 if(isalnum(d)){ 
456                                         square = true;
457                                         in.putback(d);
458                                         
459                                         for(int i=0;i<numSeqs;i++){
460                                                 in >> matrix[0][i];
461                                         }
462                                         break;
463                                 }
464                                 
465                                 //is d a line return meaning its lower triangle
466                                 if(d == '\n'){
467                                         square = false;
468                                         break;
469                                 }
470                         }
471                         
472                         //read rest of matrix
473                         if (square == true) { 
474                                 for(int i=1;i<numSeqs;i++){
475                                         in >> name;             
476                                         names.push_back(name);
477                                         
478                                         if (m->control_pressed) { return 0; }
479                                         
480                                         for(int j=0;j<numSeqs;j++) { in >> matrix[i][j];  }
481                                         m->gobble(in);
482                                 }
483                         }else { 
484                                 double dist;
485                                 for(int i=1;i<numSeqs;i++){
486                                         in >> name;     
487                                         names.push_back(name);  
488                                         
489                                         if (m->control_pressed) { return 0; }
490                                         
491                                         for(int j=0;j<i;j++){
492                                                 in >> dist;
493                                                 matrix[i][j] = dist;  matrix[j][i] = dist;
494                                         }
495                                         m->gobble(in);
496                                 }
497                         }
498                         in.close();
499                 }else {
500                         //read names file
501                         NameAssignment* nameMap = new NameAssignment(namefile);
502                         nameMap->readMap();
503                         
504                         //put names in order in vector
505                         for (int i = 0; i < nameMap->size(); i++) {
506                                 names.push_back(nameMap->get(i));
507                         }
508                         
509                         //resize matrix
510                         matrix.resize(nameMap->size());
511                         for (int i = 0; i < nameMap->size(); i++) {
512                                 matrix[i].resize(nameMap->size(), 0.0);
513                         }
514                         
515                         //read column file
516                         string first, second;
517                         double dist;
518                         m->openInputFile(columnfile, in);
519                         
520                         while (!in.eof()) {
521                                 in >> first >> second >> dist; m->gobble(in);
522                                 
523                                 if (m->control_pressed) { return 0; }
524                                 
525                                 map<string, int>::iterator itA = nameMap->find(first);
526                                 map<string, int>::iterator itB = nameMap->find(second);
527                                 
528                                 if(itA == nameMap->end()){  m->mothurOut("AAError: Sequence '" + first + "' was not found in the names file, please correct\n"); exit(1);  }
529                                 if(itB == nameMap->end()){  m->mothurOut("ABError: Sequence '" + second + "' was not found in the names file, please correct\n"); exit(1);  }
530                                 
531                                 //save distance
532                                 matrix[itA->second][itB->second] = dist;
533                                 matrix[itB->second][itA->second] = dist;
534                         }
535                         in.close();
536                         
537                         delete nameMap;
538                 }
539                 
540                 
541                 string outputFileName = heatmap->getPic(matrix, names);
542                 outputNames.push_back(outputFileName); //vector<vector<double>>, vector<string>
543                 outputTypes["svg"].push_back(outputFileName);
544                 
545                 return 0;
546         }
547         catch(exception& e) {
548                 m->errorOut(e, "HeatMapSimCommand", "runCommandDist");
549                 exit(1);
550         }
551 }
552 //**********************************************************************************************************************
553
554
555
556
557
558