]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed kendall method in corr.axes
authorwestcott <westcott>
Fri, 4 Feb 2011 20:49:06 +0000 (20:49 +0000)
committerwestcott <westcott>
Fri, 4 Feb 2011 20:49:06 +0000 (20:49 +0000)
corraxescommand.cpp
mergegroupscommand.cpp
nmdscommand.cpp
pcacommand.cpp
splitabundcommand.cpp
splitgroupscommand.cpp

index 64ac9b931545f853ae2b960259d60edce06564eb..26cdcda0178bcfdbfc8c89fbbbced8866edb796c 100644 (file)
@@ -387,23 +387,6 @@ int CorrAxesCommand::calcPearson(map<string, vector<float> >& axes, ofstream& ou
 int CorrAxesCommand::calcSpearman(map<string, vector<float> >& axes, ofstream& out) {
        try {
                
-               /*axes.clear();
-               axes["1a"].push_back(1);
-               axes["1b"].push_back(1);
-               axes["1c"].push_back(1);
-               axes["2a"].push_back(2);
-               axes["2b"].push_back(2);
-               axes["2c"].push_back(2);
-               axes["3a"].push_back(3);
-               axes["3b"].push_back(3);
-               axes["3c"].push_back(3);
-               axes["4a"].push_back(4);
-               axes["4b"].push_back(4);
-               axes["4c"].push_back(4);
-               axes["5a"].push_back(5);
-               axes["5b"].push_back(5);
-               axes["5c"].push_back(5);*/
-               
                //format data
                vector< map<float, int> > tableX; tableX.resize(numaxes);
                map<float, int>::iterator itTable;
@@ -571,25 +554,6 @@ int CorrAxesCommand::calcSpearman(map<string, vector<float> >& axes, ofstream& o
 int CorrAxesCommand::calcKendall(map<string, vector<float> >& axes, ofstream& out) {
        try {
                
-               numaxes = 1;
-               axes.clear();
-                axes["1a"].push_back(1);
-                axes["1b"].push_back(1);
-                axes["1c"].push_back(1);
-                axes["2a"].push_back(2);
-                axes["2b"].push_back(2);
-                axes["2c"].push_back(2);
-                axes["3a"].push_back(3);
-                axes["3b"].push_back(3);
-                axes["3c"].push_back(3);
-                axes["4a"].push_back(4);
-                axes["4b"].push_back(4);
-                axes["4c"].push_back(4);
-                axes["5a"].push_back(5);
-                axes["5b"].push_back(5);
-                axes["5c"].push_back(5);
-               
-               
                //format data
                vector< vector<spearmanRank> > scores; scores.resize(numaxes);
                for (map<string, vector<float> >::iterator it = axes.begin(); it != axes.end(); it++) {
@@ -629,32 +593,6 @@ int CorrAxesCommand::calcKendall(map<string, vector<float> >& axes, ofstream& ou
                                }
                        }
                }
-               cout << "axes ranks = ";
-               for(int i = 0; i < scores[0].size(); i++) {  cout << scores[0][i].score << '\t'; }
-               cout << endl;   
-                lookupFloat.clear();
-                lookupFloat.resize(15);
-                for (int i = 0; i < lookupFloat.size(); i++) {
-                lookupFloat[i] = new SharedRAbundFloatVector();
-                }
-                lookupFloat[0]->push_back(0.2288227, "1a");  lookupFloat[0]->setGroup("1a");
-                lookupFloat[1]->push_back(0.7394062, "1b");  lookupFloat[1]->setGroup("1b");
-                lookupFloat[2]->push_back(0.4521187, "1c");  lookupFloat[2]->setGroup("1c");
-                lookupFloat[3]->push_back(0.1598630, "2a");  lookupFloat[3]->setGroup("2a");
-                lookupFloat[4]->push_back(0.09588156, "2b");  lookupFloat[4]->setGroup("2b");
-                
-                lookupFloat[5]->push_back(0.933174, "2c");  lookupFloat[5]->setGroup("2c");
-                lookupFloat[6]->push_back(0.3958304, "3a");  lookupFloat[6]->setGroup("3a");;
-                lookupFloat[7]->push_back(0.2364419, "3b");  lookupFloat[7]->setGroup("3b");
-                lookupFloat[8]->push_back(0.1697712, "3c");  lookupFloat[8]->setGroup("3c");
-                lookupFloat[9]->push_back(0.4077173, "4a");  lookupFloat[9]->setGroup("4a");
-                
-                lookupFloat[10]->push_back(0.6116547, "4b");  lookupFloat[10]->setGroup("4b");
-                lookupFloat[11]->push_back(0.9374322, "4c");  lookupFloat[11]->setGroup("4c");
-                lookupFloat[12]->push_back(0.852184, "5a");  lookupFloat[12]->setGroup("5a");
-                lookupFloat[13]->push_back(0.845094, "5b");  lookupFloat[13]->setGroup("5b");
-                lookupFloat[14]->push_back(0.5795778, "5c");  lookupFloat[14]->setGroup("5c");
-               
                
                //for each otu
                for (int i = 0; i < lookupFloat[0]->getNumBins(); i++) {
@@ -704,38 +642,13 @@ int CorrAxesCommand::calcKendall(map<string, vector<float> >& axes, ofstream& ou
                                int numCoor = 0;
                                int numDisCoor = 0;
                                
-                               //assemble otus ranks in same order as axis ranks, if ties, put in the best order possible
-                               //NOTE: after this ordering the scores[j] indexes may not match the otus indexes within tied sections
-                               //since we do not use the axes ranks except to order the otu ranks, I did not take the time to reorder the axes ranks
                                vector<spearmanRank> otus; 
                                vector<spearmanRank> otusTemp;
                                for (int l = 0; l < scores[j].size(); l++) {   
                                        spearmanRank member(scores[j][l].name, rankOtus[scores[j][l].name]);
-                                       otusTemp.push_back(member);
-                                       
-                                       if (l != (scores[j].size()-1)) { // you are not the last so you can look ahead
-                                               if (scores[j][l].score != scores[j][l+1].score) { // you are done with ties, order them and continue
-                                                       //order otus within tied section in the best way possible to make coor pairs
-                                                       sort(otusTemp.begin(), otusTemp.end(), compareSpearmanReverse);
-                                                       
-                                                       //save order in otus
-                                                       for (int h = 0; h < otusTemp.size(); h++) { ; otus.push_back(otusTemp[h]); }
-                                                       
-                                                       otusTemp.clear();
-                                               }
-                                       }else { // you are the last one
-                                               //order otus within tied section in the best way possible to make coor pairs
-                                               sort(otusTemp.begin(), otusTemp.end(), compareSpearmanReverse);
-                                       
-                                               //save order in otus
-                                               for (int h = 0; h < otusTemp.size(); h++) {  otus.push_back(otusTemp[h]); }
-                                       }
+                                       otus.push_back(member);
                                }
                                
-                               cout << "otu ranks = ";
-                               for (int h = 0; h < otus.size(); h++ ) { cout << otus[h].score << '\t'; }
-                               cout << endl;
-                               
                                int count = 0;
                                for (int l = 0; l < scores[j].size(); l++) {
                                        
@@ -753,14 +666,11 @@ int CorrAxesCommand::calcKendall(map<string, vector<float> >& axes, ofstream& ou
                                        numDisCoor += numWithLowerRank;
                                }
                                
-                               //sample size
-                               //int n = lookupFloat.size();
                                //comparing to yourself
                                count -= lookupFloat.size();
                                
-                               //double p = ( (4 * P) / (float) ((n * (n - 1)) - numTies) ) - 1.0;
                                double p = (numCoor - numDisCoor) / (float) count;
-                               cout << "numCoor = " << numCoor << " numDisCoor = " << numDisCoor << " p = " << p << " count = " << count << endl;
+
                                out << '\t' << p;
                                pValues[j] = p;
 
index ad0dc312361c0a5d55a35b919b0102832eabc858..4738389010cda4ecc598da27e4bd52b1205a8218 100644 (file)
@@ -153,14 +153,14 @@ MergeGroupsCommand::MergeGroupsCommand(string option) {
 void MergeGroupsCommand::help(){
        try {
                m->mothurOut("The merge.groups command reads a shared file and a design file and merges the groups in the shared file that are in the same grouping in the design file.\n");
-               m->mothurOut("The metastats command outputs a .shared file. \n");
-               m->mothurOut("The metastats command parameters are shared, groups, label and design.  The design and shared parameter are required.\n");
+               m->mothurOut("The merge.groups command outputs a .shared file. \n");
+               m->mothurOut("The merge.groups command parameters are shared, groups, label and design.  The design and shared parameter are required.\n");
                m->mothurOut("The design parameter allows you to assign your groups to sets when you are running metastat. mothur will run all pairwise comparisons of the sets. It is required. \n");
                m->mothurOut("The design file looks like the group file.  It is a 2 column tab delimited file, where the first column is the group name and the second column is the set the group belongs to.\n");
                m->mothurOut("The groups parameter allows you to specify which of the groups in your shared you would like included. The group names are separated by dashes.\n");
                m->mothurOut("The label parameter allows you to select what distance levels you would like, and are also separated by dashes.\n");
-               m->mothurOut("The merge.groups command should be in the following format: metastats(design=yourDesignFile, shared=yourSharedFile).\n");
-               m->mothurOut("Example metastats(design=temp.design, groups=A-B-C, shared=temp.shared).\n");
+               m->mothurOut("The merge.groups command should be in the following format: merge.groups(design=yourDesignFile, shared=yourSharedFile).\n");
+               m->mothurOut("Example merge.groups(design=temp.design, groups=A-B-C, shared=temp.shared).\n");
                m->mothurOut("The default value for groups is all the groups in your sharedfile, and all labels in your inputfile will be used.\n");
                m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
                
index 0661f24b09d4494d658a6044fdce1fafe0b5582f..28bf3978f7344fe0f405717ad80adc8851e2cffd 100644 (file)
@@ -159,8 +159,8 @@ void NMDSCommand::help(){
                m->mothurOut("The nmds command parameters are phylip, axes, mindim, maxdim, maxiters, iters and epsilon."); m->mothurOutEndLine();
                m->mothurOut("The phylip parameter allows you to enter your distance file."); m->mothurOutEndLine();
                m->mothurOut("The axes parameter allows you to enter a file containing a starting configuration."); m->mothurOutEndLine();
-               m->mothurOut("The maxdim parameter allows you to select how maximum dimensions to use. Default=2"); m->mothurOutEndLine();
-               m->mothurOut("The mindim parameter allows you to select how minimum dimensions to use. Default=2"); m->mothurOutEndLine();
+               m->mothurOut("The maxdim parameter allows you to select the maximum dimensions to use. Default=2"); m->mothurOutEndLine();
+               m->mothurOut("The mindim parameter allows you to select the minimum dimensions to use. Default=2"); m->mothurOutEndLine();
                m->mothurOut("The maxiters parameter allows you to select the maximum number of iters to try with each random configuration. Default=500"); m->mothurOutEndLine();
                m->mothurOut("The iters parameter allows you to select the number of random configuration to try. Default=10"); m->mothurOutEndLine();
                m->mothurOut("The epsilon parameter allows you to select set an acceptable stopping point. Default=1e-12."); m->mothurOutEndLine();
index 4ca977876e8fe9bf250338c799f3cd69d2a29062..8fb41213c7f836cb45cb89474ae8c874e96cd42e 100644 (file)
@@ -132,7 +132,7 @@ void PCACommand::help(){
        try {
                m->mothurOut("The pca command can only be run after a successful read.otu command of a shared or relabund file."); m->mothurOutEndLine();
                m->mothurOut("The pca command parameters are label, groups and metric. No parameters are required."); m->mothurOutEndLine();
-               m->mothurOut("The label parameter is used to analyze specific labels in your input. Default is the first label in your shared or relabund file. Multpile labels may be separated by dashes.\n");
+               m->mothurOut("The label parameter is used to analyze specific labels in your input. Default is the first label in your shared or relabund file. Multiple labels may be separated by dashes.\n");
                m->mothurOut("The groups parameter allows you to specify which groups you would like analyzed. Groupnames are separated by dashes.\n");
                m->mothurOut("The metric parameter allows indicate you if would like the pearson correlation coefficient calculated. Default=True"); m->mothurOutEndLine();
                m->mothurOut("Example pca(groups=yourGroups).\n");
index 80145bfee4f3bfad04ae5becb2f5198e7a109abb..a8ca812e0e0cb6854fd3c806e8e26249eb9400a2 100644 (file)
@@ -332,7 +332,7 @@ int SplitAbundCommand::execute(){
                        if (accnos)                                                     {  writeAccnos(tag);    }
                        if (fastafile != "")                            {  parseFasta(tag);             }
                }
-
+               
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
index 1cbc2fcc6810913b5f85636c7de96fa281c1b5d0..3fa7d047b372a1c4335b9446c1b34d2aac9b702a 100644 (file)
@@ -321,6 +321,15 @@ int SplitGroupCommand::splitFasta() {
                        (*(filehandles[it3->first])).close();
                        delete it3->second;
                }
+               
+               vector<string> newOutputNames;
+               //remove blank files
+               for (int i = 0; i < outputNames.size(); i++) {
+                       if (m->isBlank(outputNames[i])) {
+                               remove(outputNames[i].c_str());
+                       }else { newOutputNames.push_back(outputNames[i]); }
+               }
+               outputNames = newOutputNames;
                                
                return 0;