]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed outputName creator, added debugging to readblast
authorSarah Westcott <mothur.westcott@gmail.com>
Fri, 14 Dec 2012 12:21:44 +0000 (07:21 -0500)
committerSarah Westcott <mothur.westcott@gmail.com>
Fri, 14 Dec 2012 12:21:44 +0000 (07:21 -0500)
command.hpp
readblast.cpp
readblast.h

index 2ba35ab14308ded53d6868586d8695799cbb25a0..7ed03f161e18b9ea5bd8374606585ccefb41772e 100644 (file)
@@ -74,8 +74,13 @@ class Command {
                                         m->mothurOut("[ERROR]: Did not provide variable for " + pieces[i] + ".\n"); m->control_pressed = true;
                                     }else {
                                         if (it->second != "") {
-                                            if (it->first != "[filename]") { filename += it->second + "."; }
-                                            else { filename += it->second; }
+                                            if (it->first == "[filename]") { filename += it->second; }
+                                            else if (it->first == "[extension]") { 
+                                                if (filename.length() > 0) { //rip off last "."
+                                                    filename = filename.substr(0, filename.length()-1);
+                                                }
+                                                filename += it->second + "."; 
+                                            }else { filename += it->second + "."; }
                                         }
                                     }
                                 }else {
index 5f2441515378031891c78d2fbb809c816e885cec..e98b69c68bfdb8f90fa841429cf4d607ba6fe1c3 100644 (file)
@@ -110,8 +110,9 @@ 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()){  
                
@@ -193,6 +194,7 @@ int ReadBlast::read(NameAssignment* nameMap) {
                                         PDistCell value(itA->second, distance);
                                         matrix->addCell(it->first, value);
                                     }
+                                    outMDist << itA->first << '\t' << nameMap->get(it->first) << '\t' << distance << endl;
                                                                }else{
                                                                        outDist << itA->first << '\t' << nameMap->get(it->first) << '\t' << distance << endl;
                                                                }
@@ -324,8 +326,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;
@@ -349,6 +351,7 @@ int ReadBlast::readNames(NameAssignment* nameMap) {
                        if (name != prevName) {
                                prevName = name;
                                nameMap->push_back(name);
+                outName << name << '\t' << name << endl;
                                num++;
                        }
                }
index ef5ff9afa182f5fb7f7226c506481a0252964962..97ce6c74cbf768aeec8d2f879fb7c8ad887a1042 100644 (file)
@@ -27,9 +27,9 @@ public:
        
        int read(NameAssignment*);
        SparseDistanceMatrix* getDistMatrix()           {       return matrix;          }
-       vector<seqDist> getOverlapMatrix()      {       return overlap;         }
-       string getOverlapFile()                         {       return overlapFile;     }
-       string getDistFile()                            {       return distFile;        }
+       vector<seqDist> getOverlapMatrix()          {   return overlap;         }
+       string getOverlapFile()                     {   return overlapFile;     }
+       string getDistFile()                        {   return distFile;        }
        
 private:
        string blastfile, overlapFile, distFile;