int HeatMapCommand::execute(){
try {
int count = 1;
-
+
if (format == "sharedfile") {
//you have groups
read = new ReadOTUFile(globaldata->inputFileName);
input = globaldata->ginput;
lookup = input->getSharedRAbundVectors();
- }else if (format == "shared") {
- //you are using a list and a groupfile
- read = new ReadOTUFile(globaldata->inputFileName);
- read->read(&*globaldata);
-
- input = globaldata->ginput;
- SharedList = globaldata->gSharedList;
- lookup = SharedList->getSharedRAbundVector();
}else if (format == "list") {
//you are using just a list file and have only one group
read = new ReadOTUFile(globaldata->inputFileName);
cout << lookup[0]->getLabel() << '\t' << count << endl;
heatmap->getPic(lookup);
}
-
+
+ //prevent memory leak
+ for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
+
//get next line to process
lookup = input->getSharedRAbundVectors();
count++;
heatmap->getPic(rabund);
}
+ delete rabund;
rabund = input->getRAbundVector();
count++;
}