From: westcott Date: Tue, 2 Nov 2010 15:14:07 +0000 (+0000) Subject: fixed bug with normalize.shared, printed out numbins twice. fixed bug with summary... X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=3aa0b70bf057656ccc2bae1de9816583f2a91779 fixed bug with normalize.shared, printed out numbins twice. fixed bug with summary.single caused if you had too many groups to open all files at once. --- diff --git a/getseqscommand.cpp b/getseqscommand.cpp index b48ba28..4b93d1f 100644 --- a/getseqscommand.cpp +++ b/getseqscommand.cpp @@ -300,6 +300,7 @@ int GetSeqsCommand::readFasta(){ in.close(); out.close(); + if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); } outputNames.push_back(outputFileName); outputTypes["fasta"].push_back(outputFileName); diff --git a/metastats2.c b/metastats2.c index bbea3ce..136c042 100644 --- a/metastats2.c +++ b/metastats2.c @@ -23,10 +23,11 @@ int metastat_main (char* outputFileName, int numRows, int numCols, double thresh // Initialize the matrices size = row*col; +//printf("size = %d\n.", size); double matrix[row][col]; double pmatrix[size],pmatrix2[size],permuted[size]; double storage[row][9]; - +//printf("here\n.", size); for (i=0;i& th } m->mothurOut("Comparing " + setA + " and " + setB + "..."); m->mothurOutEndLine(); - metastat_main(output, thisLookUp[0]->getNumBins(), subset.size(), threshold, iters, data, setACount); m->mothurOutEndLine(); diff --git a/mothur b/mothur index 197583b..fcb006d 100755 Binary files a/mothur and b/mothur differ diff --git a/normalizesharedcommand.cpp b/normalizesharedcommand.cpp index 93bc7f2..8aec029 100644 --- a/normalizesharedcommand.cpp +++ b/normalizesharedcommand.cpp @@ -12,7 +12,7 @@ //********************************************************************************************************************** vector NormalizeSharedCommand::getValidParameters(){ try { - string Array[] = {"groups","label","scale","outputdir","inputdir","norm"}; + string Array[] = {"groups","label","method","outputdir","inputdir","norm"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); return myArray; } @@ -71,7 +71,7 @@ NormalizeSharedCommand::NormalizeSharedCommand(string option) { else { //valid paramters for this command - string AlignArray[] = {"groups","label","scale","outputdir","inputdir","norm"}; + string AlignArray[] = {"groups","label","method","outputdir","inputdir","norm"}; vector myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string))); OptionParser parser(option); @@ -322,7 +322,7 @@ int NormalizeSharedCommand::normalize(vector& thisLookUp, o eliminateZeroOTUS(thisLookUp); for (int i = 0; i < thisLookUp.size(); i++) { - out << thisLookUp[i]->getLabel() << '\t' << thisLookUp[i]->getGroup() << '\t' << thisLookUp[i]->getNumBins() << '\t'; + out << thisLookUp[i]->getLabel() << '\t' << thisLookUp[i]->getGroup() << '\t'; thisLookUp[i]->print(out); } diff --git a/summarycommand.cpp b/summarycommand.cpp index d68d00a..1e0e8db 100644 --- a/summarycommand.cpp +++ b/summarycommand.cpp @@ -506,52 +506,64 @@ string SummaryCommand::createGroupSummaryFile(int numLines, int numCols, vector< //open each groups summary file string newLabel = ""; - ifstream* temp; - map filehandles; + map > files; for (int i=0; iopenInputFile(outputNames[i], *(temp)); + vector thisFilesLines; + + ifstream temp; + m->openInputFile(outputNames[i], temp); //read through first line - labels string tempLabel; if (i == 0) { //we want to save the labels to output below for (int j = 0; j < numCols+1; j++) { - *(temp) >> tempLabel; + temp >> tempLabel; if (j == 1) { newLabel += "group\t" + tempLabel + '\t'; }else{ newLabel += tempLabel + '\t'; } } - }else{ for (int j = 0; j < numCols+1; j++) { *(temp) >> tempLabel; } } + }else{ for (int j = 0; j < numCols+1; j++) { temp >> tempLabel; } } + + m->gobble(temp); + + //for each label + for (int k = 0; k < numLines; k++) { + + string thisLine = ""; + string tempLabel; + + for (int j = 0; j < numCols+1; j++) { + temp >> tempLabel; + + //save for later + if (j == 1) { thisLine += groups[i] + "\t" + tempLabel + "\t"; } + else{ thisLine += tempLabel + "\t"; } + } + + thisLine += "\n"; + + thisFilesLines.push_back(thisLine); + + m->gobble(temp); + } + + files[outputNames[i]] = thisFilesLines; - m->gobble(*(temp)); + temp.close(); } //output label line to new file out << newLabel << endl; //for each label - for (int i = 0; i < numLines; i++) { + for (int k = 0; k < numLines; k++) { //grab summary data for each group for (int i=0; i> tempLabel; - - //print to combined file - if (j == 1) { out << groups[i] << '\t' << tempLabel << '\t'; } - else{ out << tempLabel << '\t'; } - } - - out << endl; - m->gobble(*(filehandles[outputNames[i]])); + out << files[outputNames[i]][k]; } } - //close each groups summary file - for (int i=0; iopenInputFile(qfilename, inQual); - + string input; while(!inQual.eof()){ input = m->getline(inQual); @@ -784,6 +784,7 @@ int TrimSeqsCommand::setLines(string filename, string qfilename, vector::iterator it = firstSeqNames.begin(); it != firstSeqNames.end(); it++) { m->mothurOut(it->first + " is in your fasta file and not in your quality file, not using quality file."); m->mothurOutEndLine();