]> git.donarmstrong.com Git - mothur.git/commitdiff
pat's edits prior to v.1.5
authorpschloss <pschloss>
Thu, 30 Jul 2009 11:25:41 +0000 (11:25 +0000)
committerpschloss <pschloss>
Thu, 30 Jul 2009 11:25:41 +0000 (11:25 +0000)
Mothur.xcodeproj/project.pbxproj
aligncommand.cpp
libshuffcommand.cpp
mothur.h
nast.cpp
sharedchao1.cpp
simpson.cpp
trimseqscommand.cpp

index ab3240e576a52aca46fb60ee32e7723d1b0fdc36..75294bcfe5bbcf506e9b83c3123ac266bed4fa19 100644 (file)
                375AA1360F9E433D008EF9B8 /* readotu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readotu.h; sourceTree = SOURCE_ROOT; };
                375AA1370F9E433D008EF9B8 /* readphylip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readphylip.cpp; sourceTree = SOURCE_ROOT; };
                375AA1380F9E433D008EF9B8 /* readphylip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readphylip.h; sourceTree = SOURCE_ROOT; };
-               377326630FAF16E0007ABB8B /* consensuscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = consensuscommand.cpp; sourceTree = "<group>"; };
-               377326640FAF16E0007ABB8B /* consensuscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = consensuscommand.h; sourceTree = "<group>"; };
+               377326630FAF16E0007ABB8B /* consensuscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = consensuscommand.cpp; sourceTree = SOURCE_ROOT; };
+               377326640FAF16E0007ABB8B /* consensuscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = consensuscommand.h; sourceTree = SOURCE_ROOT; };
                378598640FDD497000EF9D03 /* heatmapsimcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = heatmapsimcommand.h; sourceTree = SOURCE_ROOT; };
                378598650FDD497000EF9D03 /* heatmapsimcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = heatmapsimcommand.cpp; sourceTree = SOURCE_ROOT; };
                378598720FDD4C1500EF9D03 /* heatmapsim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = heatmapsim.h; sourceTree = SOURCE_ROOT; };
index d672fc3df2a405a1057781dacd84c4a9f2b50d6f..958f29b39213c3fda29e810af8832fef4afa83e1 100644 (file)
@@ -171,6 +171,8 @@ int AlignCommand::execute(){
                        mothurOutEndLine();
                        alignment = new NeedlemanOverlap(gapOpen, match, misMatch, longestBase);
                }
+               mothurOut("Aligning sequences...");
+               mothurOutEndLine();
                
                string alignFileName = candidateFileName.substr(0,candidateFileName.find_last_of(".")+1) + "align";
                string reportFileName = candidateFileName.substr(0,candidateFileName.find_last_of(".")+1) + "align.report";
@@ -283,7 +285,7 @@ int AlignCommand::driver(linePair* line, string alignFName, string reportFName){
                        report.setAlignmentParameters(align, alignment);
 
                        report.setNastParameters(nast);
-                       
+
                        alignmentFile << '>' << candidateSeq->getName() << '\n' << candidateSeq->getAligned() << endl;
                        
                        report.print();
index 73c0a74f050a99a42f41dcce4ad18594e8621cc4..e78c00d4d1117d7832de2f3d7e7ff8a6accd9e47 100644 (file)
@@ -208,7 +208,7 @@ void LibShuffCommand::printCoverageFile() {
                vector<int> prevRow = it->second;
                it++;
                
-               for(it;it!=allDistances.end();it++){
+               for(;it!=allDistances.end();it++){
                        for(int i=0;i<it->second.size();i++){
                                it->second[i] += prevRow[i];
                        }
index 29124330420f1af5e8a7b5f54fb8f86689e20ee9..b27c5ada91ff59289856373122b3c4219ee1b965 100644 (file)
--- a/mothur.h
+++ b/mothur.h
 #include <cerrno>
 #include <ctime>
 #include <limits>
+#include <sys/wait.h>
+#include <unistd.h>
 
 using namespace std;
 
-#ifdef _WIN32
-       #define exp(x) (exp((double) x))
-       #define sqrt(x) (sqrt((double) x))
-       #define log10(x) (log10((double) x))
-       #define log2(x) (log10(x)/log10(2))
-       #define isnan(x) ((x) != (x))
-       #define isinf(x) (fabs(x) == std::numeric_limits<double>::infinity())
-#else
-       #include <sys/wait.h>
-       #include <unistd.h>
-#endif
+#define exp(x) (exp((double) x))
+#define sqrt(x) (sqrt((double) x))
+#define log10(x) (log10((double) x))
+#define log2(x) (log10(x)/log10(2))
+#define isnan(x) ((x) != (x))
+#define isinf(x) (fabs(x) == std::numeric_limits<double>::infinity())
 
 
 typedef unsigned long ull;
@@ -96,6 +93,7 @@ inline void convert(const string& s, T& x, bool failIfLeftoverChars = true){
        if (!(i >> x) || (failIfLeftoverChars && i.get(c)))
                throw BadConversion(s);
 }
+
 //**********************************************************************************************************************
 
 template<typename T>
index 4aed5903aec4985f92d5668d39301cabe3d779e6..804e3c174d4408c2ae55963ba391098002978c18 100644 (file)
--- a/nast.cpp
+++ b/nast.cpp
@@ -53,7 +53,6 @@ void Nast::pairwiseAlignSeqs(){       //      Here we call one of the pairwise alignment me
 
                }
                else{
-
                        if(tempAln[0] == '-'){
                                int pairwiseAlignmentLength = tempAln.length(); //      we need to make sure that the candidate sequence alignment
                                for(int i=0;i<pairwiseAlignmentLength;i++){             //      starts where the template sequence alignment starts, if it
@@ -64,7 +63,6 @@ void Nast::pairwiseAlignSeqs(){       //      Here we call one of the pairwise alignment me
                                        }
                                }
                        }
-                       
                        int pairwiseAlignmentLength = tempAln.length();
                        if(tempAln[pairwiseAlignmentLength-1] == '-'){          //      we need to make sure that the candidate sequence alignment
                                for(int i=pairwiseAlignmentLength-1; i>=0; i--){//      ends where the template sequence alignment ends, if it runs
@@ -113,8 +111,7 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl
                                                break;
                                        }
                                }
-                               
-                               
+
                                for(rightIndex=i+1;rightIndex<longAlignmentLength-1;rightIndex++){
                                        if(!isalpha(candAln[rightIndex])){
                                                rightRoom = 1;  //count how far it is to the nearest gap on the RIGHT side of the anomaly
@@ -207,7 +204,6 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl
                errorOut(e, "Nast", "removeExtraGaps");
                exit(1);
        }       
-       
 }
 
 /**************************************************************************************************/
@@ -239,7 +235,7 @@ void Nast::regapSequences(){        //This is essentially part B in Fig 2. of DeSantis
                        newTemplateAlign += tempAln[fullAlignIndex];//  pairwise sequences
                        fullAlignIndex++;
                }
-               
+
                string lastLoop = "";
                
                while(pairwiseAlignIndex<pairwiseLength){
index 803e95368240b15e8bee33ff4b22842fa168519d..cbb519241bd98e85823ef1fc25f33701dbeb84e9 100644 (file)
@@ -50,7 +50,7 @@ EstOutput SharedChao1::getValues(vector<SharedRAbundVector*> shared){
                //calculate chao1, (numleaves-1) because numleaves contains the ++ values.
                bool bias;
                for(int i=0;i<numLeaves;i++){
-                       if ((f2leaves[i]->lvalue == 0) || (f2leaves[i]->rvalue == 0))  { bias = true;  }// break;}
+                       if (f2leaves[i]->lvalue == 0 || f2leaves[i]->rvalue == 0) { bias = true;}// break;}
                }
 
                if(bias){
index d260800a9f80368295c2c1a099dd0a3dd3af8a30..8e176cf926f07e899d3a965500a991bfde45f3a1 100644 (file)
@@ -19,8 +19,8 @@ EstOutput Simpson::getValues(SAbundVector* rank){
                double ci = 0;
        
                double maxRank = (double)rank->getMaxRank();
-               int sampled = rank->getNumSeqs();
-               int sobs = rank->getNumBins();
+               double sampled = (double)rank->getNumSeqs();
+               double sobs = (double)rank->getNumBins();
        
                double firstTerm = 0;
                double secondTerm = 0;
@@ -31,8 +31,8 @@ EstOutput Simpson::getValues(SAbundVector* rank){
                        for(int i=1;i<=maxRank;i++){
                                simnum += (double)(rank->get(i)*i*(i-1));
                        }
-               
-                       simpson = simnum / (double)(sampled*(sampled-1));
+                       
+                       simpson = simnum / (sampled*(sampled-1));
                
                        for(int i=1;i<=maxRank;i++){
                                double piI = (double) i / (double)sampled;
@@ -40,7 +40,7 @@ EstOutput Simpson::getValues(SAbundVector* rank){
                                secondTerm += rank->get(i) * pow(piI, 2);
                        }
                
-                       double var = (4.0 / (double)sampled) * (firstTerm - secondTerm*secondTerm);
+                       double var = (4.0 / sampled) * (firstTerm - secondTerm*secondTerm);
                        ci = 1.95 * pow(var, 0.5);
                }
        
index 937b130deb2c4b2dd6d3e72d191c090b34ee51e5..2a982c7135e5b6fc83ed49dbe89cf3804dbc540b 100644 (file)
@@ -171,7 +171,6 @@ int TrimSeqsCommand::execute(){
                                if(qThreshold != 0)             {       success = stripQualThreshold(currSeq, qFile);   }
                                else if(qAverage != 0)  {       success = cullQualAverage(currSeq, qFile);              }
                                if(!success)                    {       trashCode += 'q';                                                               }
-                               qFile.close();
                        }
                        if(barcodes.size() != 0){
                                success = stripBarcode(currSeq, group);
@@ -221,6 +220,7 @@ int TrimSeqsCommand::execute(){
                outFASTA.close();
                scrapFASTA.close();
                outGroups.close();
+               if(qFileName != "")     {       qFile.close();  }
                
                for(int i=0;i<fastaFileNames.size();i++){
                        fastaFileNames[i]->close();
@@ -548,7 +548,8 @@ bool TrimSeqsCommand::cullQualAverage(Sequence& seq, ifstream& qFile){
                string name;
                
                qFile >> name;
-               if (name.length() != 0) {  if(name.substr(1) != seq.getName())  {       mothurOut("sequence name mismatch btwn fasta and qual file"); mothurOutEndLine();       } }
+               if (name[0] == '>') {  if(name.substr(1) != seq.getName())      {       mothurOut("sequence name mismatch btwn fasta: " + seq.getName() + " and qual file: " + name); mothurOutEndLine();       } }
+               
                while (!qFile.eof())    {       char c = qFile.get(); if (c == 10 || c == 13){  break;  }       }
                
                float score;    
@@ -559,7 +560,7 @@ bool TrimSeqsCommand::cullQualAverage(Sequence& seq, ifstream& qFile){
                        average += score;
                }
                average /= seqLength;
-               
+
                if(average >= qAverage) {       success = 1;    }
                else                                    {       success = 0;    }
                
@@ -572,5 +573,3 @@ bool TrimSeqsCommand::cullQualAverage(Sequence& seq, ifstream& qFile){
 }
 
 //***************************************************************************************************************
-
-