]> git.donarmstrong.com Git - mothur.git/blobdiff - removelineagecommand.cpp
classify.seqs allows sequences to be in taxonomy file that are not in template. ...
[mothur.git] / removelineagecommand.cpp
index 2b930b5e2450cc15b7871923fb02dbcc1c5824ee..56b24cd99d359c312fbac29f3457fe3f8dba3749 100644 (file)
@@ -814,25 +814,30 @@ vector< map<string, float> > RemoveLineageCommand::getTaxons(string tax) {
                int taxLength = tax.length();
                for(int i=0;i<taxLength;i++){
                        if(tax[i] == ';'){
-                               
-                               int openParen = taxon.find_first_of('(');
+                
+                               int openParen = taxon.find_last_of('(');
                                int closeParen = taxon.find_last_of(')');
                                
                                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));  
+                    string confidenceScore = taxon.substr(openParen+1, (closeParen-(openParen+1)));
+                    if (m->isNumeric1(confidenceScore)) {  //its a confidence
+                        newtaxon = taxon.substr(0, openParen); //rip off confidence
+                        confidence = taxon.substr((openParen+1), (closeParen-openParen-1));  
+                    }else { //its part of the taxon
+                        newtaxon = taxon;
+                        confidence = "0";
+                    }
                                }else{
                                        newtaxon = taxon;
                                        confidence = "0";
-                               }
+                               } 
                                float con = 0;
                                convert(confidence, con);
                                
                                map<string, float> temp;
                                temp[newtaxon] = con;
                                t.push_back(temp);
-                               
                                taxon = "";
                        }
                        else{