]> git.donarmstrong.com Git - mothur.git/commitdiff
pat's ../ bug fix
authorpschloss <pschloss>
Thu, 4 Feb 2010 15:14:07 +0000 (15:14 +0000)
committerpschloss <pschloss>
Thu, 4 Feb 2010 15:14:07 +0000 (15:14 +0000)
aligncommand.cpp
chimeraseqscommand.cpp
chimeraslayer.cpp
mothur.h
preclustercommand.cpp
validparameter.cpp

index 784155745fa9c0141d6b2db0ba80133b39e3a85f..7782d1eac5354261c6727e240a33ae2d89984224 100644 (file)
@@ -52,16 +52,20 @@ AlignCommand::AlignCommand(string option){
                        for (it = parameters.begin(); it != parameters.end(); it++) { 
                                if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
                        }
-                       
+
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  outputDir = "";         }
                        
+
                        //if the user changes the input directory command factory will send this info to us in the output parameter 
                        string inputDir = validParameter.validFile(parameters, "inputdir", false);              
+                       
                        if (inputDir == "not found"){   inputDir = "";          }
                        else {
                                string path;
+
                                it = parameters.find("template");
+
                                //user has given a template file
                                if(it != parameters.end()){ 
                                        path = hasPath(it->second);
@@ -69,9 +73,10 @@ AlignCommand::AlignCommand(string option){
                                        if (path == "") {       parameters["template"] = inputDir + it->second;         }
                                }
                        }
-                       
+
                        //check for required parameters
                        templateFileName = validParameter.validFile(parameters, "template", true);
+                       
                        if (templateFileName == "not found") { 
                                mothurOut("template is a required parameter for the align.seqs command."); 
                                mothurOutEndLine();
@@ -106,7 +111,6 @@ AlignCommand::AlignCommand(string option){
                                //make sure there is at least one valid file left
                                if (candidateFileNames.size() == 0) { mothurOut("no valid files."); mothurOutEndLine(); abort = true; }
                        }
-                               
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
index 49414883224bb940b761ee4d1a47ae481982973d..b06d3693259c7f2361e428cb965dbd99301ad7d8 100644 (file)
@@ -228,8 +228,8 @@ void ChimeraSeqsCommand::help(){
                mothurOut("\t\tparameters: fasta=required, template=required, filter=F, mask=no mask, processors=1, window=10% of length, numwanted=20\n"); 
                mothurOut("\tchimeracheck: \n"); 
                mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, ksize=7, svg=F, name=none\n\n"); 
-               //mothurOut("\tchimeraslayer: \n"); 
-               //mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, mask=no mask, numwanted=10, match=5, mismatch=-4, divergence=1.0, minsim=90, parents=5, iters=1000, window=100. \n\n"); 
+               mothurOut("\tchimeraslayer: \n"); 
+               mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, mask=no mask, numwanted=10, match=5, mismatch=-4, divergence=1.0, minsim=90, parents=5, iters=1000, window=100. \n\n"); 
                mothurOut("The chimera.seqs command should be in the following format: \n");
                mothurOut("chimera.seqs(fasta=yourFastaFile, filter=yourFilter, correction=yourCorrection, processors=yourProcessors, method=bellerophon) \n");
                mothurOut("Example: chimera.seqs(fasta=AD.align, filter=True, correction=true, method=bellerophon, window=200) \n");
index ab4bd1fa18806f6650a3d75ed7efe95c4284d7e1..5d3d6706ede49b38c5385d29c1d127b1488c4000 100644 (file)
@@ -33,7 +33,7 @@ void ChimeraSlayer::print(ostream& out) {
                for (int i = 0; i < querySeqs.size(); i++) {
                
                        if (chimeraFlags[i] == "yes") { 
-                               cout << i << endl;
+//                             cout << i << endl;
                                if ((chimeraResults[i][0].bsa >= 90.0) || (chimeraResults[i][0].bsb >= 90.0)) {
                                        mothurOut(querySeqs[i]->getName() + "\tyes"); mothurOutEndLine();
                                        out << querySeqs[i]->getName() << "\tyes" << endl;
index a63d7ae055f8281bbfd0fda4ef03c3647419beea..8190152b8be3c15ee0a3559b93d846174d6c992d 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -487,7 +487,7 @@ inline bool isBlank(string fileName){
 /***********************************************************************/
 
 inline string getFullPathName(string fileName){
-       
+       try{
        string path = hasPath(fileName);
        string newFileName;
        int pos;
@@ -504,10 +504,12 @@ inline string getFullPathName(string fileName){
                        else { newFileName = fileName.substr(fileName.rfind("./")+2); } //save the complete part of the name
                        
                        char* cwdpath = new char[1024];
+
                        size_t size;
                        cwdpath=getcwd(cwdpath,size);
-                       cwd = cwdpath;
                
+                       cwd = cwdpath;
+                       
                        //rip off first '/'
                        string simpleCWD;
                        if (cwd.length() > 0) { simpleCWD = cwd.substr(1); }
@@ -521,9 +523,10 @@ inline string getFullPathName(string fileName){
                        }
                        //get last one              // ex. ../../../filename = /user/work/desktop/filename
                        dirs.push_back(simpleCWD);  //ex. dirs[0] = user, dirs[1] = work, dirs[2] = desktop
-                               
+                       
+               
                        int index = dirs.size()-1;
-                               
+               
                        while((pos = path.rfind("./")) != -1) { //while you don't have a complete path
                                if (path[(pos-1)] == '.') { //you want your parent directory ../
                                        path = path.substr(0, pos-1);
@@ -583,6 +586,12 @@ inline string getFullPathName(string fileName){
                        
                #endif
        }
+       }
+       catch(exception& e) {
+               errorOut(e, "getFullPathName", "getFullPathName");
+               exit(1);
+       }
+       
        
 }
 /***********************************************************************/
@@ -606,7 +615,7 @@ inline int openInputFile(string fileName, ifstream& fileHandle, string m){
 inline int openInputFile(string fileName, ifstream& fileHandle){
        //get full path name
        string completeFileName = getFullPathName(fileName);
-       
+
        fileHandle.open(completeFileName.c_str());
        if(!fileHandle) {
                mothurOut("Error: Could not open " + completeFileName);  mothurOutEndLine();
index d97ffc7934484c3b7ba29a3674418c672b77133a..fa5329b1e4094b4c87d60b5b4dfbd211f1bc1aeb 100644 (file)
@@ -179,43 +179,11 @@ int PreClusterCommand::execute(){
                exit(1);
        }
 }
-/**************************************************************************************************
-int PreClusterCommand::readFASTA(){
-       try {
-//             ifstream inFasta;
-//             openInputFile(fastafile, inFasta);
-//             length = 0;
-////           map<string, string>::iterator it;
-//
-//             while (!inFasta.eof()) {
-//                     Sequence temp(inFasta);  //read seq
-//                     
-//                     if (temp.getName() != "") {  
-//                             if (namefile != "") {
-//                                     //make sure fasta and name files match
-//                                     it = names.find(temp.getName());
-//                                     if (it == names.end()) { mothurOut(temp.getName() + " is not in your names file, please correct."); mothurOutEndLine(); exit(1); }
-//                             }else { sizes[temp.getName()] = 1; }
-//                             
-//                             seqPNode tempNode(sizes[temp.getName()], temp);
-//                             alignSeqs.push_back(tempNode); 
-//                             active[temp.getName()] = true;
-//                     }
-//                     gobble(inFasta);
-//             }
-//             inFasta.close();
-//             
-//             if (alignSeqs.size() != 0) {  length = alignSeqs[0].seq.getAligned().length();  }
-//             
-               return alignSeqs.size();
-       }
-       catch(exception& e) {
-               errorOut(e, "PreClusterCommand", "readFASTA");
-               exit(1);
-       }
-}
+
 /**************************************************************************************************/
-//this seems to require the names and fasta file to be in the same order???
+
+//this requires the names and fasta file to be in the same order
+
 int PreClusterCommand::readFASTA(){
        try {
                //ifstream inNames;
@@ -316,7 +284,9 @@ void PreClusterCommand::printData(string newfasta, string newname){
                exit(1);
        }
 }
+
 /**************************************************************************************************/
+
 void PreClusterCommand::readNameFile(){
        try {
                ifstream in;
index ad8038ee40e60c74ee9cc02ab831195726c7bf27..a978f0fae0f4e357978898bb218adae100e51111 100644 (file)
@@ -204,8 +204,11 @@ string ValidParameters::validFile(map<string, string> container, string paramete
                
                it = container.find(parameter);
                if(it != container.end()){ //no parameter given
+
                        if(isFile == true) {
+
                                ableToOpen = openInputFile(it->second, in);
+
                                if (ableToOpen == 1) { return "not open"; }
                                in.close();
                        }