]> git.donarmstrong.com Git - mothur.git/blobdiff - phylotree.cpp
added sequence name to error string in fastq.info. Changed np_shannon to npshannon.
[mothur.git] / phylotree.cpp
index 891cca424719d7013a8e2984c1a0032612c464db..dba1e3b56951f8ae1c484ace22187a9b65053d35 100644 (file)
@@ -20,6 +20,7 @@ PhyloTree::PhyloTree(){
                tree[0].heirarchyID = "0";
                maxLevel = 0;
                calcTotals = true;
+               addSeqToTree("unknown", "unknown;");
        }
        catch(exception& e) {
                m->errorOut(e, "PhyloTree", "PhyloTree");
@@ -127,11 +128,12 @@ PhyloTree::PhyloTree(string tfile){
                maxLevel = 0;
                calcTotals = true;
                string name, tax;
+               addSeqToTree("unknown", "unknown;");
 
                
                #ifdef USE_MPI
                        int pid, num, processors;
-                       vector<unsigned long int> positions;
+                       vector<unsigned long long> positions;
                        
                        MPI_Status status; 
                        MPI_File inMPI;
@@ -232,7 +234,6 @@ string PhyloTree::getNextTaxon(string& heirarchy, string seqname){
 
 int PhyloTree::addSeqToTree(string seqName, string seqTaxonomy){
        try {
-                       
                numSeqs++;
                
                map<string, int>::iterator childPointer;
@@ -241,6 +242,8 @@ int PhyloTree::addSeqToTree(string seqName, string seqTaxonomy){
                int level = 1;
                
                tree[0].accessions.push_back(seqName);
+               m->removeConfidences(seqTaxonomy);
+               
                string taxon;// = getNextTaxon(seqTaxonomy);
        
                while(seqTaxonomy != ""){
@@ -373,7 +376,7 @@ void PhyloTree::binUnclassified(string file){
                map<string, int>::iterator childPointer;
                
                vector<TaxNode> copy = tree;
-                       
+               
                //fill out tree
                fillOutTree(0, copy);
        
@@ -482,16 +485,16 @@ string PhyloTree::getFullTaxonomy(string seqName) {
 
 void PhyloTree::print(ofstream& out, vector<TaxNode>& copy){
        try {
-       
+               
                //output mothur version
                out << "#" << m->getVersion() << endl;
                
                out << copy.size() << endl;
                
                out << maxLevel << endl;
-               
+                               
                for (int i = 0; i < copy.size(); i++) {
-       
+                               
                        out << copy[i].level << '\t'<< copy[i].name << '\t' << copy[i].children.size() << '\t';
                        
                        map<string,int>::iterator it;
@@ -604,6 +607,7 @@ bool PhyloTree::ErrorCheck(vector<string> templateFileNames){
        try {
        
                bool okay = true;
+               templateFileNames.push_back("unknown");
                
                map<string, int>::iterator itFind;
                map<string, int> taxonomyFileNames = name2Taxonomy;
@@ -618,9 +622,10 @@ bool PhyloTree::ErrorCheck(vector<string> templateFileNames){
                                okay = false;
                        }
                        
-                       templateFileNames.erase(templateFileNames.begin()+i);
-                       i--;
+                       //templateFileNames.erase(templateFileNames.begin()+i);
+                       //i--;
                }
+               templateFileNames.clear();
                
                if (taxonomyFileNames.size() > 0) { //there are names in tax file that are not in template
                        okay = false;