]> git.donarmstrong.com Git - mothur.git/commitdiff
added warning to readBlast to warn about duplicate names in the blast file.
authorSarah Westcott <mothur.westcott@gmail.com>
Fri, 14 Dec 2012 19:40:10 +0000 (14:40 -0500)
committerSarah Westcott <mothur.westcott@gmail.com>
Fri, 14 Dec 2012 19:40:10 +0000 (14:40 -0500)
distancecommand.cpp
mgclustercommand.cpp
readblast.cpp
sparsedistancematrix.cpp

index 73a38bfe023025be8b5533e20f72d28539a09cde..16fcbf56247bb73bc979f50d4b06ee4ec20e1e7c 100644 (file)
@@ -809,7 +809,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, MPI_File& outMPI, flo
                        }
                        
                        if(i % 100 == 0){
-                               //m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
+                               m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
                                cout << i << '\t' << (time(NULL) - startTime) << endl;
                        }
                        
@@ -826,7 +826,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, MPI_File& outMPI, flo
                        
                }
                
-               //m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
+               m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
                cout << (endLine-1) << '\t' << (time(NULL) - startTime) << endl;        
                delete distCalculator;
                return 1;
@@ -904,7 +904,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, unsigned
 
                
                        if(i % 100 == 0){
-                               //m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
+                               m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
                                cout << i << '\t' << (time(NULL) - startTime) << endl;
                        }
                        
@@ -920,7 +920,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, unsigned
                        delete buf;
                }
                
-               //m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
+               m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
                cout << (endLine-1) << '\t' << (time(NULL) - startTime) << endl;
                MPI_File_close(&outMPI);
                delete distCalculator;
@@ -999,7 +999,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, unsigned
 
                
                        if(i % 100 == 0){
-                               //m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
+                               m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
                                cout << i << '\t' << (time(NULL) - startTime) << endl;
                        }
                        
@@ -1015,7 +1015,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, unsigned
                        delete buf;
                }
                
-               //m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
+               m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
                cout << (endLine-1) << '\t' << (time(NULL) - startTime) << endl;
                MPI_File_close(&outMPI);
                delete distCalculator;
index b9c9d1eb845543bc38893068081b9367b913980b..0a2f91f4d08241547b2e4653a3d09841486dc42c 100644 (file)
@@ -312,10 +312,13 @@ int MGClusterCommand::execute(){
                                outputTypes.clear();
                                return 0; 
                        }
-               
+            
+            
                        //cluster using cluster classes
                        while (distMatrix->getSmallDist() < cutoff && distMatrix->getNNodes() > 0){
                                
+                if (m->debug) {  cout << "numNodes=" << distMatrix->getNNodes() << " smallDist = " << distMatrix->getSmallDist() << endl; }
+                
                                cluster->update(cutoff);
                                
                                if (m->control_pressed) { 
index e98b69c68bfdb8f90fa841429cf4d607ba6fe1c3..84fddcf263cfdeb572f72ff3bd658325f31271e0 100644 (file)
@@ -110,9 +110,8 @@ int ReadBlast::read(NameAssignment* nameMap) {
                                }
                        }
                }else { m->mothurOut("Error in your blast file, cannot read."); m->mothurOutEndLine(); exit(1); }
-string outDistFilem = "../kathryn/blastDist.dist";
-        ofstream outMDist;
-        m->openOutputFile(outDistFilem, outMDist);
+
+       
                //read file
                while(!fileHandle.eof()){  
                
@@ -194,8 +193,7 @@ string outDistFilem = "../kathryn/blastDist.dist";
                                         PDistCell value(itA->second, distance);
                                         matrix->addCell(it->first, value);
                                     }
-                                    outMDist << itA->first << '\t' << nameMap->get(it->first) << '\t' << distance << endl;
-                                                               }else{
+                                }else{
                                                                        outDist << itA->first << '\t' << nameMap->get(it->first) << '\t' << distance << endl;
                                                                }
                                                        }
@@ -326,8 +324,8 @@ int ReadBlast::readNames(NameAssignment* nameMap) {
                ifstream in;
                m->openInputFile(blastfile, in);
                
-               ofstream outName;
-               m->openOutputFile((blastfile + ".tempOutNames"), outName);
+               //ofstream outName;
+               //m->openOutputFile((blastfile + ".tempOutNames"), outName);
                
                //read first line
                in >> prevName;
@@ -350,8 +348,12 @@ int ReadBlast::readNames(NameAssignment* nameMap) {
                        //is this a new name?
                        if (name != prevName) {
                                prevName = name;
-                               nameMap->push_back(name);
-                outName << name << '\t' << name << endl;
+                
+                if (nameMap->get(name) != -1) { m->mothurOut("[ERROR]: trying to exact names from blast file, and I found dups.  Are you sequence names unique? quitting.\n"); m->control_pressed = true; }
+                else {
+                    nameMap->push_back(name);
+                }
+                //outName << name << '\t' << name << endl;
                                num++;
                        }
                }
index b315c487da1e39053307870560ca165d1068c49a..03e9fa8e5b77905d4a4416a6c592d3b3756a02e4 100644 (file)
@@ -39,8 +39,10 @@ int SparseDistanceMatrix::updateCellCompliment(ull row, ull col){
         ull vcol = 0;
         
         //find the columns entry for this cell as well
-        for (int i = 0; i < seqVec[vrow].size(); i++) {  if (seqVec[vrow][i].index == row) { vcol = i;  break; }  }
-
+        for (int i = 0; i < seqVec[vrow].size(); i++) {  
+            if (seqVec[vrow][i].index == row) { vcol = i;  break; }  
+        }
+       
         seqVec[vrow][vcol].dist = seqVec[row][col].dist;
         
         return 0;
@@ -98,7 +100,9 @@ ull SparseDistanceMatrix::getSmallestCell(ull& row){
        
         for (int i = 0; i < seqVec.size(); i++) {
             for (int j = 0; j < seqVec[i].size(); j++) {
+                
+                if (m->control_pressed) { return smallDist; }
+                
                 //already checked everyone else in row
                 if (i < seqVec[i][j].index) {