]> git.donarmstrong.com Git - mothur.git/commitdiff
some minor changes
authorpschloss <pschloss>
Sat, 26 Feb 2011 20:12:42 +0000 (20:12 +0000)
committerpschloss <pschloss>
Sat, 26 Feb 2011 20:12:42 +0000 (20:12 +0000)
Mothur.xcodeproj/project.pbxproj
corraxescommand.cpp
homovacommand.cpp
nmdscommand.cpp
pcoacommand.cpp

index 06755bc77cb3df69be811ad94390a55e6f350d4e..8caeba754ff1461ae31ad2b97eaf3d6455223368 100644 (file)
                        attributes = {
                                ORGANIZATIONNAME = "Schloss Lab";
                        };
-                       buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "mothur" */;
+                       buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "Mothur" */;
                        compatibilityVersion = "Xcode 3.1";
                        developmentRegion = English;
                        hasScannedForEncodings = 1;
                1DEB928B08733DD80010E9CD /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+                               ARCHS = "$(NATIVE_ARCH_ACTUAL)";
                                DEPLOYMENT_LOCATION = NO;
                                GCC_C_LANGUAGE_STANDARD = gnu99;
                                GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
                                        "-lreadline",
                                );
                                PREBINDING = NO;
-                               SDKROOT = macosx10.5;
+                               SDKROOT = "";
                        };
                        name = Release;
                };
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Release;
                };
-               1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "mothur" */ = {
+               1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "Mothur" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                                1DEB928A08733DD80010E9CD /* Debug */,
index f47427d62c2cc7f03615149b11cbfdee5135b083..ae6ee3a92207f0ee9fe594b5208479452ed6b643 100644 (file)
@@ -860,7 +860,7 @@ int CorrAxesCommand::getMetadata(){
                vector<string> groupNames;
                
                ifstream in;
-               m->openInputFile(axesfile, in);
+               m->openInputFile(metadatafile, in);
                
                string headerLine = m->getline(in); m->gobble(in);
                istringstream iss (headerLine,istringstream::in);
@@ -868,7 +868,7 @@ int CorrAxesCommand::getMetadata(){
                //read the first label, because it refers to the groups
                string columnLabel;
                iss >> columnLabel; m->gobble(iss); 
-               
+
                //save names of columns you are reading
                while (!iss.eof()) {
                        iss >> columnLabel; m->gobble(iss);
index 52456b4ddedcd7b1db62a4fa8d03c5082eedf932..defccd3beeddb28da8d22a092a2ec43343e5add0 100644 (file)
@@ -216,8 +216,8 @@ int HomovaCommand::execute(){
                m->openOutputFile(HOMOVAFileName, HOMOVAFile);
                outputNames.push_back(HOMOVAFileName); outputTypes["homova"].push_back(HOMOVAFileName);
                
-               HOMOVAFile << "HOMOVA\tBValue\tP-value\tSSwithin_values" << endl;
-               m->mothurOut("HOMOVA\tBValue\tP-value\tSSwithin_values\n");
+               HOMOVAFile << "HOMOVA\tBValue\tP-value\tSSwithin/(Ni-1)_values" << endl;
+               m->mothurOut("HOMOVA\tBValue\tP-value\tSSwithin/(Ni-1)_values\n");
                
                double fullHOMOVAPValue = runHOMOVA(HOMOVAFile, origGroupSampleMap, experimentwiseAlpha);
 
@@ -231,8 +231,7 @@ int HomovaCommand::execute(){
                        
                        for(itA=origGroupSampleMap.begin();itA!=origGroupSampleMap.end();itA++){
                                itB = itA;itB++;
-                               for(itB;itB!=origGroupSampleMap.end();itB++){
-                                       
+                               for(;itB!=origGroupSampleMap.end();itB++){
                                        map<string, vector<int> > pairwiseGroupSampleMap;
                                        pairwiseGroupSampleMap[itA->first] = itA->second;
                                        pairwiseGroupSampleMap[itB->first] = itB->second;
@@ -296,7 +295,7 @@ double HomovaCommand::runHOMOVA(ofstream& HOMOVAFile, map<string, vector<int> >
                HOMOVAFile << it->first;
                m->mothurOut(it->first);
                it++;
-               for(it;it!=groupSampleMap.end();it++){
+               for(;it!=groupSampleMap.end();it++){
                        HOMOVAFile << '-' << it->first;
                        m->mothurOut('-' + it->first);
                }
@@ -379,6 +378,8 @@ double HomovaCommand::calcBValue(map<string, vector<int> > groupSampleMap, vecto
                        
                        secondTermSum += (numSamplesInGroup - 1) * log(ssWithinVector[index] / (double)(numSamplesInGroup - 1));
                        inverseOneMinusSum += 1.0 / (double)(numSamplesInGroup - 1);
+                       
+                       ssWithinVector[index] /= (double)(numSamplesInGroup - 1); //this line is only for output purposes to scale SSw by the number of samples in the group
                        index++;
                }
                
index 6596859c8c13f0e86b501d8ba62e9601ff4bf45a..aa1cd660b9af25b9dfdb099741b06fb6769433c1 100644 (file)
@@ -195,7 +195,7 @@ int NMDSCommand::execute(){
                if (axesfile != "") {  axes = readAxes(names);          }
                
                string outputFileName = outputDir + m->getRootName(m->getSimpleName(phylipfile)) + "nmds.iters";
-               string stressFileName = outputDir + m->getRootName(m->getSimpleName(phylipfile)) + "stress.nmds";
+               string stressFileName = outputDir + m->getRootName(m->getSimpleName(phylipfile)) + "nmds.stress";
                outputNames.push_back(outputFileName); outputTypes["iters"].push_back(outputFileName);
                outputNames.push_back(stressFileName); outputTypes["stress"].push_back(stressFileName);
                
@@ -208,10 +208,12 @@ int NMDSCommand::execute(){
                out.setf(ios::fixed, ios::floatfield);
                out.setf(ios::showpoint);
                
-               out2 << "Dimension\tIter\tStress\tCorr" << endl;
+               out2 << "Dimension\tIter\tStress\tRsq" << endl;
                
                double bestStress = 10000000;
+               double bestR2 = 10000000;
                vector< vector<double> > bestConfig;
+               int bestDim = 0;
                
                for (int i = mindim; i <= maxdim; i++) {
                        m->mothurOut("Processing Dimension: " + toString(i)); m->mothurOutEndLine();
@@ -235,21 +237,23 @@ int NMDSCommand::execute(){
                                if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) {     remove(outputNames[k].c_str()); } return 0; }
                                
                                //calc correlation between original distances and euclidean distances from this config
-                               double corr = linearCalc.calcPearson(newEuclid, matrix);
-                               corr *= corr;
+                               double rsquared = linearCalc.calcPearson(newEuclid, matrix);
+                               rsquared *= rsquared;
                                if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) {     remove(outputNames[k].c_str()); } return 0; }
                                
                                //output results
                                out << "Config" << (j+1) << '\t';
                                for (int k = 0; k < i; k++) { out << "axis" << (k+1) << '\t'; }
                                out << endl;
-                               out2 << i << '\t' << (j+1) << '\t' << stress << '\t' << corr << endl;
+                               out2 << i << '\t' << (j+1) << '\t' << stress << '\t' << rsquared << endl;
                                
                                output(endConfig, names, out);
                                
                                //save best
                                if (stress < bestStress) {
+                                       bestDim = i;
                                        bestStress = stress;
+                                       bestR2 = rsquared;
                                        bestConfig = endConfig;
                                }
                                
@@ -263,6 +267,10 @@ int NMDSCommand::execute(){
                string BestFileName = outputDir + m->getRootName(m->getSimpleName(phylipfile)) + "nmds.axes";
                outputNames.push_back(BestFileName); outputTypes["nmds"].push_back(BestFileName);
                
+               m->mothurOut("\nNumber of dimensions:\t" + toString(bestDim) + "\n");
+               m->mothurOut("Lowest stress :\t" + toString(bestStress) + "\n");
+               m->mothurOut("R-squared for configuration:\t" + toString(bestR2) + "\n");
+               
                ofstream outBest;
                m->openOutputFile(BestFileName, outBest);
                outBest.setf(ios::fixed, ios::floatfield);
index d8efb2551e2bb6b2f459f14ad041c188f31926da..4be5ffb8c5b63c4202666aecd57ec58c2be05374 100644 (file)
@@ -197,7 +197,7 @@ int PCOACommand::execute(){
                                
                                double corr = linearCalc.calcPearson(EuclidDists, D); //G is the pcoa file, D is the users distance matrix
                                
-                               m->mothurOut("Pearson's coefficient using " + toString(i) + " axis: " + toString(corr)); m->mothurOutEndLine();
+                               m->mothurOut("Rsq " + toString(i) + " axis: " + toString(corr * corr)); m->mothurOutEndLine();
                                
                                if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str());  } return 0; }
                        }