X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=classifyotucommand.cpp;h=f4a551cf59ffc95c587f47ea111081e0cfb6a727;hp=d0ddc691236e59cdd0fcb6a2578249375fd8ad0e;hb=b206f634aae1b4ce13978d203247fb64757d5482;hpb=7aa301dfa67cfcb5b00c6b4e38a7ad56eb8337db diff --git a/classifyotucommand.cpp b/classifyotucommand.cpp index d0ddc69..f4a551c 100644 --- a/classifyotucommand.cpp +++ b/classifyotucommand.cpp @@ -293,7 +293,7 @@ int ClassifyOtuCommand::execute(){ if (namefile != "") { m->readNames(namefile, nameMap, true); } if (groupfile != "") { groupMap = new GroupMap(groupfile); groupMap->readMap(); groups = groupMap->getNamesOfGroups(); } else { groupMap = NULL; } - if (countfile != "") { ct = new CountTable(); ct->readTable(countfile); if (ct->hasGroupInfo()) { groups = ct->getNamesOfGroups(); } } + if (countfile != "") { ct = new CountTable(); ct->readTable(countfile, true, false); if (ct->hasGroupInfo()) { groups = ct->getNamesOfGroups(); } } else { ct = NULL; } //read taxonomy file and save in map for easy access in building bin trees @@ -544,11 +544,11 @@ int ClassifyOtuCommand::process(ListVector* processList) { PhyloSummary* taxaSum; if (countfile != "") { - if (refTaxonomy != "") { taxaSum = new PhyloSummary(refTaxonomy, ct); } - else { taxaSum = new PhyloSummary(ct); } + if (refTaxonomy != "") { taxaSum = new PhyloSummary(refTaxonomy, ct,false); } + else { taxaSum = new PhyloSummary(ct,false); } }else { - if (refTaxonomy != "") { taxaSum = new PhyloSummary(refTaxonomy, groupMap); } - else { taxaSum = new PhyloSummary(groupMap); } + if (refTaxonomy != "") { taxaSum = new PhyloSummary(refTaxonomy, groupMap,false); } + else { taxaSum = new PhyloSummary(groupMap,false); } } vector outSums; @@ -574,11 +574,11 @@ int ClassifyOtuCommand::process(ListVector* processList) { PhyloSummary* taxaSumt; if (countfile != "") { - if (refTaxonomy != "") { taxaSumt = new PhyloSummary(refTaxonomy, ct); } - else { taxaSumt = new PhyloSummary(ct); } + if (refTaxonomy != "") { taxaSumt = new PhyloSummary(refTaxonomy, ct, false); } + else { taxaSumt = new PhyloSummary(ct, false); } }else { - if (refTaxonomy != "") { taxaSumt = new PhyloSummary(refTaxonomy, groupMap); } - else { taxaSumt = new PhyloSummary(groupMap); } + if (refTaxonomy != "") { taxaSumt = new PhyloSummary(refTaxonomy, groupMap,false); } + else { taxaSumt = new PhyloSummary(groupMap,false); } } taxaSums.push_back(taxaSumt); } @@ -586,6 +586,7 @@ int ClassifyOtuCommand::process(ListVector* processList) { //for each bin in the list vector string snumBins = toString(processList->getNumBins()); + vector binLabels = processList->getLabels(); for (int i = 0; i < processList->getNumBins(); i++) { if (m->control_pressed) { break; } @@ -598,17 +599,8 @@ int ClassifyOtuCommand::process(ListVector* processList) { names = findConsensusTaxonomy(thisNames, size, conTax); if (m->control_pressed) { break; } - - //output to new names file - string binLabel = "Otu"; - string sbinNumber = toString(i+1); - if (sbinNumber.length() < snumBins.length()) { - int diff = snumBins.length() - sbinNumber.length(); - for (int h = 0; h < diff; h++) { binLabel += "0"; } - } - binLabel += sbinNumber; - out << binLabel << '\t' << size << '\t' << conTax << endl; + out << binLabels[i] << '\t' << size << '\t' << conTax << endl; string noConfidenceConTax = conTax; m->removeConfidences(noConfidenceConTax); @@ -616,9 +608,10 @@ int ClassifyOtuCommand::process(ListVector* processList) { //add this bins taxonomy to summary if (basis == "sequence") { for(int j = 0; j < names.size(); j++) { - int numReps = 1; - if (countfile != "") { numReps = ct->getNumSeqs(names[j]); } - for(int k = 0; k < numReps; k++) { taxaSum->addSeqToTree(names[j], noConfidenceConTax); } + //int numReps = 1; + //if (countfile != "") { numReps = ct->getNumSeqs(names[j]); } + //for(int k = 0; k < numReps; k++) { taxaSum->addSeqToTree(names[j], noConfidenceConTax); } + taxaSum->addSeqToTree(names[j], noConfidenceConTax); } }else { //otu map containsGroup; @@ -682,16 +675,8 @@ int ClassifyOtuCommand::process(ListVector* processList) { if (m->control_pressed) { break; } - //output to new names file - string binLabel = "Otu"; - string sbinNumber = toString(i+1); - if (sbinNumber.length() < snumBins.length()) { - int diff = snumBins.length() - sbinNumber.length(); - for (int h = 0; h < diff; h++) { binLabel += "0"; } - } - binLabel += sbinNumber; - (*outs[groupIndex[itParsed->first]]) << binLabel << '\t' << size << '\t' << conTax << endl; + (*outs[groupIndex[itParsed->first]]) << binLabels[i] << '\t' << size << '\t' << conTax << endl; string noConfidenceConTax = conTax; m->removeConfidences(noConfidenceConTax);