From b83fd3896a0575b61dabfb5ea82af11eae83ddce Mon Sep 17 00:00:00 2001 From: westcott Date: Wed, 26 Jan 2011 17:57:33 +0000 Subject: [PATCH] mods in testing 1.16.0 --- Mothur.xcodeproj/project.pbxproj | 4 ++-- clusterfragmentscommand.cpp | 5 +++-- getlineagecommand.cpp | 10 ++++++++-- linearalgebra.cpp | 3 +++ metastats.h | 5 ++++- odum.cpp | 2 +- phylodiversitycommand.cpp | 5 ++++- removelineagecommand.cpp | 15 +++++++++++---- 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 24187d8..2f3cc55 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -1937,8 +1937,8 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "MOTHUR_FILES=\"\\\"../release\\\"\"", - "VERSION=\"\\\"1.15.0\\\"\"", - "RELEASE_DATE=\"\\\"12/10/2010\\\"\"", + "VERSION=\"\\\"1.16.0\\\"\"", + "RELEASE_DATE=\"\\\"1/26/2010\\\"\"", ); GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/clusterfragmentscommand.cpp b/clusterfragmentscommand.cpp index 6eff3a7..24070d2 100644 --- a/clusterfragmentscommand.cpp +++ b/clusterfragmentscommand.cpp @@ -213,7 +213,7 @@ int ClusterFragmentsCommand::execute(){ if (alignSeqs[j].active) { //this sequence has not been merged yet string jBases = alignSeqs[j].seq.getUnaligned(); - + if (isFragment(iBases, jBases)) { //merge alignSeqs[i].names += ',' + alignSeqs[j].names; @@ -291,7 +291,7 @@ bool ClusterFragmentsCommand::isFragment(string seq1, string seq2){ int percentDiff = floor((seq2.length() * (percent / 100.0))); if (percentDiff < totalDiffs) { totalDiffs = percentDiff; } } - + Alignment* alignment = new NeedlemanOverlap(-1.0, 1.0, -1.0, (seq1.length()+totalDiffs+1)); //use needleman to align @@ -314,6 +314,7 @@ bool ClusterFragmentsCommand::isFragment(string seq1, string seq2){ } if (numDiffs <= totalDiffs) { fragment = true; } + } return fragment; diff --git a/getlineagecommand.cpp b/getlineagecommand.cpp index 4231435..8a6f47c 100644 --- a/getlineagecommand.cpp +++ b/getlineagecommand.cpp @@ -677,8 +677,14 @@ vector< map > GetLineageCommand::getTaxons(string tax) { int openParen = taxon.find_first_of('('); int closeParen = taxon.find_last_of(')'); - string newtaxon = taxon.substr(0, openParen); //rip off confidence - string confidence = taxon.substr((openParen+1), (closeParen-openParen-1)); + string newtaxon, confidence; + if ((openParen != string::npos) && (closeParen != string::npos)) { + newtaxon = taxon.substr(0, openParen); //rip off confidence + confidence = taxon.substr((openParen+1), (closeParen-openParen-1)); + }else{ + newtaxon = taxon; + confidence = "0"; + } int con = 0; convert(confidence, con); diff --git a/linearalgebra.cpp b/linearalgebra.cpp index 27d35ac..a2ee221 100644 --- a/linearalgebra.cpp +++ b/linearalgebra.cpp @@ -372,6 +372,9 @@ double LinearAlgebra::calcPearson(vector< vector >& euclidDists, vector< double denom = (sqrt(denomTerm1) * sqrt(denomTerm2)); double r = numerator / denom; + //divide by zero error + if (isnan(r) || isinf(r)) { r = 0.0; } + return r; } diff --git a/metastats.h b/metastats.h index a833474..5bab288 100644 --- a/metastats.h +++ b/metastats.h @@ -39,4 +39,7 @@ int metastat_main (char*, int, int, double, int, double**, int); } #endif -#endif \ No newline at end of file +#endif + + + diff --git a/odum.cpp b/odum.cpp index e9cc5b8..ec432e0 100644 --- a/odum.cpp +++ b/odum.cpp @@ -24,7 +24,7 @@ EstOutput Odum::getValues(vector shared) { int Bij = shared[1]->getAbundance(i); sumNum += abs(Aij - Bij); - sumDenom += Aij + Bij; + sumDenom += (Aij + Bij); } data[0] = sumNum / sumDenom; diff --git a/phylodiversitycommand.cpp b/phylodiversitycommand.cpp index 80d9090..4eb652c 100644 --- a/phylodiversitycommand.cpp +++ b/phylodiversitycommand.cpp @@ -595,4 +595,7 @@ vector PhyloDiversityCommand::calcBranchLength(Tree* t, int leaf, map< st exit(1); } } -//********************************************************************************************************************** \ No newline at end of file +//********************************************************************************************************************** + + + diff --git a/removelineagecommand.cpp b/removelineagecommand.cpp index 9467ff6..0a5c5c7 100644 --- a/removelineagecommand.cpp +++ b/removelineagecommand.cpp @@ -551,6 +551,7 @@ int RemoveLineageCommand::readTax(){ //if the users file contains confidence scores we want to ignore them when searching for the taxons, unless the taxon has them if (!taxonsHasConfidence) { + int hasConfidences = tax.find_first_of('('); if (hasConfidences != string::npos) { newtax = removeConfidences(tax); @@ -568,7 +569,7 @@ int RemoveLineageCommand::readTax(){ }else{//if taxons has them and you don't them remove taxons int hasConfidences = tax.find_first_of('('); if (hasConfidences == string::npos) { - + int pos = newtax.find(noConfidenceTaxons); if (pos == string::npos) { @@ -579,7 +580,7 @@ int RemoveLineageCommand::readTax(){ } }else { //both have confidences so we want to make sure the users confidences are greater then or equal to the taxons //first remove confidences from both and see if the taxonomy exists - + string noNewTax = tax; int hasConfidences = tax.find_first_of('('); if (hasConfidences != string::npos) { @@ -671,8 +672,14 @@ vector< map > RemoveLineageCommand::getTaxons(string tax) { int openParen = taxon.find_first_of('('); int closeParen = taxon.find_last_of(')'); - string newtaxon = taxon.substr(0, openParen); //rip off confidence - string confidence = taxon.substr((openParen+1), (closeParen-openParen-1)); + string newtaxon, confidence; + if ((openParen != string::npos) && (closeParen != string::npos)) { + newtaxon = taxon.substr(0, openParen); //rip off confidence + confidence = taxon.substr((openParen+1), (closeParen-openParen-1)); + }else{ + newtaxon = taxon; + confidence = "0"; + } int con = 0; convert(confidence, con); -- 2.39.2