[med-svn] [mothur] 02/05: Imported Upstream version 1.37.5

Tomasz Buchert tomasz at moszumanska.debian.org
Mon Jun 13 07:10:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

tomasz pushed a commit to branch master
in repository mothur.

commit 5ce5d729c030b70bba6cce43b44b4b75794cca0f
Author: Tomasz Buchert <tomasz at debian.org>
Date:   Sun Jun 12 19:57:22 2016 +0200

    Imported Upstream version 1.37.5
---
 makefile-internal                        |  4 +-
 source/commands/chimerauchimecommand.cpp |  2 +-
 source/commands/clustersplitcommand.cpp  | 27 ++++++-----
 source/commands/makecontigscommand.cpp   | 80 +++++++++++++++++---------------
 source/commands/makecontigscommand.h     |  1 +
 source/mothurout.cpp                     |  4 +-
 source/mothurout.h                       |  2 +-
 source/vsearchfileparser.cpp             |  2 +-
 8 files changed, 65 insertions(+), 57 deletions(-)

diff --git a/makefile-internal b/makefile-internal
index 3a2a25c..e826802 100755
--- a/makefile-internal
+++ b/makefile-internal
@@ -1,8 +1,8 @@
 64BIT_VERSION ?= yes
 USEREADLINE ?= yes
 USEBOOST ?= yes
-RELEASE_DATE = "\"4/11/2015\""
-VERSION = "\"1.37.0\""
+RELEASE_DATE = "\"5/11/2016\""
+VERSION = "\"1.37.4\""
 
 # Optimize to level 3:
     CXXFLAGS += -O3
diff --git a/source/commands/chimerauchimecommand.cpp b/source/commands/chimerauchimecommand.cpp
index 874239b..e43baaa 100644
--- a/source/commands/chimerauchimecommand.cpp
+++ b/source/commands/chimerauchimecommand.cpp
@@ -690,7 +690,7 @@ int ChimeraUchimeCommand::execute(){
 				if (error == 1) { for (int j = 0; j < outputNames.size(); j++) {	m->mothurRemove(outputNames[j]);	}  return 0; }
 				if (seqs.size() != nameMapCount.size()) { m->mothurOut( "The number of sequences in your fastafile does not match the number of sequences in your namefile, aborting."); m->mothurOutEndLine(); for (int j = 0; j < outputNames.size(); j++) {	m->mothurRemove(outputNames[j]);	}  return 0; }
 				
-				m->printVsearchFile(nameMapCount, newFasta);
+                m->printVsearchFile(nameMapCount, newFasta, "ab");
 				fastaFileNames[s] = newFasta;
 			}
 			
diff --git a/source/commands/clustersplitcommand.cpp b/source/commands/clustersplitcommand.cpp
index 8234d7f..0deb25d 100644
--- a/source/commands/clustersplitcommand.cpp
+++ b/source/commands/clustersplitcommand.cpp
@@ -616,18 +616,21 @@ map<float, int> ClusterSplitCommand::completeListFile(vector<string> listNames,
 			numSingleBins = listSingle->getNumBins();
 		}else{  listSingle = NULL; numSingleBins = 0;  }
 		
-		//go through users set and make them floats so we can sort them 
-		for(set<string>::iterator it = userLabels.begin(); it != userLabels.end(); ++it) {
-			double temp = -10.0;
-
-			if ((*it != "unique") && (convertTestFloat(*it, temp) == true))	{	convert(*it, temp);	}
-			else if (*it == "unique")										{	temp = -1.0;		}
-			
-			if (temp <= cutoff) {
-				orderFloat.push_back(temp);
-				labelBin[temp] = numSingleBins; //initialize numbins 
-			}
-		}
+        //go through users set and make them floats so we can sort them
+        double tcutoff = cutoff * 1000; tcutoff = ceil(tcutoff);
+        for(set<string>::iterator it = userLabels.begin(); it != userLabels.end(); ++it) {
+            double temp = -10.0;
+            
+            if ((*it != "unique") && (convertTestFloat(*it, temp) == true))	{	m->mothurConvert(*it, temp);	}
+            else if (*it == "unique")										{	temp = -1.0;		}
+            
+            double ttemp = temp * 1000; ttemp = ceil(temp);
+            
+            if (ttemp <= tcutoff) {
+                orderFloat.push_back(temp);
+                labelBin[temp] = numSingleBins; //initialize numbins 
+            }
+        }
 	
 		//sort order
 		sort(orderFloat.begin(), orderFloat.end());
diff --git a/source/commands/makecontigscommand.cpp b/source/commands/makecontigscommand.cpp
index 6ef8e49..fb34c16 100644
--- a/source/commands/makecontigscommand.cpp
+++ b/source/commands/makecontigscommand.cpp
@@ -2550,7 +2550,7 @@ int MakeContigsCommand::setNameType(string forwardFile, string reverseFile, char
         }else { //compressed files
 #ifdef USE_BOOST
             m->openInputFileBinary(forwardFile, inForward, inFF);
-            m->openInputFileBinary(reverseFile, inReverse, inRF);
+            m->openInputFileBinary(reverseFile, inForward, inRF);
             
             if (delim == '>') {
                 Sequence fread(inFF);
@@ -2584,7 +2584,6 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
         vector<unsigned long long> fastaFilePos;
         vector<unsigned long long> qfileFilePos;
         vector<unsigned long long> temp;
-        vector<unsigned long long> trimmedNamesFilePos;
         
         nameType = setNameType(fasta[0], fasta[1], delim);
         
@@ -2610,13 +2609,13 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
                 name = name.substr(1);
                 m->checkName(name);
             }
+            fixName(name);
             firstSeqNames[name] = i;
-            trimmedNames[name.substr(0, name.length()-1)];
             in.close();
         }
         
-        map<string, int> copy;  map<string, int> tcopy;
-        if (qual.size() != 0) { copy = firstSeqNames; tcopy = trimmedNames; }
+        map<string, int> copy;
+        if (qual.size() != 0) { copy = firstSeqNames; }
         
         //look for match in reverse file
         ifstream in2;
@@ -2632,28 +2631,22 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
                     string name = pieces[0];
                     name = name.substr(1);
                     m->checkName(name);
+                    fixName(name);
                     
                     map<string, int>::iterator it = firstSeqNames.find(name);
-                    map<string, int>::iterator itTrimmed = trimmedNames.find(name.substr(0, name.length()-1));
                     
                     if (it != firstSeqNames.end())  { //this is the start of a new chunk
                         unsigned long long pos = in2.tellg();
                         qfileFilePos.push_back(pos - input.length() - 1);
                         firstSeqNames.erase(it);
-                    }else if (itTrimmed != trimmedNames.end()) {
-                        unsigned long long pos = in2.tellg();
-                        trimmedNamesFilePos.push_back(pos - input.length() - 1);
-                        trimmedNames.erase(itTrimmed);
                     }
                 }
             }
             
-            if ((firstSeqNames.size() == 0) || (trimmedNames.size() == 0)) { break; }
+            if ((firstSeqNames.size() == 0)) { break; }
         }
         in2.close();
         
-        if ((firstSeqNames.size() != 0) && (trimmedNames.size() == 0)) { qfileFilePos = trimmedNamesFilePos; }
-        
         //get last file position of reverse fasta[1]
         FILE * pFile;
         unsigned long long size;
@@ -2669,7 +2662,7 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
         qfileFilePos.push_back(size);
 
         
-        if ((firstSeqNames.size() != 0) && (trimmedNames.size() != 0)){
+        if ((firstSeqNames.size() != 0)){
             for (map<string, int>::iterator it = firstSeqNames.begin(); it != firstSeqNames.end(); it++) {
                 if (delim == '>') {
                     m->mothurOut(it->first + " is in your forward fasta file and not in your reverse file, please remove it using the remove.seqs command before proceeding."); m->mothurOutEndLine();
@@ -2690,11 +2683,10 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
         }
         
         qfileFilePos.clear();
-        trimmedNamesFilePos.clear();
+        
         
         if (qual.size() != 0) {
             firstSeqNames = copy;
-            trimmedNames = tcopy;
             
             if (qual[0] != "NONE") {
                 //seach for filePos of each first name in the qfile and save in qfileFilePos
@@ -2711,28 +2703,21 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
                             string name = pieces[0];
                             name = name.substr(1);
                             m->checkName(name);
+                            fixName(name);
                             
                             map<string, int>::iterator it = firstSeqNames.find(name);
-                            map<string, int>::iterator itTrimmed = trimmedNames.find(name.substr(0, name.length()-1));
                             
                             if(it != firstSeqNames.end()) { //this is the start of a new chunk
                                 unsigned long long pos = inQual.tellg();
                                 qfileFilePos.push_back(pos - input.length() - 1);
                                 firstSeqNames.erase(it);
-                            }else if (itTrimmed != trimmedNames.end()) {
-                                unsigned long long pos = inQual.tellg();
-                                trimmedNamesFilePos.push_back(pos - input.length() - 1);
-                                trimmedNames.erase(itTrimmed);
-                            }
-                        }
+                            }                        }
                     }
                     
-                    if ((firstSeqNames.size() == 0) || (trimmedNames.size() == 0)) { break; }
+                    if ((firstSeqNames.size() == 0)) { break; }
                 }
                 inQual.close();
                 
-                if ((firstSeqNames.size() != 0) && (trimmedNames.size() == 0)) { qfileFilePos = trimmedNamesFilePos; }
-                
                 //get last file position of reverse qual[0]
                 FILE * pFile;
                 unsigned long long size;
@@ -2748,7 +2733,7 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
                 qfileFilePos.push_back(size);
                 
                 
-                if ((firstSeqNames.size() != 0) && (trimmedNames.size() != 0)){
+                if ((firstSeqNames.size() != 0)){
                     for (map<string, int>::iterator it = firstSeqNames.begin(); it != firstSeqNames.end(); it++) {
                         if (delim == '>') {
                             m->mothurOut(it->first + " is in your forward fasta file and reverse fasta file, but not your forward qfile, please remove it using the remove.seqs command before proceeding."); m->mothurOutEndLine();
@@ -2761,8 +2746,6 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
                 }
             }
             firstSeqNames = copy;
-            trimmedNames = tcopy;
-            trimmedNamesFilePos.clear();
             
             if (qual[1] != "NONE") {
                 ifstream inQual2;
@@ -2778,28 +2761,22 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
                             name = name.substr(1);
                             
                             m->checkName(name);
+                            fixName(name);
                             
                             map<string, int>::iterator it = firstSeqNames.find(name);
-                            map<string, int>::iterator itTrimmed = trimmedNames.find(name.substr(0, name.length()-1));
                             
                             if(it != firstSeqNames.end()) { //this is the start of a new chunk
                                 unsigned long long pos = inQual2.tellg();
                                 temp.push_back(pos - input.length() - 1);
                                 firstSeqNames.erase(it);
-                            }else if (itTrimmed != trimmedNames.end()) {
-                                unsigned long long pos = inQual2.tellg();
-                                trimmedNamesFilePos.push_back(pos - input.length() - 1);
-                                trimmedNames.erase(itTrimmed);
                             }
                         }
                     }
                     
-                    if ((firstSeqNames.size() == 0) || (trimmedNames.size() == 0)) { break; }
+                    if ((firstSeqNames.size() == 0)) { break; }
                 }
                 inQual2.close();
                 
-                if ((firstSeqNames.size() != 0) && (trimmedNames.size() == 0)) { temp = trimmedNamesFilePos; }
-                
                 //get last file position of reverse qual[1]
                 FILE * pFile2;
                 
@@ -2814,7 +2791,7 @@ int MakeContigsCommand::setLines(vector<string> fasta, vector<string> qual, vect
                 temp.push_back(size);
                 
                 
-                if ((firstSeqNames.size() != 0) && (trimmedNames.size() != 0)){
+                if ((firstSeqNames.size() != 0)){
                     for (map<string, int>::iterator it = firstSeqNames.begin(); it != firstSeqNames.end(); it++) {
                         if (delim == '>') {
                             m->mothurOut(it->first + " is in your forward fasta file, reverse fasta file, and forward qfile but not your reverse qfile, please remove it using the remove.seqs command before proceeding."); m->mothurOutEndLine();
@@ -3309,6 +3286,33 @@ bool MakeContigsCommand::getOligos(vector<vector<string> >& fastaFileNames, vect
 /**
  * checks for minor diffs @MS7_15058:1:1101:11899:1633#8/1 @MS7_15058:1:1101:11899:1633#8/2 should match
  */
+bool MakeContigsCommand::fixName(string& forward){
+    try {
+        bool match = false;
+        
+        if (nameType == poundMatch) {
+            match = true;
+            //we know the location of the # matches in the forward and reverse
+            if (poundMatchPos) {
+                forward = (forward.substr(0, poundMatchPos));
+            }else { //it does not match
+                int pos = forward.find_last_of('#');
+                if (pos != string::npos) {  forward = forward.substr(0, pos);   }
+            }
+        }else if (nameType == perfectMatch) { match = true; }
+        
+        return match;
+    }
+    catch(exception& e) {
+        m->errorOut(e, "MakeContigsCommand", "fixName");
+        exit(1);
+    }
+}
+
+//***************************************************************************************************************
+/**
+ * checks for minor diffs @MS7_15058:1:1101:11899:1633#8/1 @MS7_15058:1:1101:11899:1633#8/2 should match
+ */
 bool MakeContigsCommand::checkName(FastqRead& forward, FastqRead& reverse){
     try {
         bool match = false;
diff --git a/source/commands/makecontigscommand.h b/source/commands/makecontigscommand.h
index f0346ff..3c36fd4 100644
--- a/source/commands/makecontigscommand.h
+++ b/source/commands/makecontigscommand.h
@@ -83,6 +83,7 @@ private:
     bool checkName(Sequence& forward, Sequence& reverse);
     bool checkName(QualityScores& forward, QualityScores& reverse);
     bool checkName(Sequence& forward, QualityScores& reverse);
+    bool fixName(string& forward);
     unsigned long long processMultipleFileOption(map<string, int>&, vector<string>&, map<string, string>&);
     unsigned long long processSingleFileOption(map<string, int>&, vector<string>&, map<string, string>&);
     int loadQmatchValues(vector< vector<double> >&, vector< vector<double> >&);
diff --git a/source/mothurout.cpp b/source/mothurout.cpp
index f388e28..078e4db 100644
--- a/source/mothurout.cpp
+++ b/source/mothurout.cpp
@@ -4873,7 +4873,7 @@ int MothurOut::min(int A, int B){
     }
 }
 //**********************************************************************************************************************
-int MothurOut::printVsearchFile(vector<seqPriorityNode>& nameMapCount, string filename){
+int MothurOut::printVsearchFile(vector<seqPriorityNode>& nameMapCount, string filename, string tag){
     try {
         
         sort(nameMapCount.begin(), nameMapCount.end(), compareSeqPriorityNodes);
@@ -4884,7 +4884,7 @@ int MothurOut::printVsearchFile(vector<seqPriorityNode>& nameMapCount, string fi
         //print new file in order of
         for (int i = 0; i < nameMapCount.size(); i++) {
             if (control_pressed) {break;}
-            out << ">" << nameMapCount[i].name  << "/size=" << nameMapCount[i].numIdentical << "/" << endl << nameMapCount[i].seq << endl;
+            out << ">" << nameMapCount[i].name  << "/" + tag + "=" << nameMapCount[i].numIdentical << "/" << endl << nameMapCount[i].seq << endl;
         }
         out.close();
         
diff --git a/source/mothurout.h b/source/mothurout.h
index 68b9a68..532082f 100644
--- a/source/mothurout.h
+++ b/source/mothurout.h
@@ -140,7 +140,7 @@ class MothurOut {
 		int readNames(string, map<string, vector<string> >&);
 		int readNames(string, vector<seqPriorityNode>&, map<string, string>&);
 		int mothurRemove(string);
-        int printVsearchFile(vector<seqPriorityNode>&, string); //sorts and prints by abundance adding /ab=xxx/
+        int printVsearchFile(vector<seqPriorityNode>&, string, string); //sorts and prints by abundance adding /ab=xxx/
         bool mothurConvert(char, int&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
 		bool mothurConvert(string, int&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
         bool mothurConvert(string, intDist&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
diff --git a/source/vsearchfileparser.cpp b/source/vsearchfileparser.cpp
index bd34c57..bd92467 100644
--- a/source/vsearchfileparser.cpp
+++ b/source/vsearchfileparser.cpp
@@ -114,7 +114,7 @@ string VsearchFileParser::createVsearchFasta(string inputFile){
         }
         in.close();
         
-        m->printVsearchFile(seqs, vsearchFasta);
+        m->printVsearchFile(seqs, vsearchFasta, "size");
         
         return vsearchFasta;
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/mothur.git



More information about the debian-med-commit mailing list