]> git.donarmstrong.com Git - mothur.git/blobdiff - getlineagecommand.cpp
classify.seqs allows sequences to be in taxonomy file that are not in template. ...
[mothur.git] / getlineagecommand.cpp
index 645655d03f72bbebac45cfa108c499cc1daf8e3b..99359bd882e1e2b668cd6bef2b2ec7cfc32fc0bf 100644 (file)
@@ -814,20 +814,27 @@ int GetLineageCommand::readTax(){
 /**************************************************************************************************/
 vector< map<string, float> > GetLineageCommand::getTaxons(string tax) {
        try {
-               
+        
                vector< map<string, float> > t;
                string taxon = "";
                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";
@@ -837,12 +844,13 @@ vector< map<string, float> > GetLineageCommand::getTaxons(string tax) {
                                
                                map<string, float> temp;
                                temp[newtaxon] = con;
+                
                                t.push_back(temp);
-                               
                                taxon = "";
                        }
                        else{
                                taxon += tax[i];
+                
                        }
                }