X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=splitmatrix.cpp;h=6e40e97a10b0fd2af75b09c97ae43a26095016b8;hb=814675616c10a40911886afb9dfe216f0245e3a2;hp=9e53c51a8f1b6fbba8e755279e68993fb7f03fa5;hpb=a0f87c2ae6414af28d4e70b1e6830401eac21bef;p=mothur.git diff --git a/splitmatrix.cpp b/splitmatrix.cpp index 9e53c51..6e40e97 100644 --- a/splitmatrix.cpp +++ b/splitmatrix.cpp @@ -24,7 +24,7 @@ SplitMatrix::SplitMatrix(string distfile, string name, string tax, float c, stri } /***********************************************************************/ -SplitMatrix::SplitMatrix(string ffile, string name, string tax, float c, string t, int p){ +SplitMatrix::SplitMatrix(string ffile, string name, string tax, float c, string t, int p, string output){ m = MothurOut::getInstance(); fastafile = ffile; namefile = name; @@ -32,6 +32,7 @@ SplitMatrix::SplitMatrix(string ffile, string name, string tax, float c, string cutoff = c; method = t; processors = p; + outputDir = output; } /***********************************************************************/ @@ -163,7 +164,7 @@ int SplitMatrix::createDistanceFilesFromTax(map& seqGroup, int numG query.printSequence(outFile); outFile.close(); - copyGroups.erase(it); + copyGroups.erase(query.getName()); } } } @@ -180,7 +181,7 @@ int SplitMatrix::createDistanceFilesFromTax(map& seqGroup, int numG //process each distance file for (int i = 0; i < numGroups; i++) { - string options = "fasta=" + (fastafile + "." + toString(i) + ".temp") + ", processors=" + toString(processors); + string options = "fasta=" + (fastafile + "." + toString(i) + ".temp") + ", processors=" + toString(processors) + ", cutoff=" + toString(cutoff); Command* command = new DistanceCommand(options); command->execute(); @@ -219,30 +220,41 @@ int SplitMatrix::createDistanceFilesFromTax(map& seqGroup, int numG } bigNameFile.close(); - remainingNames.close(); - if (!wroteExtra) { - remove(singleton.c_str()); - singleton = "none"; - } - for(int i=0;i temp; temp[tempDistFile] = tempNameFile; dists.push_back(temp); + }else { + ifstream in; + openInputFile(tempNameFile, in); + + while(!in.eof()) { + in >> name >> nameList; gobble(in); + wroteExtra = true; + remainingNames << name << '\t' << nameList << endl; + } + in.close(); + remove(tempNameFile.c_str()); } } fileHandle.close(); } + remainingNames.close(); + if (!wroteExtra) { + remove(singleton.c_str()); + singleton = "none"; + } + if (m->control_pressed) { for (int i = 0; i < dists.size(); i++) { remove((dists[i].begin()->first).c_str()); remove((dists[i].begin()->second).c_str()); } dists.clear(); } return 0;