From: westcott Date: Mon, 23 Aug 2010 16:11:13 +0000 (+0000) Subject: filter.seqs bug change X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=d84bb41d7dadcfa2c67ce5edb9b94060e5659fa7 filter.seqs bug change --- diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 71436b7..ebe8a90 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -737,8 +737,8 @@ A7DA2022113FECD400BF472F /* clustercommand.h */, A71D924311AEB42400D00CBC /* clustersplitcommand.h */, A71D924211AEB42400D00CBC /* clustersplitcommand.cpp */, - A7DA2025113FECD400BF472F /* collectcommand.cpp */, A7DA2026113FECD400BF472F /* collectcommand.h */, + A7DA2025113FECD400BF472F /* collectcommand.cpp */, A7DA2029113FECD400BF472F /* collectsharedcommand.cpp */, A7DA202A113FECD400BF472F /* collectsharedcommand.h */, A7DA2031113FECD400BF472F /* consensuscommand.cpp */, diff --git a/aligncommand.cpp b/aligncommand.cpp index ed6b45d..613f9b7 100644 --- a/aligncommand.cpp +++ b/aligncommand.cpp @@ -347,7 +347,7 @@ int AlignCommand::execute(){ #else vector positions = divideFile(candidateFileNames[s], processors); - + for (int i = 0; i < (positions.size()-1); i++) { lines.push_back(new linePair(positions[i], positions[(i+1)])); } diff --git a/filterseqscommand.cpp b/filterseqscommand.cpp index e91d32b..2c61465 100644 --- a/filterseqscommand.cpp +++ b/filterseqscommand.cpp @@ -866,6 +866,13 @@ int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename) processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later process++; }else if (pid == 0){ + //reset child's filter counts to 0; + F.a.clear(); F.a.resize(alignmentLength, 0); + F.t.clear(); F.t.resize(alignmentLength, 0); + F.g.clear(); F.g.resize(alignmentLength, 0); + F.c.clear(); F.c.resize(alignmentLength, 0); + F.gap.clear(); F.gap.resize(alignmentLength, 0); + num = driverCreateFilter(F, filename, lines[process]); //write out filter counts to file diff --git a/mothur.h b/mothur.h index 2622e25..d5086b3 100644 --- a/mothur.h +++ b/mothur.h @@ -1163,7 +1163,7 @@ inline vector divideFile(string filename, int& proc) { //for each process seekg to closest file break and search for next '>' char. make that the filebreak for (int i = 0; i < proc; i++) { unsigned long int spot = (i+1) * chunkSize; - + ifstream in; openInputFile(filename, in); in.seekg(spot); @@ -1174,9 +1174,10 @@ inline vector divideFile(string filename, int& proc) { char c = in.get(); if (c == '>') { in.putback(c); newSpot = in.tellg(); break; } } - + //there was not another sequence before the end of the file - if (newSpot == spot) { break; } + unsigned long int sanityPos = in.tellg(); + if (sanityPos == -1) { break; } else { filePos.push_back(newSpot); } in.close();