]> git.donarmstrong.com Git - mothur.git/blobdiff - pintail.cpp
working on testing
[mothur.git] / pintail.cpp
index 5bfdc44128dd300cc22a33e8fa696d032dcab774..2362eb5ac80416f6aa86d8b7d011e275d7d3a88d 100644 (file)
@@ -92,7 +92,7 @@ int Pintail::doPrep() {
                m->mothurOut("Getting conservation... "); cout.flush();
                if (consfile == "") { 
                        m->mothurOut("Calculating probability of conservation for your template sequences.  This can take a while...  I will output the frequency of the highest base in each position to a .freq file so that you can input them using the conservation parameter next time you run this command.  Providing the .freq file will improve speed.    "); cout.flush();
-                       probabilityProfile = decalc->calcFreq(templateSeqs, outputDir + getSimpleName(templateFileName)); 
+                       probabilityProfile = decalc->calcFreq(templateSeqs, templateFileName); 
                        if (m->control_pressed) {  return 0;  }
                        m->mothurOut("Done."); m->mothurOutEndLine();
                }else                           {   probabilityProfile = readFreq();    m->mothurOut("Done.");            }
@@ -170,20 +170,20 @@ int Pintail::doPrep() {
                        string noOutliers, outliers;
                        
                        if ((!filter) && (seqMask == "")) {
-                               noOutliers = outputDir + getRootName(getSimpleName(templateFileName)) + "pintail.quan";
+                               noOutliers = templateFileName + "pintail.quan";
                        }else if ((!filter) && (seqMask != "")) { 
-                               noOutliers = outputDir + getRootName(getSimpleName(templateFileName)) + "pintail.masked.quan";
+                               noOutliers =templateFileName + "pintail.masked.quan";
                        }else if ((filter) && (seqMask != "")) { 
-                               noOutliers = outputDir + getRootName(getSimpleName(templateFileName)) + "pintail.filtered." + getSimpleName(getRootName(fastafile)) + "masked.quan";
+                               noOutliers = templateFileName + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "masked.quan";
                        }else if ((filter) && (seqMask == "")) { 
-                               noOutliers = outputDir + getRootName(getSimpleName(templateFileName)) + "pintail.filtered." + getSimpleName(getRootName(fastafile)) + "quan";
+                               noOutliers = templateFileName + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "quan";
                        }
 
                        decalc->removeObviousOutliers(quantilesMembers, templateSeqs.size());
                        
                        if (m->control_pressed) {  return 0;  }
                
-                       string outputString = "";
+                       string outputString = "#" + m->getVersion() + "\n";
                        
                        //adjust quantiles
                        for (int i = 0; i < quantilesMembers.size(); i++) {
@@ -449,6 +449,9 @@ vector<float> Pintail::readFreq() {
                if (tempBuf.length() > size) { tempBuf = tempBuf.substr(0, size);  }
                istringstream iss (tempBuf,istringstream::in);
                
+               //read version
+               string line = m->getline(iss); m->gobble(iss);
+               
                while(!iss.eof()) {
                        iss >> pos >> num;
        
@@ -463,7 +466,7 @@ vector<float> Pintail::readFreq() {
                                prob.push_back(Pi);  
                        }
                        
-                       gobble(iss);
+                       m->gobble(iss);
                }
        
                MPI_File_close(&inMPI);
@@ -471,7 +474,10 @@ vector<float> Pintail::readFreq() {
        #else   
 
                ifstream in;
-               openInputFile(consfile, in);
+               m->openInputFile(consfile, in);
+               
+               //read version
+               string line = m->getline(in); m->gobble(in);
                                
                while(!in.eof()){
                        
@@ -488,7 +494,7 @@ vector<float> Pintail::readFreq() {
                                prob.push_back(Pi);  
                        }
                        
-                       gobble(in);
+                       m->gobble(in);
                }
                in.close();
                
@@ -540,7 +546,7 @@ void Pintail::createProcessesQuan() {
                                //write out data to file so parent can read it
                                ofstream out;
                                string s = toString(getpid()) + ".temp";
-                               openOutputFile(s, out);
+                               m->openOutputFile(s, out);
                                
                                                                
                                //output observed distances
@@ -568,7 +574,7 @@ void Pintail::createProcessesQuan() {
                for (int i=0;i<processors;i++) { 
                        ifstream in;
                        string s = toString(processIDS[i]) + ".temp";
-                       openInputFile(s, in);
+                       m->openInputFile(s, in);
                        
                        vector< vector<float> > quan; 
                        quan.resize(100);
@@ -578,7 +584,7 @@ void Pintail::createProcessesQuan() {
                                int num;
                                in >> num; 
                                
-                               gobble(in);
+                               m->gobble(in);
 
                                vector<float> q;  float w; 
                                for (int j = 0; j < num; j++) {
@@ -587,7 +593,7 @@ void Pintail::createProcessesQuan() {
                                }
 
                                quan[h] = q;
-                               gobble(in);
+                               m->gobble(in);
                        }
                        
        
@@ -648,6 +654,9 @@ vector< vector<float> > Pintail::readQuantiles() {
                istringstream iss (tempBuf,istringstream::in);
                delete buffer;
                
+               //read version
+               string line = m->getline(iss); m->gobble(iss);
+               
                while(!iss.eof()) {
                        iss >> num >> ten >> twentyfive >> fifty >> seventyfive >> ninetyfive >> ninetynine; 
                        
@@ -662,7 +671,7 @@ vector< vector<float> > Pintail::readQuantiles() {
                        
                        quan.push_back(temp);  
                        
-                       gobble(iss);
+                       m->gobble(iss);
                }
        
                MPI_File_close(&inMPI);
@@ -670,7 +679,10 @@ vector< vector<float> > Pintail::readQuantiles() {
        #else   
 
                ifstream in;
-               openInputFile(quanfile, in);
+               m->openInputFile(quanfile, in);
+               
+               //read version
+               string line = m->getline(in); m->gobble(in);
                        
                while(!in.eof()){
                        
@@ -687,7 +699,7 @@ vector< vector<float> > Pintail::readQuantiles() {
                        
                        quan.push_back(temp);  
        
-                       gobble(in);
+                       m->gobble(in);
                }
                in.close();
        #endif
@@ -737,7 +749,7 @@ void Pintail::printQuanFile(string file, string outputString) {
                        //delete FileName;
                #else
                        ofstream outQuan;
-                       openOutputFile(file, outQuan);
+                       m->openOutputFile(file, outQuan);
                        
                        outQuan << outputString;