X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=consensusseqscommand.cpp;h=1b1e7d20d37603610945f6dadbf6dd32399ed8d5;hp=f0fc6bff9da6d6d8b0ed8b368ad2422f25cd732a;hb=1a20e24ee786195ab0e1cccd4f5aede7a88f3f4e;hpb=1a5c2356c1b955c6ec024b2baf9f46377ee7c72e diff --git a/consensusseqscommand.cpp b/consensusseqscommand.cpp index f0fc6bf..1b1e7d2 100644 --- a/consensusseqscommand.cpp +++ b/consensusseqscommand.cpp @@ -219,6 +219,8 @@ int ConsensusSeqsCommand::execute(){ if (abort == true) { if (calledHelp) { return 0; } return 2; } + int start = time(NULL); + readFasta(); if (m->control_pressed) { return 0; } @@ -310,7 +312,7 @@ int ConsensusSeqsCommand::execute(){ }else { - + InputData* input = new InputData(listfile, "list"); ListVector* list = input->getListVector(); @@ -391,6 +393,8 @@ int ConsensusSeqsCommand::execute(){ delete input; } + m->mothurOut("It took " + toString(time(NULL) - start) + " secs to find the consensus sequences."); + m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); } @@ -431,15 +435,24 @@ int ConsensusSeqsCommand::processList(ListVector*& list){ outSummary << "OTU#\tPositioninAlignment\tA\tT\tG\tC\tGap\tNumberofSeqs\tConsensusBase" << endl; + string snumBins = toString(list->getNumBins()); for (int i = 0; i < list->getNumBins(); i++) { if (m->control_pressed) { outSummary.close(); outName.close(); outFasta.close(); return 0; } string bin = list->get(i); string consSeq = getConsSeq(bin, outSummary, i); + + string seqName = "Otu"; + string sbinNumber = toString(i+1); + if (sbinNumber.length() < snumBins.length()) { + int diff = snumBins.length() - sbinNumber.length(); + for (int h = 0; h < diff; h++) { seqName += "0"; } + } + seqName += sbinNumber; - outFasta << ">seq" << (i+1) << endl << consSeq << endl; - outName << "seq" << (i+1) << '\t' << "seq" << (i+1) << "," << bin << endl; + outFasta << ">" << seqName << endl << consSeq << endl; + outName << seqName << '\t' << seqName << "," << bin << endl; } outSummary.close(); outName.close(); outFasta.close();