]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed bug in libshuff
authorwestcott <westcott>
Thu, 19 Nov 2009 20:04:04 +0000 (20:04 +0000)
committerwestcott <westcott>
Thu, 19 Nov 2009 20:04:04 +0000 (20:04 +0000)
fullmatrix.cpp
fullmatrix.h
groupmap.cpp
groupmap.h
libshuff.cpp
libshuffcommand.cpp
readdistcommand.cpp
venn.cpp

index 5bb2d2336d6ea263a1b0596511abf5f66cb7a248..5612041528a00e9e0e441422662c6d3738bcb07c 100644 (file)
@@ -10,7 +10,6 @@
 #include "fullmatrix.h"
 
 /**************************************************************************/
-
 //This constructor reads a distance matrix file and stores the data in the matrix.
 FullMatrix::FullMatrix(ifstream& filehandle) {
        try{
@@ -23,14 +22,13 @@ FullMatrix::FullMatrix(ifstream& filehandle) {
                //make the matrix filled with zeros
                matrix.resize(numSeqs); 
                for(int i = 0; i < numSeqs; i++) {
-                       matrix[i].resize(numSeqs, 0);
+                       matrix[i].resize(numSeqs, 0.0);
                }
-               
                group = groupmap->getGroup(name);
                if(group == "not found") {      mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
                index.resize(numSeqs);
-               index[0].groupName = group; 
                index[0].seqName = name;
+               index[0].groupName = group;
                
                //determine if matrix is square or lower triangle
                //if it is square read the distances for the first sequence
@@ -60,22 +58,8 @@ FullMatrix::FullMatrix(ifstream& filehandle) {
                if (square == true) { readSquareMatrix(filehandle); }
                else { readLTMatrix(filehandle); }
                
-               //sort sequences so they are gathered in groups for processing
-               sortGroups(0, numSeqs-1);
-               
-               groups.push_back(index[0].groupName);
-               sizes.push_back(1);
-               int groupCount = 0;
-               
-               for(int i=1;i<numSeqs;i++){
-                       if(index[i].groupName == index[i-1].groupName){ sizes[groupCount]++;    }
-                       else{
-                               sizes.push_back(1);
-                               groups.push_back(index[i].groupName);
-                               groupCount++;
-                       }                               
-               }
-               
+               sortGroups(0, numSeqs-1);       
+                               
        }
        catch(exception& e) {
                errorOut(e, "FullMatrix", "FullMatrix");
@@ -97,8 +81,8 @@ void FullMatrix::readSquareMatrix(ifstream& filehandle) {
                        filehandle >> name;             
                        
                        group = groupmap->getGroup(name);
-                       index[i].groupName = group;
                        index[i].seqName = name;
+                       index[i].groupName = group;
                        
                        if(group == "not found") {      mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
                                
@@ -127,25 +111,24 @@ void FullMatrix::readLTMatrix(ifstream& filehandle) {
                float distance;
 
                string group, name;
-               
+       
                for(int i=1;i<numSeqs;i++){
                        filehandle >> name;             
-                                               
+                                       
                        group = groupmap->getGroup(name);
-                       index[i].groupName = group;
                        index[i].seqName = name;
+                       index[i].groupName = group;
        
                        if(group == "not found") {      mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine();  exit(1); }
                                
                        for(int j=0;j<i;j++){
                                filehandle >> distance;
-                                       
                                matrix[i][j] = distance;  matrix[j][i] = distance;
                                count++;
                                reading->update(count);
                        }
-                       
                }
+
                reading->finish();
                delete reading;
        }
@@ -159,61 +142,37 @@ void FullMatrix::readLTMatrix(ifstream& filehandle) {
 
 void FullMatrix::sortGroups(int low, int high){
        try{
-       
-               int i = low;
-               int j = high;
-               float y = 0;
-               string name;
                
-               /* compare value */
-               //what group does this row belong to
-               string z = index[(low + high) / 2].groupName;
-
-               /* partition */
-               do {
-                       /* find member above ... */
-                       while(index[i].groupName < z) i++;
-
-                       /* find element below ... */
-                       while(index[j].groupName > z) j--;
+               if (low < high) {
+                       int i = low+1;
+                       int j = high;
+                       int pivot = (low+high) / 2;
                        
-                       if(i <= j) {
-                               /* swap rows*/
-                               for (int h = 0; h < numSeqs; h++) {
-                                       y = matrix[i][h];
-                                       matrix[i][h] = matrix[j][h]; 
-                                       matrix[j][h] = y;
-                               }
+                       swapRows(low, pivot);  //puts pivot in final spot
+                       
+                       /* compare value */
+                       //what group does this row belong to
+                       string key = index[low].groupName;
+                       
+                       /* partition */
+                       while(i <= j) {
+                               /* find member above ... */
+                               while((i <= high) && (index[i].groupName <= key))       {  i++;  }  
                                
-                               /* swap columns*/
-                               for (int b = 0; b < numSeqs; b++) {
-                                       y = matrix[b][i];
-                                       matrix[b][i] = matrix[b][j]; 
-                                       matrix[b][j] = y;
+                               /* find element below ... */
+                               while((j >= low) && (index[j].groupName > key))         {  j--;  } 
+                                                               
+                               if(i < j) {
+                                       swapRows(i, j);
                                }
-                               
-                               //swap map elements
-                               z = index[i].groupName;
-                               index[i].groupName = index[j].groupName;
-                               index[j].groupName = z;
-                               
-                               name = index[i].seqName;
-                               index[i].seqName = index[j].seqName;
-                               index[j].seqName = name;
-
-                               
-                               i++; 
-                               j--;
-                       }
-               } while(i <= j);
-
-               /* recurse */
-               if(low < j) 
-               sortGroups(low, j);
-
-               if(i < high) 
-               sortGroups(i, high); 
-
+                       } 
+                       
+                       swapRows(low, j);
+                       
+                       /* recurse */
+                       sortGroups(low, j-1);
+                       sortGroups(j+1, high); 
+               }
        
        }
        catch(exception& e) {
@@ -222,6 +181,43 @@ void FullMatrix::sortGroups(int low, int high){
        }
 }
 
+/**************************************************************************/   
+void FullMatrix::swapRows(int i, int j) {
+       try {
+       
+               float y;
+               string z, name;
+               
+               /* swap rows*/
+               for (int h = 0; h < numSeqs; h++) {
+                       y = matrix[i][h];
+                       matrix[i][h] = matrix[j][h]; 
+                       matrix[j][h] = y;
+               }
+               
+               /* swap columns*/
+               for (int b = 0; b < numSeqs; b++) {
+                       y = matrix[b][i];
+                       matrix[b][i] = matrix[b][j]; 
+                       matrix[b][j] = y;
+               }
+               
+               //swap map elements
+               z = index[i].groupName;
+               index[i].groupName = index[j].groupName;
+               index[j].groupName = z;
+               
+               name = index[i].seqName;
+               index[i].seqName = index[j].seqName;
+               index[j].seqName = name;
+               
+               
+       }
+       catch(exception& e) {
+               errorOut(e, "FullMatrix", "swapRows");
+               exit(1);
+       }
+}
 /**************************************************************************/   
 
 float FullMatrix::get(int i, int j){   return matrix[i][j];            }
@@ -249,10 +245,12 @@ void FullMatrix::printMatrix(ostream& out) {
                for (int i = 0; i < numSeqs; i++) {
                        out << "row " << i << " group = " << index[i].groupName << " name = " << index[i].seqName << endl;
                        for (int j = 0; j < numSeqs; j++) {
-                               out << matrix[i][j] << " ";
+                               out << i << '\t' << j << '\t' << matrix[i][j] << endl;
                        }
                        out << endl;
                }
+               
+               for (int i = 0; i < numSeqs; i++) {  out << i << '\t' <<  index[i].seqName << endl;  }
        }
        catch(exception& e) {
                errorOut(e, "FullMatrix", "printMatrix");
index a669f70a1aa80428823ada2c40b42e209c6db8f8..890d07a846006e5e81570402b0fd4e61879e0b68 100644 (file)
@@ -30,6 +30,8 @@ public:
        int getNumSeqs();
        vector<int> getSizes();
        vector<string> getGroups();
+       void setGroups(vector<string> names) { groups = names;  }
+       void setSizes(vector<int> s)             { sizes = s;           }
        int getNumGroups();
        void printMatrix(ostream&);
        float get(int, int);
@@ -41,8 +43,9 @@ private:
        vector<Names> index; // row in vector, sequence group.  need to know this so when we sort it can be updated.
        vector<int> sizes;
        vector<string> groups;
-       void sortGroups(int, int);  //this function sorts the sequences within the matrix.
        
+       void sortGroups(int, int);  //this function sorts the sequences within the matrix.
+       void swapRows(int, int);
        
        GroupMap* groupmap;  //maps sequences to groups they belong to.
        int numSeqs;
index 6521128016900efe90b8f85b82a808f9f8791709..b627a6bda6e3fa63de073a4b3f6c20bee7a2a680 100644 (file)
@@ -29,8 +29,9 @@ void GroupMap::readMap() {
                        fileHandle >> seqGroup;                 //read from second column
                        
                        setNamesOfGroups(seqGroup);
-                                               
+                       
                        groupmap[seqName] = seqGroup;   //store data in map
+                       seqsPerGroup[seqGroup]++;  //increment number of seqs in that group
                
                        gobble(fileHandle);
                }
@@ -67,6 +68,7 @@ void GroupMap::setNamesOfGroups(string seqGroup) {
                        }
                        if (count == namesOfGroups.size()) {
                                namesOfGroups.push_back(seqGroup); //new group
+                               seqsPerGroup[seqGroup] = 0;
                                groupIndex[seqGroup] = index;
                                index++;
                        }
@@ -85,6 +87,24 @@ bool GroupMap::isValidGroup(string groupname) {
                exit(1);
        }
 }
+/************************************************************/
+int GroupMap::getNumSeqs(string group) {
+       try {
+               
+               map<string, int>::iterator itNum;
+               
+               itNum = seqsPerGroup.find(group);
+               
+               if (itNum == seqsPerGroup.end()) { return 0; }
+               
+               return seqsPerGroup[group];
+               
+       }
+       catch(exception& e) {
+               errorOut(e, "GroupMap", "getNumSeqs");
+               exit(1);
+       }
+}
 
 /************************************************************/
 vector<string> GroupMap::getNamesSeqs(){
index e52ada56056e14cf8df6f4a2b7e541d7c8b1fcc7..fd6c14605065ea3fd1f12613d89b6bca9a1e0861 100644 (file)
@@ -25,9 +25,10 @@ public:
        string getGroup(string);
        void setGroup(string, string);
        vector<string> namesOfGroups;
-       map<string, int> groupIndex;  //groupname, vectorIndex in namesOfGroups. - used by collectdisplays.
+       map<string, int> groupIndex;  //groupname, vectorIndex in namesOfGroups. - used by collectdisplays and libshuff commands.
        int getNumSeqs()  {  return groupmap.size();  }
        vector<string> getNamesSeqs();
+       int getNumSeqs(string); //return the number of seqs in a given group
                        
 private:
        ifstream fileHandle;
@@ -36,6 +37,7 @@ private:
        map<string, string>::iterator it;
        void setNamesOfGroups(string); 
        map<string, string> groupmap; //sequence name and groupname
+       map<string, int> seqsPerGroup;  //maps groupname to number of seqs in that group
 };
 
 #endif
index 002cd52d2aff36d8ac70d4ed9b919d8a8d0a2033..e6c83f7a42b20cb674675fd6608f9da5dd9f7fa6 100644 (file)
@@ -20,7 +20,6 @@ Libshuff::Libshuff(FullMatrix* D, int it, float step, float co) : matrix(D), ite
                groupNames = matrix->getGroups();
                groupSizes = matrix->getSizes();
                numGroups = matrix->getNumGroups();
-
                initializeGroups(matrix);
        }
        catch(exception& e) {
@@ -43,6 +42,7 @@ void Libshuff::initializeGroups(FullMatrix* matrix){
                }
                int index=0;
                for(int i=0;i<numGroups;i++){
+
                        for(int j=0;j<groupSizes[i];j++){
                                savedGroups[i][j] = groups[i][j] = index++;
                        }
@@ -64,9 +64,11 @@ vector<vector<vector<double> > > Libshuff::getSavedMins(){
 
 vector<double> Libshuff::getMinX(int x){
        try{
+
                vector<double> minX(groupSizes[x], 0);
                for(int i=0;i<groupSizes[x];i++){
-                       minX[i] = (groupSizes[x] > 1 ? (i==0 ? matrix->get(groups[x][0], groups[x][1]) : matrix->get(groups[x][i], groups[x][0])) : 0.0);
+                       minX[i] = (groupSizes[x] > 1 ? (i==0 ? matrix->get(groups[x][0], groups[x][1]) : matrix->get(groups[x][i], groups[x][0])) : 0.0); //get the first value in row i of this block
+                       //minX[i] = matrix->get(groups[x][i], groups[x][0]);
                        for(int j=0;j<groupSizes[x];j++){
                                if(i != j)      {
                                        double dx = matrix->get(groups[x][i], groups[x][j]);
index e78c00d4d1117d7832de2f3d7e7ff8a6accd9e47..2d84767bc998d1e8db1d1ab40e7f9836f2045595 100644 (file)
@@ -76,7 +76,17 @@ LibShuffCommand::LibShuffCommand(string option){
                        if (abort == false) {
                        
                                matrix = globaldata->gMatrix;                           //get the distance matrix
-                               setGroups();                                                            //set the groups to be analyzed
+                               setGroups();                                                            //set the groups to be analyzed and sorts them
+                               
+                               /********************************************************************************************/
+                               //this is needed because when we read the matrix we sort it into groups in alphabetical order
+                               //the rest of the command and the classes used in this command assume specific order
+                               /********************************************************************************************/
+                               matrix->setGroups(globaldata->gGroupmap->namesOfGroups);
+                               vector<int> sizes;
+                               for (int i = 0; i < globaldata->gGroupmap->namesOfGroups.size(); i++) {  sizes.push_back(globaldata->gGroupmap->getNumSeqs(globaldata->gGroupmap->namesOfGroups[i]));  }
+                               matrix->setSizes(sizes);
+                               
 
                                if(userform == "discrete"){
                                        form = new DLibshuff(matrix, iters, step, cutOff);
@@ -136,14 +146,17 @@ int LibShuffCommand::execute(){
                for(int i=0;i<numGroups-1;i++) {
                        for(int j=i+1;j<numGroups;j++) {
                                reading->newLine(groupNames[i]+'-'+groupNames[j], iters);
+                               int spoti = globaldata->gGroupmap->groupIndex[groupNames[i]]; //neccessary in case user selects groups so you know where they are in the matrix
+                               int spotj = globaldata->gGroupmap->groupIndex[groupNames[j]];
+       
                                for(int p=0;p<iters;p++) {              
-                                       form->randomizeGroups(i,j);
-                                       if(form->evaluatePair(i,j) >= savedDXYValues[i][j])     {       pValueCounts[i][j]++;   }
-                                       if(form->evaluatePair(j,i) >= savedDXYValues[j][i])     {       pValueCounts[j][i]++;   }
+                                       form->randomizeGroups(spoti,spotj); 
+                                       if(form->evaluatePair(spoti,spotj) >= savedDXYValues[spoti][spotj])     {       pValueCounts[i][j]++;   }
+                                       if(form->evaluatePair(spotj,spoti) >= savedDXYValues[spotj][spoti])     {       pValueCounts[j][i]++;   }
                                        reading->update(p);                     
                                }
-                               form->resetGroup(i);
-                               form->resetGroup(j);
+                               form->resetGroup(spoti);
+                               form->resetGroup(spotj);
                        }
                }
                reading->finish();
@@ -190,13 +203,17 @@ void LibShuffCommand::printCoverageFile() {
                        indices[i].assign(numGroups,0);
                        for(int j=0;j<numGroups;j++){
                                indices[i][j] = index++;
-                               for(int k=0;k<savedMinValues[i][j].size();k++){
-                                       if(allDistances[savedMinValues[i][j][k]].size() != 0){
-                                               allDistances[savedMinValues[i][j][k]][indices[i][j]]++;
+                               
+                               int spoti = globaldata->gGroupmap->groupIndex[groupNames[i]]; //neccessary in case user selects groups so you know where they are in the matrix
+                               int spotj = globaldata->gGroupmap->groupIndex[groupNames[j]];
+                               
+                               for(int k=0;k<savedMinValues[spoti][spotj].size();k++){
+                                       if(allDistances[savedMinValues[spoti][spotj][k]].size() != 0){
+                                               allDistances[savedMinValues[spoti][spotj][k]][indices[i][j]]++;
                                        }
                                        else{
-                                               allDistances[savedMinValues[i][j][k]].assign(numIndices, 0);
-                                               allDistances[savedMinValues[i][j][k]][indices[i][j]] = 1;
+                                               allDistances[savedMinValues[spoti][spotj][k]].assign(numIndices, 0);
+                                               allDistances[savedMinValues[spoti][spotj][k]][indices[i][j]] = 1;
                                        }
                                }
                        }
@@ -270,25 +287,28 @@ void LibShuffCommand::printSummaryFile() {
                int precision = (int)log10(iters);
                for(int i=0;i<numGroups;i++){
                        for(int j=i+1;j<numGroups;j++){
+                               int spoti = globaldata->gGroupmap->groupIndex[groupNames[i]]; //neccessary in case user selects groups so you know where they are in the matrix
+                               int spotj = globaldata->gGroupmap->groupIndex[groupNames[j]];
+                               
                                if(pValueCounts[i][j]){
-                                       cout << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[i][j] << '\t' << setprecision(precision) << pValueCounts[i][j]/(float)iters << endl;
-                                       mothurOutJustToLog(groupNames[i]+"-"+groupNames[j] + "\t" + toString(savedDXYValues[i][j]) + "\t" + toString((pValueCounts[i][j]/(float)iters))); mothurOutEndLine();
-                                       outSum << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[i][j] << '\t' << setprecision(precision) << pValueCounts[i][j]/(float)iters << endl;
+                                       cout << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[spoti][spotj] << '\t' << setprecision(precision) << pValueCounts[i][j]/(float)iters << endl;
+                                       mothurOutJustToLog(groupNames[i]+"-"+groupNames[j] + "\t" + toString(savedDXYValues[spoti][spotj]) + "\t" + toString((pValueCounts[i][j]/(float)iters))); mothurOutEndLine();
+                                       outSum << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[spoti][spotj] << '\t' << setprecision(precision) << pValueCounts[i][j]/(float)iters << endl;
                                }
                                else{
-                                       cout << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[i][j] << '\t' << '<' <<setprecision(precision) << 1/(float)iters << endl;
-                                       mothurOutJustToLog(groupNames[i]+"-"+groupNames[j] + "\t" + toString(savedDXYValues[i][j]) + "\t" + toString((1/(float)iters))); mothurOutEndLine();
-                                       outSum << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[i][j] << '\t' << '<' <<setprecision(precision) << 1/(float)iters << endl;
+                                       cout << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[spoti][spotj] << '\t' << '<' <<setprecision(precision) << 1/(float)iters << endl;
+                                       mothurOutJustToLog(groupNames[i]+"-"+groupNames[j] + "\t" + toString(savedDXYValues[spoti][spotj]) + "\t" + toString((1/(float)iters))); mothurOutEndLine();
+                                       outSum << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[spoti][spotj] << '\t' << '<' <<setprecision(precision) << 1/(float)iters << endl;
                                }
                                if(pValueCounts[j][i]){
-                                       cout << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[j][i] << '\t' << setprecision (precision) << pValueCounts[j][i]/(float)iters << endl;
-                                       mothurOutJustToLog(groupNames[j]+"-"+groupNames[i] + "\t" + toString(savedDXYValues[j][i]) + "\t" + toString((pValueCounts[j][i]/(float)iters))); mothurOutEndLine();
-                                       outSum << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[j][i] << '\t' << setprecision (precision) << pValueCounts[j][i]/(float)iters << endl;
+                                       cout << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[spotj][spoti] << '\t' << setprecision (precision) << pValueCounts[j][i]/(float)iters << endl;
+                                       mothurOutJustToLog(groupNames[j]+"-"+groupNames[i] + "\t" + toString(savedDXYValues[spotj][spoti]) + "\t" + toString((pValueCounts[j][i]/(float)iters))); mothurOutEndLine();
+                                       outSum << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[spotj][spoti] << '\t' << setprecision (precision) << pValueCounts[j][i]/(float)iters << endl;
                                }
                                else{
-                                       cout << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[j][i] << '\t' << '<' <<setprecision (precision) << 1/(float)iters << endl;
-                                       mothurOutJustToLog(groupNames[j]+"-"+groupNames[i] + "\t" + toString(savedDXYValues[j][i]) + "\t" + toString((1/(float)iters))); mothurOutEndLine();
-                                       outSum << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[j][i] << '\t' << '<' <<setprecision (precision) << 1/(float)iters << endl;
+                                       cout << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[spotj][spoti] << '\t' << '<' <<setprecision (precision) << 1/(float)iters << endl;
+                                       mothurOutJustToLog(groupNames[j]+"-"+groupNames[i] + "\t" + toString(savedDXYValues[spotj][spoti]) + "\t" + toString((1/(float)iters))); mothurOutEndLine();
+                                       outSum << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[spotj][spoti] << '\t' << '<' <<setprecision (precision) << 1/(float)iters << endl;
                                }
                        }
                }
@@ -344,6 +364,8 @@ void LibShuffCommand::setGroups() {
                
                //sort
                sort(globaldata->gGroupmap->namesOfGroups.begin(), globaldata->gGroupmap->namesOfGroups.end());
+               
+               for (int i = 0; i < globaldata->gGroupmap->namesOfGroups.size(); i++) {  globaldata->gGroupmap->groupIndex[globaldata->gGroupmap->namesOfGroups[i]] = i;  }
 
                groupNames = globaldata->Groups;
 
index 719740cf7589e121029197bb46e30bbdd62e6bda..f6b41951962b7ce6b85ae50a9958bc0408c13835 100644 (file)
@@ -72,7 +72,7 @@ ReadDistCommand::ReadDistCommand(string option){
                        if (columnfile != "") {
                                if (namefile == "") {  cout << "You need to provide a namefile if you are going to use the column format." << endl; abort = true; }
                        }
-               
+                       
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
                        //get user cutoff and precision or use defaults
@@ -93,6 +93,7 @@ ReadDistCommand::ReadDistCommand(string option){
                                else if (format == "matrix") { 
                                        groupMap = new GroupMap(groupfile);
                                        groupMap->readMap();
+       
                                        if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap;  }
                                        globaldata->gGroupmap = groupMap;
                                }
index 82020d46a18de0cb4ad4959498f3cbee1ddfe4a2..3961cd7bde9394b6b4702c08b55c1b96f1db4fa1 100644 (file)
--- a/venn.cpp
+++ b/venn.cpp
@@ -168,7 +168,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                }else { outsvg << "</text>\n"; }
 
                                outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"500\">The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(shared[0]) + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"520\">Percentage of species that are shared in groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString((shared[0] / (float)(numA[0] + numB[0] - shared[0]))) + "</text>\n";
+                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"520\">Percentage of species that are shared in groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString((shared[0] / (float)(numA[0] + numB[0] - shared[0]))*100) + "</text>\n";
                                outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"540\">The total richness for all groups is " + toString((float)(numA[0] + numB[0] - shared[0])) + "</text>\n";
                                
                                //close file