From af0a94ea8f02421b2b73e77e68753a2b4c37768e Mon Sep 17 00:00:00 2001 From: SarahsWork Date: Mon, 22 Apr 2013 09:47:08 -0400 Subject: [PATCH] added flag to count table read so that commands that don't require the group info can tell countTable to ignore it --- binsequencecommand.cpp | 2 +- chimeraperseuscommand.cpp | 8 ++++---- chimeraperseuscommand.h | 2 +- chimeraslayercommand.cpp | 8 ++++---- chimerauchimecommand.cpp | 8 ++++---- chimerauchimecommand.h | 2 +- classifyotucommand.cpp | 2 +- classifyseqscommand.cpp | 2 +- clustercommand.cpp | 2 +- clusterdoturcommand.cpp | 2 +- clusterfragmentscommand.cpp | 2 +- clustersplitcommand.cpp | 4 ++-- consensusseqscommand.cpp | 2 +- countgroupscommand.cpp | 2 +- countseqscommand.cpp | 2 ++ countseqscommand.h | 1 + counttable.cpp | 12 +++++++++--- counttable.h | 2 +- deconvolutecommand.cpp | 2 +- getgroupscommand.cpp | 2 +- getlineagecommand.cpp | 2 +- getoturepcommand.cpp | 6 +++--- getrabundcommand.cpp | 2 +- getsabundcommand.cpp | 2 +- getseqscommand.cpp | 2 +- heatmapsimcommand.cpp | 2 +- listseqscommand.cpp | 2 +- mgclustercommand.cpp | 2 +- parselistscommand.cpp | 2 +- prcseqscommand.cpp | 2 +- preclustercommand.cpp | 2 +- primerdesigncommand.cpp | 2 +- removegroupscommand.cpp | 2 +- removelineagecommand.cpp | 2 +- removerarecommand.cpp | 2 +- removeseqscommand.cpp | 2 +- screenseqscommand.cpp | 8 ++++---- secondarystructurecommand.cpp | 2 +- seqerrorcommand.cpp | 2 +- seqsummarycommand.cpp | 2 +- sequencecountparser.cpp | 2 +- sharedcommand.cpp | 2 +- sharedlistvector.cpp | 2 +- splitabundcommand.cpp | 2 +- splitgroupscommand.cpp | 2 +- subsamplecommand.cpp | 2 +- summaryqualcommand.cpp | 2 +- summarytaxcommand.cpp | 2 +- treegroupscommand.cpp | 2 +- treereader.cpp | 2 +- trimseqscommand.cpp | 4 ++-- 51 files changed, 76 insertions(+), 67 deletions(-) diff --git a/binsequencecommand.cpp b/binsequencecommand.cpp index 7798a4d..be167d9 100644 --- a/binsequencecommand.cpp +++ b/binsequencecommand.cpp @@ -249,7 +249,7 @@ int BinSeqCommand::execute(){ //if user gave a namesfile then use it if (namesfile != "") { readNamesFile(); } - if (countfile != "") { ct.readTable(countfile); } + if (countfile != "") { ct.readTable(countfile, true); } input = new InputData(listfile, "list"); list = input->getListVector(); diff --git a/chimeraperseuscommand.cpp b/chimeraperseuscommand.cpp index fd94fca..cea481b 100644 --- a/chimeraperseuscommand.cpp +++ b/chimeraperseuscommand.cpp @@ -516,7 +516,7 @@ int ChimeraPerseusCommand::execute(){ if (hasCount) { CountTable* ct = new CountTable(); - ct->readTable(nameFile); + ct->readTable(nameFile, true); if (ct->hasGroupInfo()) { cparser = new SequenceCountParser(fastaFileNames[s], *ct); @@ -534,7 +534,7 @@ int ChimeraPerseusCommand::execute(){ if(processors == 1) { numSeqs = driverGroups(outputFileName, accnosFileName, newCountFile, 0, groups.size(), groups); if (dups) { - CountTable c; c.readTable(nameFile); + CountTable c; c.readTable(nameFile, true); if (!m->isBlank(newCountFile)) { ifstream in2; m->openInputFile(newCountFile, in2); @@ -559,7 +559,7 @@ int ChimeraPerseusCommand::execute(){ numChimeras = deconvoluteResults(uniqueNames, outputFileName, accnosFileName); }else { set doNotRemove; - CountTable c; c.readTable(newCountFile); + CountTable c; c.readTable(newCountFile, true); vector namesInTable = c.getNamesOfSeqs(); for (int i = 0; i < namesInTable.size(); i++) { int temp = c.getNumSeqs(namesInTable[i]); @@ -1070,7 +1070,7 @@ int ChimeraPerseusCommand::createProcessesGroups(string outputFName, string accn int num = 0; CountTable newCount; - if (hasCount && dups) { newCount.readTable(name); } + if (hasCount && dups) { newCount.readTable(name, true); } //sanity check if (groups.size() < processors) { processors = groups.size(); } diff --git a/chimeraperseuscommand.h b/chimeraperseuscommand.h index 99a66f8..b6d4fc9 100644 --- a/chimeraperseuscommand.h +++ b/chimeraperseuscommand.h @@ -130,7 +130,7 @@ static DWORD WINAPI MyPerseusThreadFunction(LPVOID lpParam){ SequenceCountParser* cparser; if (pDataArray->hasCount) { CountTable* ct = new CountTable(); - ct->readTable(pDataArray->namefile); + ct->readTable(pDataArray->namefile, true); cparser = new SequenceCountParser(pDataArray->fastafile, *ct); delete ct; }else { diff --git a/chimeraslayercommand.cpp b/chimeraslayercommand.cpp index e7003c4..f01bd3e 100644 --- a/chimeraslayercommand.cpp +++ b/chimeraslayercommand.cpp @@ -759,7 +759,7 @@ int ChimeraSlayerCommand::execute(){ if (processors == 1) { numSeqs = driverGroups(outputFileName, accnosFileName, trimFastaFileName, fileToPriority, fileGroup, newCountFile); if (hasCount && dups) { - CountTable c; c.readTable(nameFileNames[s]); + CountTable c; c.readTable(nameFileNames[s], true); if (!m->isBlank(newCountFile)) { ifstream in2; m->openInputFile(newCountFile, in2); @@ -791,7 +791,7 @@ int ChimeraSlayerCommand::execute(){ }else { if (hasCount) { set doNotRemove; - CountTable c; c.readTable(newCountFile); + CountTable c; c.readTable(newCountFile, true); vector namesInTable = c.getNamesOfSeqs(); for (int i = 0; i < namesInTable.size(); i++) { int temp = c.getNumSeqs(namesInTable[i]); @@ -1551,7 +1551,7 @@ int ChimeraSlayerCommand::createProcessesGroups(string outputFName, string accno if (fileToPriority.size() < processors) { processors = fileToPriority.size(); } CountTable newCount; - if (hasCount && dups) { newCount.readTable(countFile); } + if (hasCount && dups) { newCount.readTable(countFile, true); } int groupsPerProcessor = fileToPriority.size() / processors; int remainder = fileToPriority.size() % processors; @@ -2161,7 +2161,7 @@ map ChimeraSlayerCommand::sortFastaFile(string fastaFile, string na int error; if (hasCount) { CountTable ct; - ct.readTable(nameFile); + ct.readTable(nameFile, true); for(map::iterator it = seqs.begin(); it != seqs.end(); it++) { int num = ct.getNumSeqs(it->first); diff --git a/chimerauchimecommand.cpp b/chimerauchimecommand.cpp index 3d23a76..422792a 100644 --- a/chimerauchimecommand.cpp +++ b/chimerauchimecommand.cpp @@ -674,7 +674,7 @@ int ChimeraUchimeCommand::execute(){ int error; if (hasCount) { CountTable ct; - ct.readTable(nameFile); + ct.readTable(nameFile, true); for(map::iterator it = seqs.begin(); it != seqs.end(); it++) { int num = ct.getNumSeqs(it->first); if (num == 0) { error = 1; } @@ -725,7 +725,7 @@ int ChimeraUchimeCommand::execute(){ if(processors == 1) { totalSeqs = driverGroups(outputFileName, newFasta, accnosFileName, alnsFileName, newCountFile, 0, groups.size(), groups); if (hasCount && dups) { - CountTable c; c.readTable(nameFile); + CountTable c; c.readTable(nameFile, true); if (!m->isBlank(newCountFile)) { ifstream in2; m->openInputFile(newCountFile, in2); @@ -755,7 +755,7 @@ int ChimeraUchimeCommand::execute(){ if (hasCount) { set doNotRemove; - CountTable c; c.readTable(newCountFile); + CountTable c; c.readTable(newCountFile, true); vector namesInTable = c.getNamesOfSeqs(); for (int i = 0; i < namesInTable.size(); i++) { int temp = c.getNumSeqs(namesInTable[i]); @@ -1795,7 +1795,7 @@ int ChimeraUchimeCommand::createProcessesGroups(string outputFName, string filen int num = 0; CountTable newCount; - if (hasCount && dups) { newCount.readTable(nameFile); } + if (hasCount && dups) { newCount.readTable(nameFile, true); } //sanity check if (groups.size() < processors) { processors = groups.size(); } diff --git a/chimerauchimecommand.h b/chimerauchimecommand.h index 2237493..fadc4a4 100644 --- a/chimerauchimecommand.h +++ b/chimerauchimecommand.h @@ -175,7 +175,7 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){ SequenceCountParser* cparser; if (pDataArray->hasCount) { CountTable* ct = new CountTable(); - ct->readTable(pDataArray->namefile); + ct->readTable(pDataArray->namefile, true); cparser = new SequenceCountParser(pDataArray->fastafile, *ct); delete ct; }else { diff --git a/classifyotucommand.cpp b/classifyotucommand.cpp index d0ddc69..170c234 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); if (ct->hasGroupInfo()) { groups = ct->getNamesOfGroups(); } } else { ct = NULL; } //read taxonomy file and save in map for easy access in building bin trees diff --git a/classifyseqscommand.cpp b/classifyseqscommand.cpp index edbd4c4..b311821 100644 --- a/classifyseqscommand.cpp +++ b/classifyseqscommand.cpp @@ -812,7 +812,7 @@ int ClassifySeqsCommand::execute(){ PhyloSummary* taxaSum; if (hasCount) { ct = new CountTable(); - ct->readTable(countfileNames[s]); + ct->readTable(countfileNames[s], true); taxaSum = new PhyloSummary(taxonomyFileName, ct); taxaSum->summarize(tempTaxonomyFile); }else { diff --git a/clustercommand.cpp b/clustercommand.cpp index e4e2062..2ac2eaa 100644 --- a/clustercommand.cpp +++ b/clustercommand.cpp @@ -305,7 +305,7 @@ int ClusterCommand::execute(){ read->read(nameMap); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(countfile); + ct->readTable(countfile, false); read->read(ct); }else { read->read(nameMap); } diff --git a/clusterdoturcommand.cpp b/clusterdoturcommand.cpp index 91eb923..08a5938 100644 --- a/clusterdoturcommand.cpp +++ b/clusterdoturcommand.cpp @@ -226,7 +226,7 @@ int ClusterDoturCommand::execute(){ delete nameMap; }else if (countfile != "") { ct = new CountTable(); - ct->readTable(countfile); + ct->readTable(countfile, false); cluster->readPhylipFile(phylipfile, ct); delete ct; }else { diff --git a/clusterfragmentscommand.cpp b/clusterfragmentscommand.cpp index 1b8cc71..f17c11e 100644 --- a/clusterfragmentscommand.cpp +++ b/clusterfragmentscommand.cpp @@ -181,7 +181,7 @@ ClusterFragmentsCommand::ClusterFragmentsCommand(string option) { countfile = validParameter.validFile(parameters, "count", true); if (countfile == "not open") { abort = true; countfile = ""; } else if (countfile == "not found") { countfile = ""; } - else { ct.readTable(countfile); m->setCountTableFile(countfile); } + else { ct.readTable(countfile, false); m->setCountTableFile(countfile); } if ((countfile != "") && (namefile != "")) { m->mothurOut("When executing a cluster.fragments command you must enter ONLY ONE of the following: count or name."); m->mothurOutEndLine(); abort = true; } diff --git a/clustersplitcommand.cpp b/clustersplitcommand.cpp index 37e42d2..74867eb 100644 --- a/clustersplitcommand.cpp +++ b/clustersplitcommand.cpp @@ -1168,7 +1168,7 @@ string ClusterSplitCommand::clusterClassicFile(string thisDistFile, string thisN cluster->readPhylipFile(thisDistFile, nameMap); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(thisNamefile); + ct->readTable(thisNamefile, false); cluster->readPhylipFile(thisDistFile, ct); } tag = cluster->getTag(); @@ -1296,7 +1296,7 @@ string ClusterSplitCommand::clusterFile(string thisDistFile, string thisNamefile read->read(nameMap); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(thisNamefile); + ct->readTable(thisNamefile, false); read->read(ct); }else { read->read(nameMap); } diff --git a/consensusseqscommand.cpp b/consensusseqscommand.cpp index 1b1e7d2..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; } diff --git a/countgroupscommand.cpp b/countgroupscommand.cpp index 6da0774..83c2d31 100644 --- a/countgroupscommand.cpp +++ b/countgroupscommand.cpp @@ -261,7 +261,7 @@ int CountGroupsCommand::execute(){ m->openOutputFile(outputFileName, out); CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true); //make sure groups are valid //takes care of user setting groupNames that are invalid or setting groups=all diff --git a/countseqscommand.cpp b/countseqscommand.cpp index dfa012e..e97810e 100644 --- a/countseqscommand.cpp +++ b/countseqscommand.cpp @@ -17,6 +17,7 @@ vector CountSeqsCommand::setParameters(){ try { CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none","count",false,true,true); parameters.push_back(pname); CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none","",false,false,true); parameters.push_back(pgroup); + CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pprocessors); CommandParameter plarge("large", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(plarge); CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups); CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); @@ -39,6 +40,7 @@ string CountSeqsCommand::getHelpString(){ helpString += "The groups parameter allows you to indicate which groups you want to include in the counts, by default all groups in your groupfile are used.\n"; helpString += "The large parameter indicates the name and group files are too large to fit in RAM.\n"; helpString += "When you use the groups parameter and a sequence does not represent any sequences from the groups you specify it is not included in the .count.summary file.\n"; + helpString += "The processors parameter allows you to specify the number of processors to use. The default is 1.\n"; helpString += "The count.seqs command should be in the following format: count.seqs(name=yourNameFile).\n"; helpString += "Example count.seqs(name=amazon.names) or make.table(name=amazon.names).\n"; helpString += "Note: No spaces between parameter labels (i.e. name), '=' and parameters (i.e.yourNameFile).\n"; diff --git a/countseqscommand.h b/countseqscommand.h index b4170a8..6ba36b1 100644 --- a/countseqscommand.h +++ b/countseqscommand.h @@ -37,6 +37,7 @@ private: string namefile, groupfile, outputDir, groups; bool abort, large; vector Groups, outputNames; + int processors; int processSmall(string); int processLarge(string); diff --git a/counttable.cpp b/counttable.cpp index 48b52d9..6eca8ee 100644 --- a/counttable.cpp +++ b/counttable.cpp @@ -211,7 +211,7 @@ int CountTable::createTable(string namefile, string groupfile, bool createGroup) } } /************************************************************/ -int CountTable::readTable(string file) { +int CountTable::readTable(string file, bool readGroups) { try { filename = file; ifstream in; @@ -227,7 +227,7 @@ int CountTable::readTable(string file) { indexNameMap.clear(); counts.clear(); map originalGroupIndexes; - if (columnHeaders.size() > 2) { hasGroups = true; numGroups = columnHeaders.size() - 2; } + if ((columnHeaders.size() > 2) && readGroups) { hasGroups = true; numGroups = columnHeaders.size() - 2; } for (int i = 2; i < columnHeaders.size(); i++) { groups.push_back(columnHeaders[i]); originalGroupIndexes[i-2] = columnHeaders[i]; totalGroups.push_back(0); } //sort groups to keep consistent with how we store the groups in groupmap sort(groups.begin(), groups.end()); @@ -248,7 +248,13 @@ int CountTable::readTable(string file) { //if group info, then read it vector groupCounts; groupCounts.resize(numGroups, 0); - for (int i = 0; i < numGroups; i++) { int thisIndex = indexGroupMap[originalGroupIndexes[i]]; in >> groupCounts[thisIndex]; m->gobble(in); totalGroups[thisIndex] += groupCounts[thisIndex]; } + if (columnHeaders.size() > 2) { //file contains groups + if (readGroups) { //user wants to save them + for (int i = 0; i < numGroups; i++) { int thisIndex = indexGroupMap[originalGroupIndexes[i]]; in >> groupCounts[thisIndex]; m->gobble(in); totalGroups[thisIndex] += groupCounts[thisIndex]; } + }else { //read and discard + m->getline(in); m->gobble(in); + } + } map::iterator it = indexNameMap.find(name); if (it == indexNameMap.end()) { diff --git a/counttable.h b/counttable.h index 34c941b..51d0b45 100644 --- a/counttable.h +++ b/counttable.h @@ -50,7 +50,7 @@ class CountTable { //reads and creates smart enough to eliminate groups with zero counts int createTable(set&, map&, set&); //seqNames, seqName->group, groupNames int createTable(string, string, bool); //namefile, groupfile, createGroup - int readTable(string); + int readTable(string, bool); int printTable(string); int printHeaders(ofstream&); diff --git a/deconvolutecommand.cpp b/deconvolutecommand.cpp index 09e077b..8b73425 100644 --- a/deconvolutecommand.cpp +++ b/deconvolutecommand.cpp @@ -209,7 +209,7 @@ int DeconvoluteCommand::execute() { } CountTable ct; if (countfile != "") { - ct.readTable(countfile); + ct.readTable(countfile, false); if (countfile == outCountFile){ //prepare filenames and open files map mvariables; diff --git a/getgroupscommand.cpp b/getgroupscommand.cpp index e4f7450..45e0a78 100644 --- a/getgroupscommand.cpp +++ b/getgroupscommand.cpp @@ -370,7 +370,7 @@ int GetGroupsCommand::execute(){ m->mothurOut("\n[NOTE]: The count file should contain only unique names, so mothur assumes your fasta, list and taxonomy files also contain only uniques.\n\n"); } CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true); if (!ct.hasGroupInfo()) { m->mothurOut("[ERROR]: your count file does not contain group info, aborting.\n"); return 0; } vector gNamesOfGroups = ct.getNamesOfGroups(); diff --git a/getlineagecommand.cpp b/getlineagecommand.cpp index 438aa38..b895cc4 100644 --- a/getlineagecommand.cpp +++ b/getlineagecommand.cpp @@ -444,7 +444,7 @@ int GetLineageCommand::readCount(){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(outputFileName)) { - ct.readTable(outputFileName); + ct.readTable(outputFileName, true); ct.printTable(outputFileName); } diff --git a/getoturepcommand.cpp b/getoturepcommand.cpp index a041b38..dbd19a8 100644 --- a/getoturepcommand.cpp +++ b/getoturepcommand.cpp @@ -261,7 +261,7 @@ GetOTURepCommand::GetOTURepCommand(string option) { else if (countfile == "not open") { abort = true; countfile = ""; } else { m->setCountTableFile(countfile); - ct.readTable(countfile); + ct.readTable(countfile, true); if (ct.hasGroupInfo()) { hasGroups = true; } } @@ -1106,7 +1106,7 @@ int GetOTURepCommand::processFastaNames(string filename, string label, FastaMap* CountTable thisCt; if (countfile != "") { - thisCt.readTable(countfile); + thisCt.readTable(countfile, true); if (tempGroup != "noGroup") { out2 << "Representative_Sequence\ttotal\t" << tempGroup << endl; } } @@ -1253,7 +1253,7 @@ int GetOTURepCommand::processNames(string filename, string label) { CountTable thisCt; if (countfile != "") { - thisCt.readTable(countfile); + thisCt.readTable(countfile, true); if (tempGroup != "noGroup") { out2 << "Representative_Sequence\ttotal\t" << tempGroup << endl; } } diff --git a/getrabundcommand.cpp b/getrabundcommand.cpp index 4870a62..da1bfae 100644 --- a/getrabundcommand.cpp +++ b/getrabundcommand.cpp @@ -319,7 +319,7 @@ int GetRAbundCommand::execute(){ int GetRAbundCommand::processList(ofstream& out){ try { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, false); InputData input(inputfile, format); ListVector* list = input.getListVector(); diff --git a/getsabundcommand.cpp b/getsabundcommand.cpp index d3fb529..f4838cf 100644 --- a/getsabundcommand.cpp +++ b/getsabundcommand.cpp @@ -307,7 +307,7 @@ int GetSAbundCommand::execute(){ int GetSAbundCommand::processList(ofstream& out){ try { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, false); InputData input(inputfile, format); ListVector* list = input.getListVector(); diff --git a/getseqscommand.cpp b/getseqscommand.cpp index 287f5a6..142023e 100644 --- a/getseqscommand.cpp +++ b/getseqscommand.cpp @@ -587,7 +587,7 @@ int GetSeqsCommand::readCount(){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(outputFileName)) { - ct.readTable(outputFileName); + ct.readTable(outputFileName, true); ct.printTable(outputFileName); } diff --git a/heatmapsimcommand.cpp b/heatmapsimcommand.cpp index 98739b6..01a60ae 100644 --- a/heatmapsimcommand.cpp +++ b/heatmapsimcommand.cpp @@ -543,7 +543,7 @@ int HeatMapSimCommand::runCommandDist() { } }else if (countfile != "") { nameMap = NULL; - ct.readTable(countfile); + ct.readTable(countfile, true); names = ct.getNamesOfSeqs(); } diff --git a/listseqscommand.cpp b/listseqscommand.cpp index d10dfb4..cf88470 100644 --- a/listseqscommand.cpp +++ b/listseqscommand.cpp @@ -415,7 +415,7 @@ int ListSeqsCommand::readGroup(){ int ListSeqsCommand::readCount(){ try { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, false); if (m->control_pressed) { return 0; } diff --git a/mgclustercommand.cpp b/mgclustercommand.cpp index 24c4f27..e76dd48 100644 --- a/mgclustercommand.cpp +++ b/mgclustercommand.cpp @@ -247,7 +247,7 @@ int MGClusterCommand::execute(){ if(countfile != "") { //map nameMapCounts = m->readNames(namefile); ct = new CountTable(); - ct->readTable(countfile); + ct->readTable(countfile, false); rabund = new RAbundVector(); createRabund(ct, list, rabund); }else { diff --git a/parselistscommand.cpp b/parselistscommand.cpp index 3ed65c6..5a568f3 100644 --- a/parselistscommand.cpp +++ b/parselistscommand.cpp @@ -169,7 +169,7 @@ ParseListCommand::ParseListCommand(string option) { else if (countfile == "not open") { abort = true; countfile = ""; } else { m->setCountTableFile(countfile); - ct.readTable(countfile); + ct.readTable(countfile, true); if (!ct.hasGroupInfo()) { abort = true; m->mothurOut("[ERROR]: The parse.list command requires group info to be present in your countfile, quitting."); m->mothurOutEndLine(); diff --git a/prcseqscommand.cpp b/prcseqscommand.cpp index 8db6c24..f2ca9db 100644 --- a/prcseqscommand.cpp +++ b/prcseqscommand.cpp @@ -1088,7 +1088,7 @@ int PcrSeqsCommand::readCount(set badSeqNames){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(goodCountFile)) { - ct.readTable(goodCountFile); + ct.readTable(goodCountFile, true); ct.printTable(goodCountFile); } diff --git a/preclustercommand.cpp b/preclustercommand.cpp index bbf8df2..24d2284 100644 --- a/preclustercommand.cpp +++ b/preclustercommand.cpp @@ -192,7 +192,7 @@ PreClusterCommand::PreClusterCommand(string option) { else if (countfile == "not open") { abort = true; countfile = ""; } else { m->setCountTableFile(countfile); - ct.readTable(countfile); + ct.readTable(countfile, true); if (ct.hasGroupInfo()) { bygroup = true; } else { bygroup = false; } } diff --git a/primerdesigncommand.cpp b/primerdesigncommand.cpp index 59369b3..195adf4 100644 --- a/primerdesigncommand.cpp +++ b/primerdesigncommand.cpp @@ -1088,7 +1088,7 @@ map PrimerDesignCommand::readCount(unsigned long int& numSeqs){ map nameMap; CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, false); vector namesOfSeqs = ct.getNamesOfSeqs(); numSeqs = ct.getNumUniqueSeqs(); diff --git a/removegroupscommand.cpp b/removegroupscommand.cpp index 4f4b158..1e5fe11 100644 --- a/removegroupscommand.cpp +++ b/removegroupscommand.cpp @@ -369,7 +369,7 @@ int RemoveGroupsCommand::execute(){ m->mothurOut("\n[NOTE]: The count file should contain only unique names, so mothur assumes your fasta, list and taxonomy files also contain only uniques.\n\n"); } CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true); if (!ct.hasGroupInfo()) { m->mothurOut("[ERROR]: your count file does not contain group info, aborting.\n"); return 0; } vector gNamesOfGroups = ct.getNamesOfGroups(); diff --git a/removelineagecommand.cpp b/removelineagecommand.cpp index 5b6fc25..1496f8a 100644 --- a/removelineagecommand.cpp +++ b/removelineagecommand.cpp @@ -599,7 +599,7 @@ int RemoveLineageCommand::readCount(){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(outputFileName)) { - ct.readTable(outputFileName); + ct.readTable(outputFileName, true); ct.printTable(outputFileName); } diff --git a/removerarecommand.cpp b/removerarecommand.cpp index cf6674e..a551681 100644 --- a/removerarecommand.cpp +++ b/removerarecommand.cpp @@ -411,7 +411,7 @@ int RemoveRareCommand::processList(){ util.setGroups(Groups, namesGroups); m->openOutputFile(outputGroupFileName, outGroup); }else if (countfile != "") { - ct.readTable(countfile); + ct.readTable(countfile, true); if (ct.hasGroupInfo()) { vector namesGroups = ct.getNamesOfGroups(); SharedUtil util; diff --git a/removeseqscommand.cpp b/removeseqscommand.cpp index c7af108..b1bc4fd 100644 --- a/removeseqscommand.cpp +++ b/removeseqscommand.cpp @@ -557,7 +557,7 @@ int RemoveSeqsCommand::readCount(){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(outputFileName)) { - ct.readTable(outputFileName); + ct.readTable(outputFileName, true); ct.printTable(outputFileName); } diff --git a/screenseqscommand.cpp b/screenseqscommand.cpp index d2fbe93..051aa99 100644 --- a/screenseqscommand.cpp +++ b/screenseqscommand.cpp @@ -683,7 +683,7 @@ int ScreenSeqsCommand::screenReports(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true); nameMap = ct.getNameMap(); } getSummary(positions); @@ -714,7 +714,7 @@ int ScreenSeqsCommand::screenReports(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true); nameMap = ct.getNameMap(); } getSummaryReport(); @@ -1019,7 +1019,7 @@ int ScreenSeqsCommand::screenFasta(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true); nameMap = ct.getNameMap(); } getSummary(positions); @@ -2206,7 +2206,7 @@ int ScreenSeqsCommand::screenCountFile(map badSeqNames){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(goodCountFile)) { - ct.readTable(goodCountFile); + ct.readTable(goodCountFile, true); ct.printTable(goodCountFile); } diff --git a/secondarystructurecommand.cpp b/secondarystructurecommand.cpp index c1cdb6b..3354665 100644 --- a/secondarystructurecommand.cpp +++ b/secondarystructurecommand.cpp @@ -200,7 +200,7 @@ int AlignCheckCommand::execute(){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, false); nameMap = ct.getNameMap(); } diff --git a/seqerrorcommand.cpp b/seqerrorcommand.cpp index 203a71e..54d3dcc 100644 --- a/seqerrorcommand.cpp +++ b/seqerrorcommand.cpp @@ -358,7 +358,7 @@ int SeqErrorCommand::execute(){ if(namesFileName != "") { weights = getWeights(); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, false); weights = ct.getNameMap(); } diff --git a/seqsummarycommand.cpp b/seqsummarycommand.cpp index 6d8336c..27bb8d9 100644 --- a/seqsummarycommand.cpp +++ b/seqsummarycommand.cpp @@ -203,7 +203,7 @@ int SeqSummaryCommand::execute(){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, false); nameMap = ct.getNameMap(); } diff --git a/sequencecountparser.cpp b/sequencecountparser.cpp index 1300c0f..37eb4e7 100644 --- a/sequencecountparser.cpp +++ b/sequencecountparser.cpp @@ -16,7 +16,7 @@ SequenceCountParser::SequenceCountParser(string countfile, string fastafile) { //read count file CountTable countTable; - countTable.readTable(countfile); + countTable.readTable(countfile, true); //initialize maps namesOfGroups = countTable.getNamesOfGroups(); diff --git a/sharedcommand.cpp b/sharedcommand.cpp index 91ca1a1..8d5d89c 100644 --- a/sharedcommand.cpp +++ b/sharedcommand.cpp @@ -766,7 +766,7 @@ int SharedCommand::createSharedFromListGroup(string filename) { m->setAllGroups(allGroups); }else{ countTable = new CountTable(); - countTable->readTable(countfile); + countTable->readTable(countfile, true); } if (m->control_pressed) { return 0; } diff --git a/sharedlistvector.cpp b/sharedlistvector.cpp index 223ca07..0ee2f79 100644 --- a/sharedlistvector.cpp +++ b/sharedlistvector.cpp @@ -32,7 +32,7 @@ SharedListVector::SharedListVector(ifstream& f) : DataVector(), maxRank(0), numB groupmap->readMap(); }else { countTable = new CountTable(); - countTable->readTable(m->getCountTableFile()); + countTable->readTable(m->getCountTableFile(), true); } int hold; diff --git a/splitabundcommand.cpp b/splitabundcommand.cpp index 2d37e8d..580493b 100644 --- a/splitabundcommand.cpp +++ b/splitabundcommand.cpp @@ -212,7 +212,7 @@ SplitAbundCommand::SplitAbundCommand(string option) { else if (countfile == "not found") { countfile = ""; } else { m->setCountTableFile(countfile); - ct.readTable(countfile); + ct.readTable(countfile, true); } if ((namefile != "") && (countfile != "")) { diff --git a/splitgroupscommand.cpp b/splitgroupscommand.cpp index 238eda5..c15ba3a 100644 --- a/splitgroupscommand.cpp +++ b/splitgroupscommand.cpp @@ -320,7 +320,7 @@ int SplitGroupCommand::runCount(){ try { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true); if (!ct.hasGroupInfo()) { m->mothurOut("[ERROR]: your count file does not contain group info, cannot split by group.\n"); m->control_pressed = true; } if (m->control_pressed) { return 0; } diff --git a/subsamplecommand.cpp b/subsamplecommand.cpp index 4128191..fe79fbb 100644 --- a/subsamplecommand.cpp +++ b/subsamplecommand.cpp @@ -273,7 +273,7 @@ SubSampleCommand::SubSampleCommand(string option) { else if (countfile == "not found") { countfile = ""; } else { m->setCountTableFile(countfile); - ct.readTable(countfile); + ct.readTable(countfile, true); } if ((namefile != "") && (countfile != "")) { diff --git a/summaryqualcommand.cpp b/summaryqualcommand.cpp index 0f6f719..e1e626e 100644 --- a/summaryqualcommand.cpp +++ b/summaryqualcommand.cpp @@ -196,7 +196,7 @@ int SummaryQualCommand::execute(){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, false); nameMap = ct.getNameMap(); } diff --git a/summarytaxcommand.cpp b/summarytaxcommand.cpp index c76f175..e244863 100644 --- a/summarytaxcommand.cpp +++ b/summarytaxcommand.cpp @@ -223,7 +223,7 @@ int SummaryTaxCommand::execute(){ groupMap->readMap(); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(countfile); + ct->readTable(countfile, true); } PhyloSummary* taxaSum; diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index b793dc8..0119741 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -458,7 +458,7 @@ int TreeGroupCommand::execute(){ readMatrix->read(nameMap); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(countfile); + ct->readTable(countfile, true); readMatrix->read(ct); }else { readMatrix->read(nameMap); diff --git a/treereader.cpp b/treereader.cpp index 0e25f12..8427b56 100644 --- a/treereader.cpp +++ b/treereader.cpp @@ -15,7 +15,7 @@ TreeReader::TreeReader(string tf, string cf) : treefile(tf), countfile(cf) { try { m = MothurOut::getInstance(); ct = new CountTable(); - ct->readTable(cf); + ct->readTable(cf, true); //if no groupinfo in count file we need to add it if (!ct->hasGroupInfo()) { diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp index 5a5d445..81b9111 100644 --- a/trimseqscommand.cpp +++ b/trimseqscommand.cpp @@ -422,7 +422,7 @@ int TrimSeqsCommand::execute(){ if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true); nameCount = ct.getNameMap(); outputNames.push_back(trimCountFile); outputNames.push_back(scrapCountFile); @@ -540,7 +540,7 @@ int TrimSeqsCommand::execute(){ if (countfile != "") { //create countfile with group info included CountTable* ct = new CountTable(); - ct->readTable(trimCountFile); + ct->readTable(trimCountFile, true); map justTrimmedNames = ct->getNameMap(); delete ct; -- 2.39.2