]> git.donarmstrong.com Git - mothur.git/blobdiff - shhhercommand.cpp
Merge remote-tracking branch 'origin/master'
[mothur.git] / shhhercommand.cpp
index e6b00bac1361284bd803c5ffc92dfcec27e44f8e..803b6cb7955af18d441d6c160e5aafb797c3a057 100644 (file)
@@ -152,11 +152,11 @@ ShhherCommand::ShhherCommand(string option) {
                 string thisoutputDir = m->hasPath(flowFilesFileName); //if user entered a file with a path then preserve it
                 
                                //flow.files = 9 character offset
-                               compositeFASTAFileName = thisoutputDir + flowFilesFileName.substr(0, flowFilesFileName.length()-10) + "shhh.fasta";
+                               compositeFASTAFileName = thisoutputDir + m->getRootName(m->getSimpleName(flowFilesFileName)) + "shhh.fasta";
                                m->openOutputFile(compositeFASTAFileName, temp);
                                temp.close();
                                
-                               compositeNamesFileName = thisoutputDir + flowFilesFileName.substr(0, flowFilesFileName.length()-10) + "shhh.names";
+                               compositeNamesFileName = thisoutputDir + m->getRootName(m->getSimpleName(flowFilesFileName)) + "shhh.names";
                                m->openOutputFile(compositeNamesFileName, temp);
                                temp.close();
                        }
@@ -218,7 +218,7 @@ ShhherCommand::ShhherCommand(string option) {
                 if (flowFileVector.size() == 0) {  m->mothurOut("[ERROR]: no valid files."); m->mothurOutEndLine(); abort = true; }
             }
             else{
-                outputDir += m->hasPath(flowFileName);
+                if (outputDir == "") { outputDir = m->hasPath(flowFileName); }
                 flowFileVector.push_back(flowFileName);
             }
                
@@ -2983,7 +2983,7 @@ void ShhherCommand::writeQualities(int numOTUs, int numFlowCells, string filenam
        
        try {
                string thisOutputDir = outputDir;
-               if (outputDir == "") {  thisOutputDir += m->hasPath(filename);  }
+               if (outputDir == "") {  thisOutputDir = m->hasPath(filename);  }
                string qualityFileName = thisOutputDir + m->getRootName(m->getSimpleName(filename)) + "shhh.qual";
         
                ofstream qualityFile;
@@ -3091,7 +3091,7 @@ void ShhherCommand::writeQualities(int numOTUs, int numFlowCells, string filenam
 void ShhherCommand::writeSequences(string thisCompositeFASTAFileName, int numOTUs, int numFlowCells, string filename, vector<int> otuCounts, vector<short>& uniqueFlowgrams, vector<string>& seqNameVector, vector<vector<int> >& aaI, vector<int>& centroids){
        try {
                string thisOutputDir = outputDir;
-               if (outputDir == "") {  thisOutputDir += m->hasPath(filename);  }
+               if (outputDir == "") {  thisOutputDir = m->hasPath(filename);  }
                string fastaFileName = thisOutputDir + m->getRootName(m->getSimpleName(filename)) + "shhh.fasta";
                ofstream fastaFile;
                m->openOutputFile(fastaFileName, fastaFile);
@@ -3139,7 +3139,7 @@ void ShhherCommand::writeSequences(string thisCompositeFASTAFileName, int numOTU
 void ShhherCommand::writeNames(string thisCompositeNamesFileName, int numOTUs, string filename, vector<int> otuCounts, vector<string>& seqNameVector, vector<vector<int> >& aaI, vector<int>& nSeqsPerOTU){
        try {
                string thisOutputDir = outputDir;
-               if (outputDir == "") {  thisOutputDir += m->hasPath(filename);  }
+               if (outputDir == "") {  thisOutputDir = m->hasPath(filename);  }
                string nameFileName = thisOutputDir + m->getRootName(m->getSimpleName(filename)) + "shhh.names";
                ofstream nameFile;
                m->openOutputFile(nameFileName, nameFile);
@@ -3177,7 +3177,7 @@ void ShhherCommand::writeNames(string thisCompositeNamesFileName, int numOTUs, s
 void ShhherCommand::writeGroups(string filename, int numSeqs, vector<string>& seqNameVector){
        try {
                string thisOutputDir = outputDir;
-               if (outputDir == "") {  thisOutputDir += m->hasPath(filename);  }
+               if (outputDir == "") {  thisOutputDir = m->hasPath(filename);  }
                string fileRoot = thisOutputDir + m->getRootName(m->getSimpleName(filename));
                string groupFileName = fileRoot + "shhh.groups";
                ofstream groupFile;
@@ -3202,7 +3202,7 @@ void ShhherCommand::writeGroups(string filename, int numSeqs, vector<string>& se
 void ShhherCommand::writeClusters(string filename, int numOTUs, int numFlowCells, vector<int> otuCounts, vector<int>& centroids, vector<short>& uniqueFlowgrams, vector<string>& seqNameVector, vector<vector<int> >& aaI, vector<int>& nSeqsPerOTU, vector<int>& lengths, vector<short>& flowDataIntI){
        try {
                string thisOutputDir = outputDir;
-               if (outputDir == "") {  thisOutputDir += m->hasPath(filename);  }
+               if (outputDir == "") {  thisOutputDir = m->hasPath(filename);  }
                string otuCountsFileName = thisOutputDir + m->getRootName(m->getSimpleName(filename)) + "shhh.counts";
                ofstream otuCountsFile;
                m->openOutputFile(otuCountsFileName, otuCountsFile);