]> git.donarmstrong.com Git - mothur.git/commitdiff
added otulabels to heatmap.bin. made OTUlabels “smarter” so OTU01 and OTU001 are...
authorSarah Westcott <mothur.westcott@gmail.com>
Tue, 8 Oct 2013 18:33:50 +0000 (11:33 -0700)
committerSarah Westcott <mothur.westcott@gmail.com>
Tue, 8 Oct 2013 18:33:50 +0000 (11:33 -0700)
61 files changed:
binsequencecommand.cpp
chimeraperseuscommand.cpp
chimeraperseuscommand.h
chimeraslayercommand.cpp
chimerauchimecommand.cpp
chimerauchimecommand.h
classify.cpp
classifyotucommand.cpp
classifyseqscommand.cpp
clustercommand.cpp
clusterdoturcommand.cpp
clusterfragmentscommand.cpp
clustersplitcommand.cpp
consensusseqscommand.cpp
countgroupscommand.cpp
counttable.cpp
counttable.h
createdatabasecommand.cpp
deconvolutecommand.cpp
getgroupscommand.cpp
getlineagecommand.cpp
getotulabelscommand.cpp
getoturepcommand.cpp
getrabundcommand.cpp
getsabundcommand.cpp
getseqscommand.cpp
heatmap.cpp
heatmap.h
heatmapsimcommand.cpp
helpcommand.cpp
listseqscommand.cpp
makebiomcommand.cpp
makecontigscommand.cpp
mgclustercommand.cpp
mothurout.cpp
mothurout.h
parselistscommand.cpp
prcseqscommand.cpp
preclustercommand.cpp
primerdesigncommand.cpp
removegroupscommand.cpp
removelineagecommand.cpp
removeotulabelscommand.cpp
removerarecommand.cpp
removeseqscommand.cpp
screenseqscommand.cpp
secondarystructurecommand.cpp
seqerrorcommand.cpp
seqsummarycommand.cpp
sequencecountparser.cpp
sharedcommand.cpp
sharedlistvector.cpp
shhhercommand.cpp
splitabundcommand.cpp
splitgroupscommand.cpp
subsamplecommand.cpp
summaryqualcommand.cpp
summarytaxcommand.cpp
treegroupscommand.cpp
treereader.cpp
trimseqscommand.cpp

index be167d9b9cbb92a8ffea832b8c2eccfb4ed6bf3d..f9784b3ea91e09d1c0d86232b67b70bc5e789b99 100644 (file)
@@ -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();
index cea481bd22062b7461a06705d08ba4d1c1930451..0547802198960198d9d2a063bc498e79f04bfe33 100644 (file)
@@ -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<string> doNotRemove;
-                        CountTable c; c.readTable(newCountFile, true);
+                        CountTable c; c.readTable(newCountFile, true, true);
                         vector<string> 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(); }
index b6d4fc9323f659abe52cd70a1e3598a84d9db936..0d907814e21b2ef48dbd3d1883fb3e8698533189 100644 (file)
@@ -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 {
index f01bd3ee9d9bb3611b52b38819f98300da9cff39..41661da085060fcd66913f31764232dbbacce342 100644 (file)
@@ -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<string> doNotRemove;
-                            CountTable c; c.readTable(newCountFile, true);
+                            CountTable c; c.readTable(newCountFile, true, true);
                             vector<string> 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<string, int> ChimeraSlayerCommand::sortFastaFile(string fastaFile, string na
         int error;
         if (hasCount) { 
             CountTable ct;
-            ct.readTable(nameFile, true);
+            ct.readTable(nameFile, true, false);
             
             for(map<string, string>::iterator it = seqs.begin(); it != seqs.end(); it++) {
                 int num = ct.getNumSeqs(it->first);
index 422792a68525b495008694360c393e26ba358c09..346afe213b12fab2baab1e4d23102e526f6ecc8c 100644 (file)
@@ -674,7 +674,7 @@ int ChimeraUchimeCommand::execute(){
                 int error;
                 if (hasCount) {
                     CountTable ct;
-                    ct.readTable(nameFile, true);
+                    ct.readTable(nameFile, true, false);
                     for(map<string, string>::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<string> doNotRemove;
-                        CountTable c; c.readTable(newCountFile, true);
+                        CountTable c; c.readTable(newCountFile, true, true);
                         vector<string> 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(); }
index fadc4a4d401dcf5da93d0d32c56ed9ec8a7ef99a..e98a20d9056b858892d9f4ac69ff2517f2604165 100644 (file)
@@ -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 {
index 5f97c7ec693a97997554683188a013b1054eb3d7..71a9b258e91bf2f527e2e1a8469f2e1e8037d76d 100644 (file)
@@ -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);
index 76d7504aa04b0170629b0f022a882be94ceacfc0..217bc868eb8984c1111ff50fa84f83abeefa2059 100644 (file)
@@ -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
index b311821b3e8d293daac13107eb9e6771be360bf0..1b56433073d404e2c7f33513f7362f8306afcb42 100644 (file)
@@ -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 {
index 94129654e1d2b11275e82d3a5da0382b1448efa9..c1ac5bbddd5be05c41e03853c25af4340eab133e 100644 (file)
@@ -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); }
                
index 08a5938b85b3b40f7a53619766d1a9a3e004a9a5..96bfc5c523be69bcc75dae33e35a209846aa2302 100644 (file)
@@ -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 {
index 9c1408c9a112dcc3ad9ed579026e2528c334a102..4b5c67f8f69bb51160d3d32212cf337719e3b4eb 100644 (file)
@@ -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; }
                        
index 95693cc420a7e55d5c9a96a102e3d9e55ad0221c..b5dc9692f0f7afefabae27676b9aa61491c048f1 100644 (file)
@@ -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); }
                
index 3d671f98420e0fa7cf844aac647bd43feea959e8..fbec746804bcd7257383e99f26e058dfe4df6f25 100644 (file)
@@ -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; }
                
index 83c2d315d0b8f781caa02c04c4fed5e1cb6b6a0d..ce3358ef43b9cee9d7887314fb0378cb203b7ebe 100644 (file)
@@ -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
index 0e9eec38234d52215af681b74a00b5713c7113b0..d5720acd386c36cf8cd713dcbc6d1bd5e507609b 100644 (file)
@@ -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
index 51d0b4544bc73c7e832826bad702028f0143a549..c0ced354ef8bac6b013105c6bd3fe0fdfb21a3cf 100644 (file)
@@ -50,7 +50,7 @@ class CountTable {
         //reads and creates smart enough to eliminate groups with zero counts 
         int createTable(set<string>&, map<string, string>&, set<string>&); //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&);
index eab7c8261a55e45abe3f762f86cc46e59c9822a6..235682bfec8fdfc36c43ed25fb78ffd06eef1b4f 100644 (file)
@@ -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<string>& 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;
     }
index 51fa43b39f87f06a3054808acb4937e05ae2337f..98109ef33c488a071b04ad5ada84ffcab9d2e1f8 100644 (file)
@@ -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<string, string> mvariables;
index 45e0a783e393ba828d8bd74c3884fa45779a92f2..15dcbba802d5e850fccbb7bb71b05dba6af38b74 100644 (file)
@@ -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<string> gNamesOfGroups = ct.getNamesOfGroups();
index 005a89f2ebbee9e1b4c37567b6ce382979c90226..862aef7a0da6dde200bc387209bdd73d730015f5 100644 (file)
@@ -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;
                                                        }
index b6253b02a64ec25c6a394b59438a79554c3685eb..00297e2d8049be362a991589446544b6c1cf99fc 100644 (file)
@@ -234,6 +234,10 @@ int GetOtuLabelsCommand::execute(){
         
         //get labels you want to keep
                labels = m->readAccnos(accnosfile);
+        //simplfy labels
+        set<string> newLabels;
+        for (set<string>::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));
             }
index d476cc3499844c88014bcef9e1a005459fab3dda..7e71a1a836b2e6306b40d67f5cdce0d7f35dbcdc 100644 (file)
@@ -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; }
         }
         
index da1bfae2c07f5cb719961dce93324ff8135fbfc4..469117ca7bdf4cfb65553bb45536c93fd06251d2 100644 (file)
@@ -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();
index f4838cf8a72a75708085b3917b8828939e43f683..22abde5fade29a689fa88266772f5e3445d5158c 100644 (file)
@@ -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();
index 83fdf73e9af36fd9826f5a8c2efcc11655ac938e..82f9710e6e40cb84b8fee9f285fca71b3fe0099c 100644 (file)
@@ -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);
         }
                
index 36665ff7c6402652e2bfa2039ab0023294e1f248..367342c7167451402c5879a1f6efd1f83e7a48a4 100644 (file)
@@ -119,7 +119,8 @@ string HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
                }
                
                //sort lookup so shared bins are on top
-               if (sorted != "none") {  sortSharedVectors(lookup);  }
+        vector<string> sortedLabels = m->currentBinLabels;
+               if (sorted != "none") {  sortedLabels = sortSharedVectors(lookup);  }
                
                vector<vector<string> > scaleRelAbund;
                vector<float> maxRelAbund(lookup[0]->size(), 0.0);              
@@ -158,36 +159,46 @@ string HeatMap::getPic(vector<SharedRAbundVector*> 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 << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(lookup.size() * 300) + " " + toString((numBinsToDisplay*5 + 120))  + "\">\n";
+               outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(lookup.size() * binWidth + labelBump) + " " + toString((numBinsToDisplay*binHeight + 120))  + "\">\n";
                outsvg << "<g>\n";
                
                //white backround
-               outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(lookup.size() * 300) + "\" height=\"" + toString((numBinsToDisplay*5 + 120))  + "\"/>"; 
+               outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(lookup.size() * binWidth+labelBump) + "\" height=\"" + toString((numBinsToDisplay*binHeight + 120))  + "\"/>";
                outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" text-anchor=\"middle\" x=\"" + toString((lookup.size() * 150) - 40) + "\" y=\"25\">Heatmap at distance " + lookup[0]->getLabel() + "</text>\n";
                
                //column labels
-               for (int h = 0; h < lookup.size(); h++) {
-                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(((300 * (h+1)) - 150) - ((int)lookup[h]->getGroup().length() / 2)) + "\" y=\"50\">" + lookup[h]->getGroup() + "</text>\n"; 
+               for (int h = 0; h < lookup.size()+1; h++) {
+            if (h == 0) {
+                string tempLabel = "OTU";
+                outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(labelBump-labelBump/2+1) + "\" y=\"50\">" + tempLabel + "</text>\n";
+            }else {
+                outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(((binWidth * h) - 150) - ((int)lookup[h-1]->getGroup().length() / 2)+labelBump/2) + "\" y=\"50\">" + lookup[h-1]->getGroup() + "</text>\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 << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\">" + sortedLabels[i] + "</text>\n";
+            x += labelBump;
                        for (int j = 0; j < scaleRelAbund.size(); j++) {
                                if (m->control_pressed) { outsvg.close(); return "control"; }
                                
-                               outsvg << "<rect fill=\"#" + scaleRelAbund[j][i] + "\" stroke=\"#" + scaleRelAbund[j][i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
-                               x += 300;
+                               outsvg << "<rect fill=\"#" + scaleRelAbund[j][i] + "\" stroke=\"#" + scaleRelAbund[j][i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"" + toString(binWidth) +  "\" height=\"" + toString(binHeight) +  "\"/>\n";
+                               x += binWidth;
                        }
                        x = 0;
-                       y += 5;
+                       y += binHeight;
                }
                
                outsvg << "</g>\n</svg>\n";
@@ -203,12 +214,14 @@ string HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
 }
 
 //**********************************************************************************************************************
-int HeatMap::sortSharedVectors(vector<SharedRAbundVector*>& lookup){
+vector<string> HeatMap::sortSharedVectors(vector<SharedRAbundVector*>& lookup){
        try {
                                
                vector<SharedRAbundVector*> looktemp;
                map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
                map<int, int>::iterator it;
+        
+        vector<string> sortedLabels = m->currentBinLabels;
                
                /****************** find order of otus **********************/
                if (sorted == "shared") {
@@ -217,7 +230,7 @@ int HeatMap::sortSharedVectors(vector<SharedRAbundVector*>& 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<SharedRAbundVector*>& 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<SharedRAbundVector*>& lookup){
 //                     delete looktemp[j];
                }
                
-               return 0;
+               return sortedLabels;
                
        }
        catch(exception& e) {
@@ -416,7 +430,8 @@ string HeatMap::getPic(vector<SharedRAbundFloatVector*> lookup) {
                }
                
                //sort lookup so shared bins are on top
-               if (sorted != "none") {  sortSharedVectors(lookup);  }
+               vector<string> sortedLabels = m->currentBinLabels;
+               if (sorted != "none") {  sortedLabels = sortSharedVectors(lookup);  }
                
                vector<vector<string> > scaleRelAbund;
                vector<float> maxRelAbund(lookup.size(), 0.0);          
@@ -455,36 +470,47 @@ string HeatMap::getPic(vector<SharedRAbundFloatVector*> 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 << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(lookup.size() * 300) + " " + toString((numBinsToDisplay*5 + 120))  + "\">\n";
+               outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(lookup.size() * binWidth + labelBump) + " " + toString((numBinsToDisplay*binHeight + 120))  + "\">\n";
                outsvg << "<g>\n";
                
                //white backround
-               outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(lookup.size() * 300) + "\" height=\"" + toString((numBinsToDisplay*5 + 120))  + "\"/>"; 
+               outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(lookup.size() * binWidth+labelBump) + "\" height=\"" + toString((numBinsToDisplay*binHeight + 120))  + "\"/>";
                outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" text-anchor=\"middle\" x=\"" + toString((lookup.size() * 150) - 40) + "\" y=\"25\">Heatmap at distance " + lookup[0]->getLabel() + "</text>\n";
                
                //column labels
-               for (int h = 0; h < lookup.size(); h++) {
-                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(((300 * (h+1)) - 150) - ((int)lookup[h]->getGroup().length() / 2)) + "\" y=\"50\">" + lookup[h]->getGroup() + "</text>\n"; 
-               }
-
+               for (int h = 0; h < lookup.size()+1; h++) {
+            if (h == 0) {
+                string tempLabel = "OTU";
+                outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(labelBump-labelBump/2+1) + "\" y=\"50\">" + tempLabel + "</text>\n";
+            }else {
+                outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(((binWidth * h) - 150) - ((int)lookup[h-1]->getGroup().length() / 2)+labelBump/2) + "\" y=\"50\">" + lookup[h-1]->getGroup() + "</text>\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 << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\">" + sortedLabels[i] + "</text>\n";
+            x += labelBump;
                        for (int j = 0; j < scaleRelAbund.size(); j++) {
                                if (m->control_pressed) { outsvg.close(); return "control"; }
                                
-                               outsvg << "<rect fill=\"#" + scaleRelAbund[j][i] + "\" stroke=\"#" + scaleRelAbund[j][i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
-                               x += 300;
+                               outsvg << "<rect fill=\"#" + scaleRelAbund[j][i] + "\" stroke=\"#" + scaleRelAbund[j][i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"" + toString(binWidth) +  "\" height=\"" + toString(binHeight) +  "\"/>\n";
+                               x += binWidth;
                        }
                        x = 0;
-                       y += 5;
+                       y += binHeight;
                }
                
                outsvg << "</g>\n</svg>\n";
@@ -499,12 +525,14 @@ string HeatMap::getPic(vector<SharedRAbundFloatVector*> lookup) {
        }
 }
 //**********************************************************************************************************************
-int HeatMap::sortSharedVectors(vector<SharedRAbundFloatVector*>& lookup){
+vector<string> HeatMap::sortSharedVectors(vector<SharedRAbundFloatVector*>& lookup){
        try {
                                
                vector<SharedRAbundFloatVector*> looktemp;
                map<int, int> place; //spot in lookup where you insert shared by, ie, 3 -> 2 if they are shared by 3 inset into location 2.
                map<int, int>::iterator it;
+        
+        vector<string> sortedLabels = m->currentBinLabels;
                
                /****************** find order of otus **********************/
                if (sorted == "shared") {
@@ -513,7 +541,7 @@ int HeatMap::sortSharedVectors(vector<SharedRAbundFloatVector*>& 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<SharedRAbundFloatVector*>& 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<SharedRAbundFloatVector*>& lookup){
 //                     delete looktemp[j];
                }
                
-               return 0;
+               return sortedLabels;
                
        }
        catch(exception& e) {
index 2b491767d57e48c4a05728aa6a48cbfc6939b38f..922147ccb62d54f154f34796a7ad7786717841d6 100644 (file)
--- a/heatmap.h
+++ b/heatmap.h
@@ -51,8 +51,8 @@ class HeatMap {
                string getPic(vector<SharedRAbundFloatVector*>);
 
        private:
-               int sortSharedVectors(vector<SharedRAbundVector*>& );
-               int sortSharedVectors(vector<SharedRAbundFloatVector*>& );
+               vector<string> sortSharedVectors(vector<SharedRAbundVector*>& );
+               vector<string> sortSharedVectors(vector<SharedRAbundFloatVector*>& );
                int sortRabund(RAbundVector*&);
                void printLegend(int, float);
 
index 01a60aea3b01ad2ce95584c33280e7dde4d8147f..14c55308852a6e3de86b6747981c160ec9a62723 100644 (file)
@@ -543,7 +543,7 @@ int HeatMapSimCommand::runCommandDist() {
                 }
              }else if (countfile != "") {
                 nameMap = NULL;
-                ct.readTable(countfile, true);
+                ct.readTable(countfile, true, false);
                 names = ct.getNamesOfSeqs();
             }
                        
index 47d04f9d528ab14053f468f2eacc7e150db736c0..ef54dae941edcf3d8f2720e931d8a9a293574ee3 100644 (file)
@@ -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");
index cf884705cb26f341ef08713b118af32fd49c5bdf..343d4fdc6399f8ca9a91c6cac9b31313d7b76bbb 100644 (file)
@@ -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; }
         
index 7cf8295fb48e02b0dce58b32432d39c736695259..248b3c8194d27e05e9e8b15359cf6de5b9c2395a 100644 (file)
@@ -596,8 +596,9 @@ vector<string> MakeBiomCommand::getMetaData(vector<SharedRAbundVector*>& 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<string> MakeBiomCommand::getMetaData(vector<SharedRAbundVector*>& 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 {
index 0bf56e7c2166daf33816de12216d318a5fba466b..87027f4df5e0166f25852fec44cd6cfa120c90a7 100644 (file)
@@ -1042,7 +1042,9 @@ int MakeContigsCommand::driver(vector<string> 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<string> 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){
index 97f0afdb366949d39e5af37a96c0211d9df0ca17..85db5e0e8ffc384960f7954d6db1266bac9ea3c1 100644 (file)
@@ -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<string> tempNames = ct->getNamesOfSeqs();
             for (int i = 0; i < tempNames.size(); i++) {  nameMap->push_back(tempNames[i]);  }
index 713bafd0c2a79ec637abdf9d481a0c96c183ee77..3d4504daf761d625ffedd1e11749aa567ca9327b 100644 (file)
@@ -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<string> bigset, vector<string> subset) {
        try {
index 9987374e6c824cafe4aaf343c319d5bca14f209b..f58f4e874a7f72961489d7e2651bda651e3d2bb4 100644 (file)
@@ -138,6 +138,8 @@ class MothurOut {
                bool isTrue(string);
                bool isContainingOnlyDigits(string);
                bool isNumeric1(string);
+        bool isLabelEquivalent(string, string);
+        string getSimpleLabel(string);
         string findEdianness();
        
                
index 5a568f3511d38f56601362d860a9643e702c9a1b..32a7e0828ff143d8f414bacf66c52a205bbf27c7 100644 (file)
@@ -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();
index 8a8db37612937ee86d7d11adf1b9973d8cba634d..cb8dd490e3a53a40edce7d1d52fffada445fac13 100644 (file)
@@ -1275,7 +1275,7 @@ int PcrSeqsCommand::readCount(set<string> 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);
         }
                
index bd3f172c2bcaa3e13ced0b5c57d92e39c9073969..fbbe4bb3a2fc5c99f77875292849e0a0e95f1043 100644 (file)
@@ -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;  }
             }
index 195adf4f716b29bd7c12a2f3529603e4baec6b4d..960da85e8ce7ab4922f6afc38c728f2be5288ca2 100644 (file)
@@ -1088,7 +1088,7 @@ map<string, int> PrimerDesignCommand::readCount(unsigned long int& numSeqs){
         map<string, int> nameMap;
         
         CountTable ct;
-        ct.readTable(countfile, false);
+        ct.readTable(countfile, false, false);
         vector<string> namesOfSeqs = ct.getNamesOfSeqs();
         numSeqs = ct.getNumUniqueSeqs();
         
index 64f9ab6822301310e975e6bbe58736e953eed4f2..9eefa43c9f303249c812d27a1ccbc481dc6b7fcf 100644 (file)
@@ -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<string> gNamesOfGroups = ct.getNamesOfGroups();
index 66bbc1779bc16055076d6b1b814233f69e077d6d..01f45ca97329fbbe383c2157f12880ca05671a10 100644 (file)
@@ -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;
index fa98b86dde528f0190129f9b3939148e6d72f9a2..161c4bfb3553d52ceac6fd89b033152cf9fa8e43 100644 (file)
@@ -234,6 +234,10 @@ int RemoveOtuLabelsCommand::execute(){
         
         //get labels you want to keep
                labels = m->readAccnos(accnosfile);
+        //simplfy labels
+        set<string> newLabels;
+        for (set<string>::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++; }
         }
index a551681fb6721e4b3670fe912e1b6bfe909dd388..2eb5f63da369828e4e67e0f0b262b1e786b75a88 100644 (file)
@@ -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<string> namesGroups = ct.getNamesOfGroups();
                 SharedUtil util;
index b1bc4fd508576c04126206b4e178798c088cb91d..fa7e6dda2a853d6a0234c1dc92be3bad258118d1 100644 (file)
@@ -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);
         }
 
index e40c41218f5a599d894e0b2cb52f54406635f9ee..a56b0ebb73d1f6188ecd09430e70ed0128abaf31 100644 (file)
@@ -14,7 +14,7 @@
 vector<string> 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<string, string>& 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<string, string>& 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<string, string>& 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<string, string> 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);
         }
                
index 3354665852ce1b5a95b9ecc7cc673d5083b25d8b..fee74a719ce9c4d3a988a0a30647f2f1368ca8f9 100644 (file)
@@ -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();
         }
                
index 5879241372dd3b60b34683683a0c1edbcbd64d57..41ddf35a7705264445749caf8868d80049ae61ac 100644 (file)
@@ -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();
         }
                
index 0e3b70c1db3824084a51fb0db1c88630285878c2..e941b3a9a2ff500dd07e221712757a8b899526d2 100644 (file)
@@ -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();
         }
                
index 37eb4e7f5256617bd3917428616a897ee14706e4..5349da09ff719a5ac07a85ecb4015c44d41121ee 100644 (file)
@@ -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();
index 8d5d89c3a96843b5fd1c8aafa112f25c3b216e1f..1e078b3f82080ec554462a12f2564b5a5f470d04 100644 (file)
@@ -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; }
index 0ee2f795cea302bd98a31285b278479f13ef17f3..2ce250ba908b4b45fa200b845275af22c3ca3be6 100644 (file)
@@ -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;
index c405e38060cec0db4b610c2e6c9e24a8810d7aed..7fa99f1b04fd2632bf4d6e59ab08db6d1a38c1d9 100644 (file)
@@ -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;
index 580493b60a1e4d449a71b8689635e8ced4dea397..0fff42804cf702b0ba74cbbe245b51a0f91c1bff 100644 (file)
@@ -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 != "")) {
index 5c0103708bc99daaf6d0046435882c72a6c631a7..88292bd2694e4dd044bcacc8c38d5c2c34a7d204 100644 (file)
@@ -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; }
index 9e27fae51eca7ef564892e112d8a17d24eba6089..6c0d1bcbe71a3c3c2a7fccda9695f7aef6aec25b 100644 (file)
@@ -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 != "")) {
index e1e626ea273a650840dd849442e43762e9a100cf..56a6fcb099818b4590e80bff0639193b9bf65767 100644 (file)
@@ -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();
         }
         
index e244863c65de54c6c5133d3901a1dc1bc973c6ac..097983e93f24c853cc4d720eb2b1b82a3261b79c 100644 (file)
@@ -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;
index 80698f1b4b0317719421dbe9c4af3c0583bd9d97..753b5cbe3cf7f67ed623bb8d866b848c6c96e5be 100644 (file)
@@ -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);
index 8427b562501086e8a9bf13b6e036474348412b0e..249b2b3c3c187c5a62bf5c1cf7aaab88a44bcff2 100644 (file)
@@ -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()) {
index 4128142448b8412314dc2b1d8ce057c6e8527519..0d55d7c4a0b043f811d2d6b9f61ef159952ea1f9 100644 (file)
@@ -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<string, int> justTrimmedNames = ct->getNameMap();
                 delete ct;