]> git.donarmstrong.com Git - mothur.git/blobdiff - chimerauchimecommand.h
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / chimerauchimecommand.h
index 359b68c9c97f144f0914f4ff309c973ca2ec5d60..b401ae85ae3c22e6d587fd27e649d27db9c6d939 100644 (file)
@@ -48,6 +48,7 @@ private:
        string fastafile, groupfile, templatefile, outputDir, namefile, abskew, minh, mindiv, xn, dn, xa, chunks, minchunk, idsmoothwindow, minsmoothid, maxp, minlen, maxlen, queryfract;
        int processors;
        
+       
        vector<string> outputNames;
        vector<string> fastaFileNames;
        vector<string> nameFileNames;
@@ -148,6 +149,10 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){
        
        try {
                
+               pDataArray->outputFName = pDataArray->m->getFullPathName(pDataArray->outputFName);
+               pDataArray->filename = pDataArray->m->getFullPathName(pDataArray->filename);
+               pDataArray->alns = pDataArray->m->getFullPathName(pDataArray->alns);
+               
                //clears files
                ofstream out, out1, out2;
                pDataArray->m->openOutputFile(pDataArray->outputFName, out); out.close(); 
@@ -178,10 +183,23 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){
                        
                        vector<char*> cPara;
                        
+                       string path = pDataArray->m->argv;
+                       string tempPath = path;
+                       for (int j = 0; j < path.length(); j++) { tempPath[j] = tolower(path[j]); }
+                       path = path.substr(0, (tempPath.find_last_of('m')));
+                       
+                       string uchimeCommand = path;
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       uchimeCommand += "uchime ";
+#else
+                       uchimeCommand += "uchime";
+                       uchimeCommand = "\"" + uchimeCommand + "\"";
+#endif                 
+                       
                        char* tempUchime;
-                       tempUchime= new char[8]; 
+                       tempUchime= new char[uchimeCommand.length()+1]; 
                        *tempUchime = '\0';
-                       strncat(tempUchime, "uchime ", 7); 
+                       strncat(tempUchime, uchimeCommand.c_str(), uchimeCommand.length());
                        cPara.push_back(tempUchime);
                        
                        char* tempIn = new char[8]; 
@@ -312,17 +330,6 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){
                                cPara.push_back(tempIdsmoothwindow);
                        }
                        
-                       /*if (useMinsmoothid) {
-                        char* tempminsmoothid = new char[14]; 
-                        //strcpy(tempminsmoothid, "--minsmoothid"); 
-                        *tempminsmoothid = '\0'; strncat(tempminsmoothid, "--minsmoothid", 13);
-                        cPara.push_back(tempminsmoothid);
-                        char* tempMinsmoothid = new char[minsmoothid.length()+1];
-                        *tempMinsmoothid = '\0'; strncat(tempMinsmoothid, minsmoothid.c_str(), minsmoothid.length());
-                        //strcpy(tempMinsmoothid, minsmoothid.c_str());
-                        cPara.push_back(tempMinsmoothid);
-                        }*/
-                       
                        if (pDataArray->useMaxp) {
                                char* tempmaxp = new char[7]; 
                                //strcpy(tempmaxp, "--maxp"); 
@@ -396,6 +403,10 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){
                        
                        //uchime_main(numArgs, uchimeParameters); 
                        //cout << "commandString = " << commandString << endl;
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#else
+                       commandString = "\"" + commandString + "\"";
+#endif
                        system(commandString.c_str());
                        
                        //free memory
@@ -476,6 +487,10 @@ static DWORD WINAPI MyUchimeSeqsThreadFunction(LPVOID lpParam){
        
        try {
                
+               pDataArray->outputFName = pDataArray->m->getFullPathName(pDataArray->outputFName);
+               pDataArray->filename = pDataArray->m->getFullPathName(pDataArray->filename);
+               pDataArray->alns = pDataArray->m->getFullPathName(pDataArray->alns);
+               
                int totalSeqs = 0;
                int numChimeras = 0;