//**********************************************************************************************************************
ConsensusSeqsCommand::ConsensusSeqsCommand(){
try {
- abort = true;
- //initialize outputTypes
+ abort = true; calledHelp = true;
vector<string> tempOutNames;
outputTypes["fasta"] = tempOutNames;
outputTypes["name"] = tempOutNames;
//***************************************************************************************************************
ConsensusSeqsCommand::ConsensusSeqsCommand(string option) {
try {
- abort = false;
+ abort = false; calledHelp = false;
allLines = 1;
//allow user to run help
- if(option == "help") { help(); abort = true; }
+ if(option == "help") { help(); abort = true; calledHelp = true; }
else {
//valid paramters for this command
int ConsensusSeqsCommand::execute(){
try{
- if (abort == true) { return 0; }
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
readFasta();
outSummary.setf(ios::fixed, ios::floatfield); outSummary.setf(ios::showpoint);
outputNames.push_back(outputSummaryFile); outputTypes["summary"].push_back(outputSummaryFile);
+ outSummary << "PositioninAlignment\tA\tT\tG\tC\tGap\tNumberofSeqs\tConsensusBase" << endl;
+
ofstream outFasta;
string outputFastaFile = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "cons.fasta";
m->openOutputFile(outputFastaFile, outFasta);
}
- outSummary << "A" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[0][j] << '\t'; }
- outSummary << endl;
- outSummary << "T" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[1][j] << '\t'; }
- outSummary << endl;
- outSummary << "G" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[2][j] << '\t'; }
- outSummary << endl;
- outSummary << "C" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[3][j] << '\t'; }
- outSummary << endl;
- outSummary << "Gap" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[4][j] << '\t'; }
- outSummary << endl;
+ for (int j = 0; j < seqLength; j++) {
+ outSummary << (j+1) << '\t' << percentages[0][j] << '\t'<< percentages[1][j] << '\t'<< percentages[2][j] << '\t' << percentages[3][j] << '\t' << percentages[4][j] << '\t' << seqs.size() << '\t' << consSeq[j] << endl;
+ }
outFasta << ">conseq" << endl << consSeq << endl;
m->openOutputFile(outputFastaFile, outFasta);
outputNames.push_back(outputFastaFile); outputTypes["fasta"].push_back(outputFastaFile);
+ outSummary << "OTU#\tPositioninAlignment\tA\tT\tG\tC\tGap\tNumberofSeqs\tConsensusBase" << endl;
+
for (int i = 0; i < list->getNumBins(); i++) {
if (m->control_pressed) { outSummary.close(); outName.close(); outFasta.close(); return 0; }
}
- outSummary << ">seq" << (binNumber + 1) << endl;
- outSummary << "A" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[0][j] << '\t'; }
- outSummary << endl;
- outSummary << "T" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[1][j] << '\t'; }
- outSummary << endl;
- outSummary << "G" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[2][j] << '\t'; }
- outSummary << endl;
- outSummary << "C" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[3][j] << '\t'; }
- outSummary << endl;
- outSummary << "Gap" << '\t';
- for (int j = 0; j < seqLength; j++) { outSummary << percentages[4][j] << '\t'; }
- outSummary << endl;
-
+ for (int j = 0; j < seqLength; j++) {
+ outSummary << (binNumber + 1) << '\t' << (j+1) << '\t' << percentages[0][j] << '\t'<< percentages[1][j] << '\t'<< percentages[2][j] << '\t' << percentages[3][j] << '\t' << percentages[4][j] << '\t' << seqs.size() << '\t' << consSeq[j] << endl;
+ }
return consSeq;