From a935b75dd890da5ae7f09e5e6179f90ab2955348 Mon Sep 17 00:00:00 2001 From: Sarah Westcott Date: Tue, 8 Oct 2013 11:33:50 -0700 Subject: [PATCH] =?utf8?q?added=20otulabels=20to=20heatmap.bin.=20made=20O?= =?utf8?q?TUlabels=20=E2=80=9Csmarter=E2=80=9D=20so=20OTU01=20and=20OTU001?= =?utf8?q?=20are=20recognized=20as=20the=20same.=20fixed=20bug=20with=20ch?= =?utf8?q?imera=20commands=20and=20count=20table=20with=20dereplicate=3Dt.?= =?utf8?q?=20fixed=20compile=20issue=20with=20shhh.flows=20command=20in=20?= =?utf8?q?MPI=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- binsequencecommand.cpp | 2 +- chimeraperseuscommand.cpp | 8 ++-- chimeraperseuscommand.h | 2 +- chimeraslayercommand.cpp | 8 ++-- chimerauchimecommand.cpp | 8 ++-- chimerauchimecommand.h | 2 +- classify.cpp | 9 ++-- classifyotucommand.cpp | 2 +- classifyseqscommand.cpp | 2 +- clustercommand.cpp | 2 +- clusterdoturcommand.cpp | 2 +- clusterfragmentscommand.cpp | 2 +- clustersplitcommand.cpp | 4 +- consensusseqscommand.cpp | 2 +- countgroupscommand.cpp | 2 +- counttable.cpp | 4 +- counttable.h | 2 +- createdatabasecommand.cpp | 4 +- deconvolutecommand.cpp | 2 +- getgroupscommand.cpp | 2 +- getlineagecommand.cpp | 12 +++--- getotulabelscommand.cpp | 14 +++--- getoturepcommand.cpp | 6 +-- getrabundcommand.cpp | 2 +- getsabundcommand.cpp | 2 +- getseqscommand.cpp | 2 +- heatmap.cpp | 81 ++++++++++++++++++++++++----------- heatmap.h | 4 +- heatmapsimcommand.cpp | 2 +- helpcommand.cpp | 2 +- listseqscommand.cpp | 2 +- makebiomcommand.cpp | 5 ++- makecontigscommand.cpp | 5 ++- mgclustercommand.cpp | 2 +- mothurout.cpp | 59 +++++++++++++++++++++++++ mothurout.h | 2 + parselistscommand.cpp | 2 +- prcseqscommand.cpp | 2 +- preclustercommand.cpp | 2 +- primerdesigncommand.cpp | 2 +- removegroupscommand.cpp | 2 +- removelineagecommand.cpp | 12 +++--- removeotulabelscommand.cpp | 14 +++--- removerarecommand.cpp | 2 +- removeseqscommand.cpp | 2 +- screenseqscommand.cpp | 10 ++--- secondarystructurecommand.cpp | 2 +- seqerrorcommand.cpp | 2 +- seqsummarycommand.cpp | 2 +- sequencecountparser.cpp | 2 +- sharedcommand.cpp | 2 +- sharedlistvector.cpp | 2 +- shhhercommand.cpp | 3 +- splitabundcommand.cpp | 2 +- splitgroupscommand.cpp | 2 +- subsamplecommand.cpp | 2 +- summaryqualcommand.cpp | 2 +- summarytaxcommand.cpp | 2 +- treegroupscommand.cpp | 2 +- treereader.cpp | 2 +- trimseqscommand.cpp | 4 +- 61 files changed, 230 insertions(+), 126 deletions(-) diff --git a/binsequencecommand.cpp b/binsequencecommand.cpp index be167d9..f9784b3 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, true); } + if (countfile != "") { ct.readTable(countfile, true, false); } input = new InputData(listfile, "list"); list = input->getListVector(); diff --git a/chimeraperseuscommand.cpp b/chimeraperseuscommand.cpp index cea481b..0547802 100644 --- a/chimeraperseuscommand.cpp +++ b/chimeraperseuscommand.cpp @@ -516,7 +516,7 @@ int ChimeraPerseusCommand::execute(){ if (hasCount) { CountTable* ct = new CountTable(); - ct->readTable(nameFile, true); + ct->readTable(nameFile, true, false); 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, true); + CountTable c; c.readTable(nameFile, true, false); 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, true); + CountTable c; c.readTable(newCountFile, true, 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, true); } + if (hasCount && dups) { newCount.readTable(name, true, false); } //sanity check if (groups.size() < processors) { processors = groups.size(); } diff --git a/chimeraperseuscommand.h b/chimeraperseuscommand.h index b6d4fc9..0d90781 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, true); + ct->readTable(pDataArray->namefile, true, false); cparser = new SequenceCountParser(pDataArray->fastafile, *ct); delete ct; }else { diff --git a/chimeraslayercommand.cpp b/chimeraslayercommand.cpp index f01bd3e..41661da 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], true); + CountTable c; c.readTable(nameFileNames[s], true, false); 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, true); + CountTable c; c.readTable(newCountFile, true, 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, true); } + if (hasCount && dups) { newCount.readTable(countFile, true, false); } 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, true); + ct.readTable(nameFile, true, false); 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 422792a..346afe2 100644 --- a/chimerauchimecommand.cpp +++ b/chimerauchimecommand.cpp @@ -674,7 +674,7 @@ int ChimeraUchimeCommand::execute(){ int error; if (hasCount) { CountTable ct; - ct.readTable(nameFile, true); + ct.readTable(nameFile, true, false); 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, true); + CountTable c; c.readTable(nameFile, true, false); 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, true); + CountTable c; c.readTable(newCountFile, true, 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, true); } + if (hasCount && dups) { newCount.readTable(nameFile, true, false); } //sanity check if (groups.size() < processors) { processors = groups.size(); } diff --git a/chimerauchimecommand.h b/chimerauchimecommand.h index fadc4a4..e98a20d 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, true); + ct->readTable(pDataArray->namefile, true, false); cparser = new SequenceCountParser(pDataArray->fastafile, *ct); delete ct; }else { diff --git a/classify.cpp b/classify.cpp index 5f97c7e..71a9b25 100644 --- a/classify.cpp +++ b/classify.cpp @@ -295,12 +295,13 @@ int Classify::readTaxonomy(string file) { iss >> name; m->gobble(iss); iss >> taxInfo; if (m->debug) { m->mothurOut("[DEBUG]: name = " + name + " tax = " + taxInfo + "\n"); } - if (m->inUsersGroups(name, names)) { + //commented out to save time with large templates. 10/7/13 + //if (m->inUsersGroups(name, names)) { taxonomy[name] = taxInfo; phyloTree->addSeqToTree(name, taxInfo); - }else { - m->mothurOut("[WARNING]: " + name + " is in your taxonomy file and not in your reference file, ignoring.\n"); - } + //}else { + // m->mothurOut("[WARNING]: " + name + " is in your taxonomy file and not in your reference file, ignoring.\n"); + //} } MPI_File_close(&inMPI); diff --git a/classifyotucommand.cpp b/classifyotucommand.cpp index 76d7504..217bc86 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, true); 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 diff --git a/classifyseqscommand.cpp b/classifyseqscommand.cpp index b311821..1b56433 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], true); + ct->readTable(countfileNames[s], true, false); taxaSum = new PhyloSummary(taxonomyFileName, ct); taxaSum->summarize(tempTaxonomyFile); }else { diff --git a/clustercommand.cpp b/clustercommand.cpp index 9412965..c1ac5bb 100644 --- a/clustercommand.cpp +++ b/clustercommand.cpp @@ -315,7 +315,7 @@ int ClusterCommand::execute(){ read->read(nameMap); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(countfile, false); + ct->readTable(countfile, false, false); read->read(ct); }else { read->read(nameMap); } diff --git a/clusterdoturcommand.cpp b/clusterdoturcommand.cpp index 08a5938..96bfc5c 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, false); + ct->readTable(countfile, false, false); cluster->readPhylipFile(phylipfile, ct); delete ct; }else { diff --git a/clusterfragmentscommand.cpp b/clusterfragmentscommand.cpp index 9c1408c..4b5c67f 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, true); m->setCountTableFile(countfile); } + else { ct.readTable(countfile, true, 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 95693cc..b5dc969 100644 --- a/clustersplitcommand.cpp +++ b/clustersplitcommand.cpp @@ -1174,7 +1174,7 @@ string ClusterSplitCommand::clusterClassicFile(string thisDistFile, string thisN cluster->readPhylipFile(thisDistFile, nameMap); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(thisNamefile, false); + ct->readTable(thisNamefile, false, false); cluster->readPhylipFile(thisDistFile, ct); } tag = cluster->getTag(); @@ -1302,7 +1302,7 @@ string ClusterSplitCommand::clusterFile(string thisDistFile, string thisNamefile read->read(nameMap); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(thisNamefile, false); + ct->readTable(thisNamefile, false, false); read->read(ct); }else { read->read(nameMap); } diff --git a/consensusseqscommand.cpp b/consensusseqscommand.cpp index 3d671f9..fbec746 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, true); } + if (countfile != "") { ct.readTable(countfile, true, false); } if (m->control_pressed) { return 0; } diff --git a/countgroupscommand.cpp b/countgroupscommand.cpp index 83c2d31..ce3358e 100644 --- a/countgroupscommand.cpp +++ b/countgroupscommand.cpp @@ -261,7 +261,7 @@ int CountGroupsCommand::execute(){ m->openOutputFile(outputFileName, out); CountTable ct; - ct.readTable(countfile, true); + ct.readTable(countfile, true, false); //make sure groups are valid //takes care of user setting groupNames that are invalid or setting groups=all diff --git a/counttable.cpp b/counttable.cpp index 0e9eec3..d5720ac 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, bool readGroups) { +int CountTable::readTable(string file, bool readGroups, bool mothurRunning) { try { filename = file; ifstream in; @@ -246,7 +246,7 @@ int CountTable::readTable(string file, bool readGroups) { in >> name; m->gobble(in); in >> thisTotal; m->gobble(in); if (m->debug) { m->mothurOut("[DEBUG]: " + name + '\t' + toString(thisTotal) + "\n"); } - if (thisTotal == 0) { error=true; m->mothurOut("[ERROR]: Your count table contains a sequence named " + name + " with a total=0. Please correct."); m->mothurOutEndLine(); + if ((thisTotal == 0) && !mothurRunning) { error=true; m->mothurOut("[ERROR]: Your count table contains a sequence named " + name + " with a total=0. Please correct."); m->mothurOutEndLine(); } //if group info, then read it diff --git a/counttable.h b/counttable.h index 51d0b45..c0ced35 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, bool); + int readTable(string, bool, bool); int printTable(string); int printHeaders(ofstream&); diff --git a/createdatabasecommand.cpp b/createdatabasecommand.cpp index eab7c82..235682b 100644 --- a/createdatabasecommand.cpp +++ b/createdatabasecommand.cpp @@ -298,7 +298,7 @@ int CreateDatabaseCommand::execute(){ } repNames = tempRepNames; }else { - ct.readTable(countfile, true); + ct.readTable(countfile, true, false); numUniqueNamesFile = ct.getNumUniqueSeqs(); nameMap = ct.getNameMap(); } @@ -506,7 +506,7 @@ int CreateDatabaseCommand::findIndex(vector& otuLabels, string label){ try { int index = -1; for (int i = 0; i < otuLabels.size(); i++) { - if (otuLabels[i] == label) { index = i; break; } + if (m->isLabelEquivalent(otuLabels[i],label)) { index = i; break; } } return index; } diff --git a/deconvolutecommand.cpp b/deconvolutecommand.cpp index 51fa43b..98109ef 100644 --- a/deconvolutecommand.cpp +++ b/deconvolutecommand.cpp @@ -209,7 +209,7 @@ int DeconvoluteCommand::execute() { } CountTable ct; if (countfile != "") { - ct.readTable(countfile, true); + ct.readTable(countfile, true, false); if (countfile == outCountFile){ //prepare filenames and open files map mvariables; diff --git a/getgroupscommand.cpp b/getgroupscommand.cpp index 45e0a78..15dcbba 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, true); + ct.readTable(countfile, true, false); 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 005a89f..862aef7 100644 --- a/getlineagecommand.cpp +++ b/getlineagecommand.cpp @@ -514,7 +514,7 @@ int GetLineageCommand::readCount(){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(outputFileName)) { - ct.readTable(outputFileName, true); + ct.readTable(outputFileName, true, false); ct.printTable(outputFileName); } @@ -628,7 +628,7 @@ int GetLineageCommand::readConsList(){ } otuLabel += sbinNumber; - if (names.count(otuLabel) != 0) { + if (names.count(m->getSimpleLabel(otuLabel)) != 0) { selectedCount++; newList.push_back(list->get(i)); } @@ -767,7 +767,7 @@ int GetLineageCommand::readShared(){ if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) { delete newLookup[j]; } for (int j = 0; j < lookup.size(); j++) { delete lookup[j]; } return 0; } //is this otu on the list - if (names.count(m->currentBinLabels[i]) != 0) { + if (names.count(m->getSimpleLabel(m->currentBinLabels[i])) != 0) { numSelected++; wroteSomething = true; newLabels.push_back(m->currentBinLabels[i]); for (int j = 0; j < newLookup.size(); j++) { //add this OTU to the new lookup @@ -1241,7 +1241,7 @@ int GetLineageCommand::readConsTax(){ int pos = newtax.find(noConfidenceTaxons[j]); if (pos != string::npos) { //this sequence contains the taxon the user wants - names.insert(otuLabel); + names.insert(m->getSimpleLabel(otuLabel)); out << otuLabel << '\t' << numReps << '\t' << tax << endl; //since you belong to at least one of the taxons we want you are included so no need to search for other break; @@ -1253,7 +1253,7 @@ int GetLineageCommand::readConsTax(){ int pos = newtax.find(noConfidenceTaxons[j]); if (pos != string::npos) { //this sequence contains the taxon the user wants - names.insert(otuLabel); + names.insert(m->getSimpleLabel(otuLabel)); out << otuLabel << '\t' << numReps << '\t' << tax << endl; //since you belong to at least one of the taxons we want you are included so no need to search for other break; @@ -1309,7 +1309,7 @@ int GetLineageCommand::readConsTax(){ //passed the test so add you if (good) { - names.insert(otuLabel); + names.insert(m->getSimpleLabel(otuLabel)); out << otuLabel << '\t' << numReps << '\t' << tax << endl; break; } diff --git a/getotulabelscommand.cpp b/getotulabelscommand.cpp index b6253b0..00297e2 100644 --- a/getotulabelscommand.cpp +++ b/getotulabelscommand.cpp @@ -234,6 +234,10 @@ int GetOtuLabelsCommand::execute(){ //get labels you want to keep labels = m->readAccnos(accnosfile); + //simplfy labels + set newLabels; + for (set::iterator it = labels.begin(); it != labels.end(); it++) { newLabels.insert(m->getSimpleLabel(*it)); } + labels = newLabels; if (m->control_pressed) { return 0; } @@ -302,7 +306,7 @@ int GetOtuLabelsCommand::readClassifyOtu(){ in >> otu >> size >> tax; m->gobble(in); - if (labels.count(otu) != 0) { + if (labels.count(m->getSimpleLabel(otu)) != 0) { wroteSomething = true; selectedCount++; @@ -357,7 +361,7 @@ int GetOtuLabelsCommand::readOtuAssociation(){ in >> otu1 >> otu2; string line = m->getline(in); m->gobble(in); - if ((labels.count(otu1) != 0) && (labels.count(otu2) != 0)){ + if ((labels.count(m->getSimpleLabel(otu1)) != 0) && (labels.count(m->getSimpleLabel(otu2)) != 0)){ wroteSomething = true; selectedCount++; @@ -412,7 +416,7 @@ int GetOtuLabelsCommand::readCorrAxes(){ in >> otu; string line = m->getline(in); m->gobble(in); - if (labels.count(otu) != 0) { + if (labels.count(m->getSimpleLabel(otu)) != 0) { wroteSomething = true; selectedCount++; @@ -461,7 +465,7 @@ int GetOtuLabelsCommand::readShared(){ if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) { delete newLookup[j]; } for (int j = 0; j < lookup.size(); j++) { delete lookup[j]; } return 0; } //is this otu on the list - if (labels.count(m->currentBinLabels[i]) != 0) { + if (labels.count(m->getSimpleLabel(m->currentBinLabels[i])) != 0) { numSelected++; wroteSomething = true; newLabels.push_back(m->currentBinLabels[i]); for (int j = 0; j < newLookup.size(); j++) { //add this OTU to the new lookup @@ -532,7 +536,7 @@ int GetOtuLabelsCommand::readList(){ } otuLabel += sbinNumber; - if (labels.count(otuLabel) != 0) { + if (labels.count(m->getSimpleLabel(otuLabel)) != 0) { selectedCount++; newList.push_back(list->get(i)); } diff --git a/getoturepcommand.cpp b/getoturepcommand.cpp index d476cc3..7e71a1a 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, true); + ct.readTable(countfile, true, false); if (ct.hasGroupInfo()) { hasGroups = true; } } @@ -1106,7 +1106,7 @@ int GetOTURepCommand::processFastaNames(string filename, string label, FastaMap* CountTable thisCt; if (countfile != "") { - thisCt.readTable(countfile, true); + thisCt.readTable(countfile, true, false); 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, true); + thisCt.readTable(countfile, true, false); if (tempGroup != "noGroup") { out2 << "Representative_Sequence\ttotal\t" << tempGroup << endl; } } diff --git a/getrabundcommand.cpp b/getrabundcommand.cpp index da1bfae..469117c 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, false); + ct.readTable(countfile, false, false); InputData input(inputfile, format); ListVector* list = input.getListVector(); diff --git a/getsabundcommand.cpp b/getsabundcommand.cpp index f4838cf..22abde5 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, false); + ct.readTable(countfile, false, false); InputData input(inputfile, format); ListVector* list = input.getListVector(); diff --git a/getseqscommand.cpp b/getseqscommand.cpp index 83fdf73..82f9710 100644 --- a/getseqscommand.cpp +++ b/getseqscommand.cpp @@ -589,7 +589,7 @@ int GetSeqsCommand::readCount(){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(outputFileName)) { - ct.readTable(outputFileName, true); + ct.readTable(outputFileName, true, false); ct.printTable(outputFileName); } diff --git a/heatmap.cpp b/heatmap.cpp index 36665ff..367342c 100644 --- a/heatmap.cpp +++ b/heatmap.cpp @@ -119,7 +119,8 @@ string HeatMap::getPic(vector lookup) { } //sort lookup so shared bins are on top - if (sorted != "none") { sortSharedVectors(lookup); } + vector sortedLabels = m->currentBinLabels; + if (sorted != "none") { sortedLabels = sortSharedVectors(lookup); } vector > scaleRelAbund; vector maxRelAbund(lookup[0]->size(), 0.0); @@ -158,36 +159,46 @@ string HeatMap::getPic(vector lookup) { string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + lookup[0]->getLabel() + ".heatmap.bin.svg"; m->openOutputFile(filenamesvg, outsvg); + int binHeight = 20; + int labelBump = 100; + int binWidth = 300; //svg image - outsvg << "\n"; + outsvg << "\n"; outsvg << "\n"; //white backround - outsvg << ""; + outsvg << ""; outsvg << "Heatmap at distance " + lookup[0]->getLabel() + "\n"; //column labels - for (int h = 0; h < lookup.size(); h++) { - outsvg << "getGroup().length() / 2)) + "\" y=\"50\">" + lookup[h]->getGroup() + "\n"; + for (int h = 0; h < lookup.size()+1; h++) { + if (h == 0) { + string tempLabel = "OTU"; + outsvg << "" + tempLabel + "\n"; + }else { + outsvg << "getGroup().length() / 2)+labelBump/2) + "\" y=\"50\">" + lookup[h-1]->getGroup() + "\n"; + } } //output legend and color labels string color; int x = 0; - int y = 103 + (numBinsToDisplay*5); + int y = 103 + (numBinsToDisplay*binHeight); printLegend(y, superMaxRelAbund); y = 70; for (int i = 0; i < numBinsToDisplay; i++) { + outsvg << "" + sortedLabels[i] + "\n"; + x += labelBump; for (int j = 0; j < scaleRelAbund.size(); j++) { if (m->control_pressed) { outsvg.close(); return "control"; } - outsvg << "\n"; - x += 300; + outsvg << "\n"; + x += binWidth; } x = 0; - y += 5; + y += binHeight; } outsvg << "\n\n"; @@ -203,12 +214,14 @@ string HeatMap::getPic(vector lookup) { } //********************************************************************************************************************** -int HeatMap::sortSharedVectors(vector& lookup){ +vector HeatMap::sortSharedVectors(vector& lookup){ try { vector looktemp; map place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2. map::iterator it; + + vector sortedLabels = m->currentBinLabels; /****************** find order of otus **********************/ if (sorted == "shared") { @@ -217,7 +230,7 @@ int HeatMap::sortSharedVectors(vector& lookup){ place = orderTopOtu(lookup); }else if (sorted == "topgroup") { place = orderTopGroup(lookup); - }else { m->mothurOut("Error: invalid sort option."); m->mothurOutEndLine(); return 1; } + }else { m->mothurOut("Error: invalid sort option."); m->mothurOutEndLine(); return sortedLabels; } /******************* create copy of lookup *********************/ @@ -241,6 +254,7 @@ int HeatMap::sortSharedVectors(vector& lookup){ int newAbund = looktemp[j]->getAbundance(i); // 1 -> 3 lookup[j]->set(place[i], newAbund, looktemp[j]->getGroup()); //binNumber, abundance, group } + sortedLabels[place[i]] = m->currentBinLabels[i]; } //delete looktemp -- Sarah look at - this is causing segmentation faults @@ -248,7 +262,7 @@ int HeatMap::sortSharedVectors(vector& lookup){ // delete looktemp[j]; } - return 0; + return sortedLabels; } catch(exception& e) { @@ -416,7 +430,8 @@ string HeatMap::getPic(vector lookup) { } //sort lookup so shared bins are on top - if (sorted != "none") { sortSharedVectors(lookup); } + vector sortedLabels = m->currentBinLabels; + if (sorted != "none") { sortedLabels = sortSharedVectors(lookup); } vector > scaleRelAbund; vector maxRelAbund(lookup.size(), 0.0); @@ -455,36 +470,47 @@ string HeatMap::getPic(vector lookup) { string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + lookup[0]->getLabel() + ".heatmap.bin.svg"; m->openOutputFile(filenamesvg, outsvg); + + int binHeight = 20; + int labelBump = 100; + int binWidth = 300; //svg image - outsvg << "\n"; + outsvg << "\n"; outsvg << "\n"; //white backround - outsvg << ""; + outsvg << ""; outsvg << "Heatmap at distance " + lookup[0]->getLabel() + "\n"; //column labels - for (int h = 0; h < lookup.size(); h++) { - outsvg << "getGroup().length() / 2)) + "\" y=\"50\">" + lookup[h]->getGroup() + "\n"; - } - + for (int h = 0; h < lookup.size()+1; h++) { + if (h == 0) { + string tempLabel = "OTU"; + outsvg << "" + tempLabel + "\n"; + }else { + outsvg << "getGroup().length() / 2)+labelBump/2) + "\" y=\"50\">" + lookup[h-1]->getGroup() + "\n"; + } + } + //output legend and color labels string color; int x = 0; - int y = 103 + (numBinsToDisplay*5); + int y = 103 + (numBinsToDisplay*binHeight); printLegend(y, superMaxRelAbund); y = 70; for (int i = 0; i < numBinsToDisplay; i++) { + outsvg << "" + sortedLabels[i] + "\n"; + x += labelBump; for (int j = 0; j < scaleRelAbund.size(); j++) { if (m->control_pressed) { outsvg.close(); return "control"; } - outsvg << "\n"; - x += 300; + outsvg << "\n"; + x += binWidth; } x = 0; - y += 5; + y += binHeight; } outsvg << "\n\n"; @@ -499,12 +525,14 @@ string HeatMap::getPic(vector lookup) { } } //********************************************************************************************************************** -int HeatMap::sortSharedVectors(vector& lookup){ +vector HeatMap::sortSharedVectors(vector& lookup){ try { vector looktemp; map place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2. map::iterator it; + + vector sortedLabels = m->currentBinLabels; /****************** find order of otus **********************/ if (sorted == "shared") { @@ -513,7 +541,7 @@ int HeatMap::sortSharedVectors(vector& lookup){ place = orderTopOtu(lookup); }else if (sorted == "topgroup") { place = orderTopGroup(lookup); - }else { m->mothurOut("Error: invalid sort option."); m->mothurOutEndLine(); return 1; } + }else { m->mothurOut("Error: invalid sort option."); m->mothurOutEndLine(); return sortedLabels; } /******************* create copy of lookup *********************/ @@ -536,6 +564,7 @@ int HeatMap::sortSharedVectors(vector& lookup){ for (int j = 0; j < looktemp.size(); j++) { // 3 -> 2 float newAbund = looktemp[j]->getAbundance(i); // 1 -> 3 lookup[j]->set(place[i], newAbund, looktemp[j]->getGroup()); //binNumber, abundance, group + sortedLabels[place[i]] = m->currentBinLabels[i]; } } @@ -544,7 +573,7 @@ int HeatMap::sortSharedVectors(vector& lookup){ // delete looktemp[j]; } - return 0; + return sortedLabels; } catch(exception& e) { diff --git a/heatmap.h b/heatmap.h index 2b49176..922147c 100644 --- a/heatmap.h +++ b/heatmap.h @@ -51,8 +51,8 @@ class HeatMap { string getPic(vector); private: - int sortSharedVectors(vector& ); - int sortSharedVectors(vector& ); + vector sortSharedVectors(vector& ); + vector sortSharedVectors(vector& ); int sortRabund(RAbundVector*&); void printLegend(int, float); diff --git a/heatmapsimcommand.cpp b/heatmapsimcommand.cpp index 01a60ae..14c5530 100644 --- a/heatmapsimcommand.cpp +++ b/heatmapsimcommand.cpp @@ -543,7 +543,7 @@ int HeatMapSimCommand::runCommandDist() { } }else if (countfile != "") { nameMap = NULL; - ct.readTable(countfile, true); + ct.readTable(countfile, true, false); names = ct.getNamesOfSeqs(); } diff --git a/helpcommand.cpp b/helpcommand.cpp index 47d04f9..ef54dae 100644 --- a/helpcommand.cpp +++ b/helpcommand.cpp @@ -17,7 +17,7 @@ HelpCommand::HelpCommand(string option) { //********************************************************************************************************************** int HelpCommand::execute(){ try { - validCommands->printCommands(cout); + validCommands->printCommands(cout); m->mothurOut("For more information about a specific command type 'commandName(help)' i.e. 'read.dist(help)'"); m->mothurOutEndLine(); m->mothurOutEndLine(); m->mothurOut("For further assistance please refer to the Mothur manual on our wiki at http://www.mothur.org/wiki, or contact Pat Schloss at mothur.bugs@gmail.com.\n"); diff --git a/listseqscommand.cpp b/listseqscommand.cpp index cf88470..343d4fd 100644 --- a/listseqscommand.cpp +++ b/listseqscommand.cpp @@ -415,7 +415,7 @@ int ListSeqsCommand::readGroup(){ int ListSeqsCommand::readCount(){ try { CountTable ct; - ct.readTable(countfile, false); + ct.readTable(countfile, false, false); if (m->control_pressed) { return 0; } diff --git a/makebiomcommand.cpp b/makebiomcommand.cpp index 7cf8295..248b3c8 100644 --- a/makebiomcommand.cpp +++ b/makebiomcommand.cpp @@ -596,8 +596,9 @@ vector MakeBiomCommand::getMetaData(vector& lookup, for (int h = 0; h < diff; h++) { binLabel += "0"; } } binLabel += sbinNumber; + binLabel = m->getSimpleLabel(binLabel); labelTaxMap[binLabel] = taxs[i]; - }else { labelTaxMap[otuLabels[i]] = taxs[i]; } + }else { labelTaxMap[m->getSimpleLabel(otuLabels[i])] = taxs[i]; } } @@ -610,7 +611,7 @@ vector MakeBiomCommand::getMetaData(vector& lookup, if (m->control_pressed) { return metadata; } - it = labelTaxMap.find(m->currentBinLabels[i]); + it = labelTaxMap.find(m->getSimpleLabel(m->currentBinLabels[i])); if (it == labelTaxMap.end()) { m->mothurOut("[ERROR]: can't find taxonomy information for " + m->currentBinLabels[i] + ".\n"); m->control_pressed = true; } else { diff --git a/makecontigscommand.cpp b/makecontigscommand.cpp index 0bf56e7..87027f4 100644 --- a/makecontigscommand.cpp +++ b/makecontigscommand.cpp @@ -1042,7 +1042,9 @@ int MakeContigsCommand::driver(vector files, string outputFasta, string if (seq2End < overlapEnd) { overlapEnd = seq2End; } //smallest end position is where overlapping ends int oStart = contig.length(); + //cout << fSeq.getAligned() << endl; cout << rSeq.getAligned() << endl; for (int i = overlapStart; i < overlapEnd; i++) { + //cout << seq1[i] << ' ' << seq2[i] << ' ' << scores1[ABaseMap[i]] << ' ' << scores2[BBaseMap[i]] << endl; if (seq1[i] == seq2[i]) { //match, add base and choose highest score contig += seq1[i]; }else if (((seq1[i] == '.') || (seq1[i] == '-')) && ((seq2[i] != '-') && (seq2[i] != '.'))) { //seq1 is a gap and seq2 is a base, choose seq2, unless quality score for base is below insert. In that case eliminate base @@ -1076,7 +1078,8 @@ int MakeContigsCommand::driver(vector files, string outputFasta, string }else { //seq2 ends before seq1 so take from overlap to length from seq1 for (int i = overlapEnd; i < length; i++) { contig += seq1[i]; } } - + //cout << contig << endl; + //exit(1); if (trimOverlap) { contig = contig.substr(overlapStart-1, oend-oStart); if (contig.length() == 0) { trashCode += "l"; } } if(trashCode.length() == 0){ diff --git a/mgclustercommand.cpp b/mgclustercommand.cpp index 97f0afd..85db5e0 100644 --- a/mgclustercommand.cpp +++ b/mgclustercommand.cpp @@ -240,7 +240,7 @@ int MGClusterCommand::execute(){ nameMap->readMap(); }else if (countfile != "") { ct = new CountTable(); - ct->readTable(countfile, false); + ct->readTable(countfile, false, false); nameMap= new NameAssignment(); vector tempNames = ct->getNamesOfSeqs(); for (int i = 0; i < tempNames.size(); i++) { nameMap->push_back(tempNames[i]); } diff --git a/mothurout.cpp b/mothurout.cpp index 713bafd..3d4504d 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -2599,6 +2599,65 @@ int MothurOut::getNumChar(string line, char c){ exit(1); } } +/***********************************************************************/ +string MothurOut::getSimpleLabel(string label){ + try { + string simple = ""; + + //remove OTU or phylo tag + string newLabel1 = ""; + for (int i = 0; i < label.length(); i++) { + if(label[i]>47 && label[i]<58) { //is a digit + newLabel1 += label[i]; + } + } + + int num1; + mothurConvert(newLabel1, num1); + + simple = toString(num1); + + return simple; + } + catch(exception& e) { + errorOut(e, "MothurOut", "isLabelEquivalent"); + exit(1); + } +} +/***********************************************************************/ + +bool MothurOut::isLabelEquivalent(string label1, string label2){ + try { + bool same = false; + + //remove OTU or phylo tag + string newLabel1 = ""; + for (int i = 0; i < label1.length(); i++) { + if(label1[i]>47 && label1[i]<58) { //is a digit + newLabel1 += label1[i]; + } + } + + string newLabel2 = ""; + for (int i = 0; i < label2.length(); i++) { + if(label2[i]>47 && label2[i]<58) { //is a digit + newLabel2 += label2[i]; + } + } + + int num1, num2; + mothurConvert(newLabel1, num1); + mothurConvert(newLabel2, num2); + + if (num1 == num2) { same = true; } + + return same; + } + catch(exception& e) { + errorOut(e, "MothurOut", "isLabelEquivalent"); + exit(1); + } +} //********************************************************************************************************************** bool MothurOut::isSubset(vector bigset, vector subset) { try { diff --git a/mothurout.h b/mothurout.h index 9987374..f58f4e8 100644 --- a/mothurout.h +++ b/mothurout.h @@ -138,6 +138,8 @@ class MothurOut { bool isTrue(string); bool isContainingOnlyDigits(string); bool isNumeric1(string); + bool isLabelEquivalent(string, string); + string getSimpleLabel(string); string findEdianness(); diff --git a/parselistscommand.cpp b/parselistscommand.cpp index 5a568f3..32a7e08 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, true); + ct.readTable(countfile, true, false); 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 8a8db37..cb8dd49 100644 --- a/prcseqscommand.cpp +++ b/prcseqscommand.cpp @@ -1275,7 +1275,7 @@ int PcrSeqsCommand::readCount(set badSeqNames){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(goodCountFile)) { - ct.readTable(goodCountFile, true); + ct.readTable(goodCountFile, true, false); ct.printTable(goodCountFile); } diff --git a/preclustercommand.cpp b/preclustercommand.cpp index bd3f172..fbbe4bb 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, true); + ct.readTable(countfile, true, false); if (ct.hasGroupInfo()) { bygroup = true; } else { bygroup = false; } } diff --git a/primerdesigncommand.cpp b/primerdesigncommand.cpp index 195adf4..960da85 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, false); + ct.readTable(countfile, false, false); vector namesOfSeqs = ct.getNamesOfSeqs(); numSeqs = ct.getNumUniqueSeqs(); diff --git a/removegroupscommand.cpp b/removegroupscommand.cpp index 64f9ab6..9eefa43 100644 --- a/removegroupscommand.cpp +++ b/removegroupscommand.cpp @@ -377,7 +377,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, true); + ct.readTable(countfile, true, false); 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 66bbc17..01f45ca 100644 --- a/removelineagecommand.cpp +++ b/removelineagecommand.cpp @@ -665,7 +665,7 @@ int RemoveLineageCommand::readCount(){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(outputFileName)) { - ct.readTable(outputFileName, true); + ct.readTable(outputFileName, true, false); ct.printTable(outputFileName); } @@ -705,7 +705,7 @@ int RemoveLineageCommand::readConsList(){ } otuLabel += sbinNumber; - if (names.count(otuLabel) == 0) { + if (names.count(m->getSimpleLabel(otuLabel)) == 0) { newList.push_back(list->get(i)); }else { removedCount++; } } @@ -843,7 +843,7 @@ int RemoveLineageCommand::readShared(){ if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) { delete newLookup[j]; } for (int j = 0; j < lookup.size(); j++) { delete lookup[j]; } return 0; } //is this otu on the list - if (names.count(m->currentBinLabels[i]) == 0) { + if (names.count(m->getSimpleLabel(m->currentBinLabels[i])) == 0) { wroteSomething = true; newLabels.push_back(m->currentBinLabels[i]); for (int j = 0; j < newLookup.size(); j++) { //add this OTU to the new lookup @@ -1242,7 +1242,7 @@ int RemoveLineageCommand::readConsTax(){ //wroteSomething = true; //out << name << '\t' << tax << endl; }else{ //this sequence contains the taxon the user wants to remove - names.insert(otuLabel); + names.insert(m->getSimpleLabel(otuLabel)); remove=true; break; } @@ -1256,7 +1256,7 @@ int RemoveLineageCommand::readConsTax(){ //wroteSomething = true; //out << name << '\t' << tax << endl; }else{ //this sequence contains the taxon the user wants to remove - names.insert(otuLabel); + names.insert(m->getSimpleLabel(otuLabel)); remove=true; break; } }else { //both have confidences so we want to make sure the users confidences are greater then or equal to the taxons @@ -1309,7 +1309,7 @@ int RemoveLineageCommand::readConsTax(){ //passed the test so remove you if (remove) { - names.insert(otuLabel); + names.insert(m->getSimpleLabel(otuLabel)); remove=true; break; }else { //wroteSomething = true; diff --git a/removeotulabelscommand.cpp b/removeotulabelscommand.cpp index fa98b86..161c4bf 100644 --- a/removeotulabelscommand.cpp +++ b/removeotulabelscommand.cpp @@ -234,6 +234,10 @@ int RemoveOtuLabelsCommand::execute(){ //get labels you want to keep labels = m->readAccnos(accnosfile); + //simplfy labels + set newLabels; + for (set::iterator it = labels.begin(); it != labels.end(); it++) { newLabels.insert(m->getSimpleLabel(*it)); } + labels = newLabels; if (m->debug) { m->mothurOut("[DEBUG]: numlabels = " + toString(labels.size()) + "\n"); } @@ -305,7 +309,7 @@ int RemoveOtuLabelsCommand::readClassifyOtu(){ if (m->debug) { m->mothurOut("[DEBUG]: " + otu + toString(size) + tax + "\n"); } - if (labels.count(otu) == 0) { + if (labels.count(m->getSimpleLabel(otu)) == 0) { wroteSomething = true; out << otu << '\t' << size << '\t' << tax << endl; }else { removedCount++; } @@ -357,7 +361,7 @@ int RemoveOtuLabelsCommand::readOtuAssociation(){ in >> otu1 >> otu2; string line = m->getline(in); m->gobble(in); - if ((labels.count(otu1) == 0) && (labels.count(otu2) == 0)){ + if ((labels.count(m->getSimpleLabel(otu1)) == 0) && (labels.count(m->getSimpleLabel(otu2)) == 0)){ wroteSomething = true; out << otu1 << '\t' << otu2 << '\t' << line << endl; @@ -410,7 +414,7 @@ int RemoveOtuLabelsCommand::readCorrAxes(){ in >> otu; string line = m->getline(in); m->gobble(in); - if (labels.count(otu) == 0) { + if (labels.count(m->getSimpleLabel(otu)) == 0) { wroteSomething = true; out << otu << '\t' << line << endl; @@ -458,7 +462,7 @@ int RemoveOtuLabelsCommand::readShared(){ if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) { delete newLookup[j]; } for (int j = 0; j < lookup.size(); j++) { delete lookup[j]; } return 0; } //is this otu on the list - if (labels.count(m->currentBinLabels[i]) == 0) { + if (labels.count(m->getSimpleLabel(m->currentBinLabels[i])) == 0) { wroteSomething = true; newLabels.push_back(m->currentBinLabels[i]); for (int j = 0; j < newLookup.size(); j++) { //add this OTU to the new lookup @@ -529,7 +533,7 @@ int RemoveOtuLabelsCommand::readList(){ } otuLabel += sbinNumber; - if (labels.count(otuLabel) == 0) { + if (labels.count(m->getSimpleLabel(otuLabel)) == 0) { newList.push_back(list->get(i)); }else { removedCount++; } } diff --git a/removerarecommand.cpp b/removerarecommand.cpp index a551681..2eb5f63 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, true); + ct.readTable(countfile, true, false); if (ct.hasGroupInfo()) { vector namesGroups = ct.getNamesOfGroups(); SharedUtil util; diff --git a/removeseqscommand.cpp b/removeseqscommand.cpp index b1bc4fd..fa7e6dd 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, true); + ct.readTable(outputFileName, true, false); ct.printTable(outputFileName); } diff --git a/screenseqscommand.cpp b/screenseqscommand.cpp index e40c412..a56b0eb 100644 --- a/screenseqscommand.cpp +++ b/screenseqscommand.cpp @@ -14,7 +14,7 @@ vector ScreenSeqsCommand::setParameters(){ try { CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none","fasta",false,true,true); parameters.push_back(pfasta); - CommandParameter pcontigsreport("contigsreport", "InputTypes", "", "", "report", "none", "none","contigsreport",false,true,true); parameters.push_back(pcontigsreport); + CommandParameter pcontigsreport("contigsreport", "InputTypes", "", "", "report", "none", "none","contigsreport",false,false,true); parameters.push_back(pcontigsreport); CommandParameter palignreport("alignreport", "InputTypes", "", "", "report", "none", "none","alignreport",false,false); parameters.push_back(palignreport); CommandParameter psummary("summary", "InputTypes", "", "", "report", "none", "none","summary",false,false); parameters.push_back(psummary); CommandParameter pname("name", "InputTypes", "", "", "NameCount", "none", "none","name",false,false,true); parameters.push_back(pname); @@ -683,7 +683,7 @@ int ScreenSeqsCommand::screenReports(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile, true); + ct.readTable(countfile, true, false); 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, true); + ct.readTable(countfile, true, false); 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, true); + ct.readTable(countfile, true, false); nameMap = ct.getNameMap(); } getSummary(positions); @@ -2205,7 +2205,7 @@ int ScreenSeqsCommand::screenCountFile(map badSeqNames){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(goodCountFile)) { - ct.readTable(goodCountFile, true); + ct.readTable(goodCountFile, true, false); ct.printTable(goodCountFile); } diff --git a/secondarystructurecommand.cpp b/secondarystructurecommand.cpp index 3354665..fee74a7 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, false); + ct.readTable(countfile, false, false); nameMap = ct.getNameMap(); } diff --git a/seqerrorcommand.cpp b/seqerrorcommand.cpp index 5879241..41ddf35 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, false); + ct.readTable(countfile, false, false); weights = ct.getNameMap(); } diff --git a/seqsummarycommand.cpp b/seqsummarycommand.cpp index 0e3b70c..e941b3a 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, false); + ct.readTable(countfile, false, false); nameMap = ct.getNameMap(); } diff --git a/sequencecountparser.cpp b/sequencecountparser.cpp index 37eb4e7..5349da0 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, true); + countTable.readTable(countfile, true, false); //initialize maps namesOfGroups = countTable.getNamesOfGroups(); diff --git a/sharedcommand.cpp b/sharedcommand.cpp index 8d5d89c..1e078b3 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, true); + countTable->readTable(countfile, true, false); } if (m->control_pressed) { return 0; } diff --git a/sharedlistvector.cpp b/sharedlistvector.cpp index 0ee2f79..2ce250b 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(), true); + countTable->readTable(m->getCountTableFile(), true, false); } int hold; diff --git a/shhhercommand.cpp b/shhhercommand.cpp index c405e38..7fa99f1 100644 --- a/shhhercommand.cpp +++ b/shhhercommand.cpp @@ -1414,7 +1414,8 @@ string ShhherCommand::cluster(string distFileName, string namesFileName){ RAbundVector* rabund = new RAbundVector(list->getRAbundVector()); - Cluster* cluster = new CompleteLinkage(rabund, list, matrix, cutoff, "furthest"); + float adjust = -1.0; + Cluster* cluster = new CompleteLinkage(rabund, list, matrix, cutoff, "furthest", adjust); string tag = cluster->getTag(); double clusterCutoff = cutoff; diff --git a/splitabundcommand.cpp b/splitabundcommand.cpp index 580493b..0fff428 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, true); + ct.readTable(countfile, true, false); } if ((namefile != "") && (countfile != "")) { diff --git a/splitgroupscommand.cpp b/splitgroupscommand.cpp index 5c01037..88292bd 100644 --- a/splitgroupscommand.cpp +++ b/splitgroupscommand.cpp @@ -320,7 +320,7 @@ int SplitGroupCommand::runCount(){ try { CountTable ct; - ct.readTable(countfile, true); + ct.readTable(countfile, true, false); 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 9e27fae..6c0d1bc 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, true); + ct.readTable(countfile, true, false); } if ((namefile != "") && (countfile != "")) { diff --git a/summaryqualcommand.cpp b/summaryqualcommand.cpp index e1e626e..56a6fcb 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, false); + ct.readTable(countfile, false, false); nameMap = ct.getNameMap(); } diff --git a/summarytaxcommand.cpp b/summarytaxcommand.cpp index e244863..097983e 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, true); + ct->readTable(countfile, true, false); } PhyloSummary* taxaSum; diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index 80698f1..753b5cb 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, true); + ct->readTable(countfile, true, false); readMatrix->read(ct); }else { readMatrix->read(nameMap); diff --git a/treereader.cpp b/treereader.cpp index 8427b56..249b2b3 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, true); + ct->readTable(cf, true, false); //if no groupinfo in count file we need to add it if (!ct->hasGroupInfo()) { diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp index 4128142..0d55d7c 100644 --- a/trimseqscommand.cpp +++ b/trimseqscommand.cpp @@ -422,7 +422,7 @@ int TrimSeqsCommand::execute(){ if (countfile != "") { CountTable ct; - ct.readTable(countfile, true); + ct.readTable(countfile, true, false); 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, true); + ct->readTable(trimCountFile, true, false); map justTrimmedNames = ct->getNameMap(); delete ct; -- 2.39.2