X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=consensusseqscommand.cpp;h=3d671f98420e0fa7cf844aac647bd43feea959e8;hp=9bfdc9caba1e6bef2fe14d6eb469af2218bd29d8;hb=050a3ff02473a3d4c0980964e1a9ebe52e55d6b8;hpb=4b54ce99af7db8019ea907cd7c2edf789369ada9 diff --git a/consensusseqscommand.cpp b/consensusseqscommand.cpp index 9bfdc9c..3d671f9 100644 --- a/consensusseqscommand.cpp +++ b/consensusseqscommand.cpp @@ -226,7 +226,7 @@ int ConsensusSeqsCommand::execute(){ if (m->control_pressed) { return 0; } if (namefile != "") { readNames(); } - if (countfile != "") { ct.readTable(countfile); } + if (countfile != "") { ct.readTable(countfile, true); } if (m->control_pressed) { return 0; } @@ -312,7 +312,7 @@ int ConsensusSeqsCommand::execute(){ }else { - + InputData* input = new InputData(listfile, "list"); ListVector* list = input->getListVector(); @@ -435,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();