X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=preclustercommand.cpp;h=215b5bd07981a39b79af57bff95da745b3aa0632;hb=5412970cac5fbb63312d4dd279851f0482787901;hp=66efd469fcf8631d8537b6c7e90ea066ef72c028;hpb=74844a60d80c6dd06e3fb02ee9b928424f9019b0;p=mothur.git diff --git a/preclustercommand.cpp b/preclustercommand.cpp index 66efd46..215b5bd 100644 --- a/preclustercommand.cpp +++ b/preclustercommand.cpp @@ -117,6 +117,8 @@ int PreClusterCommand::execute(){ //reads fasta file and return number of seqs int numSeqs = readFASTA(); //fills alignSeqs and makes all seqs active + + if (m->control_pressed) { return 0; } if (numSeqs == 0) { m->mothurOut("Error reading fasta file...please correct."); m->mothurOutEndLine(); return 0; } if (diffs > length) { m->mothurOut("Error: diffs is greater than your sequence length."); m->mothurOutEndLine(); return 0; } @@ -139,6 +141,9 @@ int PreClusterCommand::execute(){ //try to merge it with all smaller seqs for (int j = i+1; j < numSeqs; j++) { + + if (m->control_pressed) { return 0; } + if (alignSeqs[j].active) { //this sequence has not been merged yet //are you within "diff" bases int mismatch = calcMisMatches(alignSeqs[i].seq.getAligned(), alignSeqs[j].seq.getAligned()); @@ -166,11 +171,14 @@ int PreClusterCommand::execute(){ string newFastaFile = fileroot + "precluster" + getExtension(fastafile); string newNamesFile = fileroot + "precluster.names"; + if (m->control_pressed) { return 0; } m->mothurOut("Total number of sequences before precluster was " + toString(alignSeqs.size()) + "."); m->mothurOutEndLine(); m->mothurOut("pre.cluster removed " + toString(count) + " sequences."); m->mothurOutEndLine(); printData(newFastaFile, newNamesFile); + if (m->control_pressed) { remove(newFastaFile.c_str()); remove(newNamesFile.c_str()); return 0; } + m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); m->mothurOut(newFastaFile); m->mothurOutEndLine(); @@ -202,7 +210,9 @@ int PreClusterCommand::readFASTA(){ length = 0; while (!inFasta.eof()) { - + + if (m->control_pressed) { inFasta.close(); return 0; } + //inNames >> firstCol >> secondCol; //nameString = secondCol;