Permalink
Browse files

Merge branch '1.40.0'

  • Loading branch information...
2 parents 785fa9b + 5562475 commit 462a6de82cf3b08085ac5ca65d630b3c3594584f @mothur-westcott mothur-westcott committed Feb 16, 2017
View
@@ -1,20 +1,21 @@
64BIT_VERSION ?= yes
-USEREADLINE ?= yes
-USEBOOST ?= yes
-RELEASE_DATE = "\"2/2/2017\""
+USEREADLINE ?= no
+USEBOOST ?= no
+RELEASE_DATE = "\"2/7/2017\""
VERSION = "\"1.39.1\""
# Optimize to level 3:
CXXFLAGS += -O3
+
ifeq ($(strip $(64BIT_VERSION)),yes)
#if you are a mac user use the following line
- TARGET_ARCH += -arch x86_64
+ #TARGET_ARCH += -arch x86_64
#if you using cygwin to build Windows the following line
- #CXX = x86_64-w64-mingw32-g++
- #CC = x86_64-w64-mingw32-g++
- #TARGET_ARCH += -m64 -static
+ CXX = x86_64-w64-mingw32-g++
+ CC = x86_64-w64-mingw32-g++
+ TARGET_ARCH += -m64 -static
#if you are a linux user use the following line - specific processor builds in future??
#CXXFLAGS += -mtune=generic
@@ -18,6 +18,7 @@ PhyloTree::PhyloTree(){
numSeqs = 0;
tree.push_back(TaxNode("Root"));
tree[0].heirarchyID = "0";
+ tree[0].level = 0;
maxLevel = 0;
calcTotals = true;
addSeqToTree("unknown", "unknown;");
@@ -78,6 +79,7 @@ PhyloTree::PhyloTree(string tfile){
numSeqs = 0;
tree.push_back(TaxNode("Root"));
tree[0].heirarchyID = "0";
+ tree[0].level = 0;
maxLevel = 0;
calcTotals = true;
string name, tax;
@@ -219,6 +221,7 @@ int PhyloTree::addSeqToTree(string seqName, string seqTaxonomy){
tree.push_back(TaxNode(taxon));
numNodes++;
tree[currentNode].children[taxon] = numNodes-1;
+ tree[currentNode].level = level;
tree[numNodes-1].parent = currentNode;
currentNode = tree[currentNode].children[taxon];
@@ -296,7 +299,7 @@ void PhyloTree::assignHeirarchyIDs(int index){
tree[it->second].heirarchyID = tree[index].heirarchyID + '.' + toString(counter);
counter++;
- tree[it->second].level = tree[index].level + 1;
+ //tree[it->second].level = tree[index].level + 1;
//save maxLevel for binning the unclassified seqs
if (tree[it->second].level > maxLevel) { maxLevel = tree[it->second].level; }
@@ -1390,8 +1390,10 @@ int ChimeraVsearchCommand::driver(string outputFName, string filename, string ac
string name = seq.getName();
- name = name.substr(0, name.length()-1); //rip off last ;
- name = name.substr(0, name.find_last_of(';'));
+ if (templatefile == "self") {
+ name = name.substr(0, name.length()-1); //rip off last ;
+ name = name.substr(0, name.find_last_of(';'));
+ }
out << name << endl; numChimeras++;
}
@@ -825,6 +825,10 @@ unsigned long long MakeContigsCommand::processSingleFileOption(map<string, int>&
//**********************************************************************************************************************
unsigned long long MakeContigsCommand::processMultipleFileOption(map<string, int>& totalGroupCounts, vector<string>& theseOutputFileNames, map<string, string>& theseAllFileNames) {
try {
+
+ //read file
+ vector< vector<string> > fileInputs = readFileNames(file); if (m->control_pressed) { return 0; }
+
unsigned long long numReads = 0;
map<string, string> cvars;
@@ -861,10 +865,6 @@ unsigned long long MakeContigsCommand::processMultipleFileOption(map<string, int
theseOutputFileNames.push_back(compositeQualFile);
theseOutputFileNames.push_back(compositeMisMatchFile);
-
- //read file
- vector< vector<string> > fileInputs = readFileNames(file);
-
if (gz) {
numReads = createProcessesGroups(fileInputs, compositeGroupFile, compositeFastaFile, compositeScrapFastaFile, compositeQualFile, compositeScrapQualFile, compositeMisMatchFile, totalGroupCounts, theseAllFileNames); theseOutputFileNames.push_back(compositeGroupFile);
}else {
@@ -2976,6 +2976,9 @@ vector< vector<string> > MakeContigsCommand::readFileNames(string filename){
bool skip = false;
string line = m->getline(in); m->gobble(in);
+
+ if (m->debug) { m->mothurOut("[DEBUG]: " + line +"\n"); }
+
vector<string> pieces = m->splitWhiteSpace(line);
string group = "";
@@ -3267,6 +3270,8 @@ vector< vector<string> > MakeContigsCommand::readFileNames(string filename){
gz = true;
}else { gz = false; }
+ if (files.size() == 0) { m->control_pressed = true; }
+
return files;
}
catch(exception& e) {
@@ -1161,16 +1161,14 @@ int PcrSeqsCommand::readGroup(set<string> names){
while(!in.eof()){
if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
- in >> name; //read from first column
- in >> group; //read from second column
+ in >> name; m->gobble(in); //read from first column
+ in >> group; m->gobble(in); //read from second column
//if this name is in the accnos file
if (names.count(name) == 0) {
wroteSomething = true;
out << name << '\t' << group << endl;
}else { removedCount++; }
-
- m->gobble(in);
}
in.close();
out.close();
@@ -790,7 +790,8 @@ int PreClusterCommand::readFASTA(){
if (it == nameMap.end()) { m->mothurOut(seq.getName() + " is not in your names file, please correct."); m->mothurOutEndLine(); exit(1); }
else{
string second = it->second;
- seqPNode tempNode(m->getNumNames(second), seq, second);
+ int numReps = m->getNumNames(second);
+ seqPNode tempNode(numReps, seq, second);
alignSeqs.push_back(tempNode);
lengths.insert(seq.getAligned().length());
}
@@ -810,6 +811,7 @@ int PreClusterCommand::readFASTA(){
if (lengths.size() > 1) { method = "unaligned"; }
else if (lengths.size() == 1) { method = "aligned"; filterSeqs(); }
+
return alignSeqs.size();
}
@@ -59,8 +59,8 @@ string RenameFileCommand::getHelpString(){
try {
string helpString = "";
helpString += "The rename.file command allows you to rename files and updates the current files saved by mothur.\n";
- helpString += "The rename.file command parameters are: phylip, column, list, rabund, sabund, name, group, design, tree, shared, relabund, fasta, qfile, sff, oligos, accnos, biom, count, summary, file, taxonomy, constaxonomy, input, output, prefix, deletedold and shorten.\n";
- helpString += "The output parameter allows you to provide an output file name for the input file you provide.\n";
+ helpString += "The rename.file command parameters are: phylip, column, list, rabund, sabund, name, group, design, tree, shared, relabund, fasta, qfile, sff, oligos, accnos, biom, count, summary, file, taxonomy, constaxonomy, input, new, prefix, deletedold and shorten.\n";
+ helpString += "The new parameter allows you to provide an output file name for the input file you provide.\n";
helpString += "The shorten parameter is used to inicate you want mothur to generate output file names for you. For example: stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.an.unique_list.shared would become stability.an.shared. Default=true.";
helpString += "The prefix parameter allows you to enter your own prefix for shortened names.";
helpString += "The deleteold parameter indicates whether you want to delete the old file. Default=true.";
@@ -479,6 +479,8 @@ RenameFileCommand::RenameFileCommand(string option) {
if ((mothurGenerated) && (outputfile != "") && (numFiles != 1)) {
m->mothurOut("[ERROR]: You must allow mothur to generate the filenames or input one file at a time with a new name, not both.\n"); abort= true;
}
+
+ if (outputDir != "") { outputfile = outputDir + m->getSimpleName(outputfile); }
}
}
@@ -197,18 +197,20 @@ int SeqSummaryCommand::execute(){
long long numSeqs = 0;
long long size = 0;
+ long long numUniques = 0;
map<int, long long> startPosition;
map<int, long long> endPosition;
map<int, long long> seqLength;
map<int, long long> ambigBases;
map<int, long long> longHomoPolymer;
- if (namefile != "") { nameMap = m->readNames(namefile); }
+ if (namefile != "") { nameMap = m->readNames(namefile); numUniques = nameMap.size(); }
else if (countfile != "") {
CountTable ct;
ct.readTable(countfile, false, false);
nameMap = ct.getNameMap();
size = ct.getNumSeqs();
+ numUniques = ct.getNumUniqueSeqs();
}
if (m->control_pressed) { return 0; }
@@ -244,9 +246,19 @@ int SeqSummaryCommand::execute(){
//set size
if (countfile != "") {}//already set
- else if (namefile == "") { size = numSeqs; }
+ else if (namefile == "") { size = numSeqs; }
else { for (map<int, long long>::iterator it = startPosition.begin(); it != startPosition.end(); it++) { size += it->second; } }
+ if ((namefile != "") || (countfile != "")) {
+ string type = "count";
+ if (namefile != "") { type = "name"; }
+ if (numSeqs != numUniques) { // do fasta and name/count files match
+ m->mothurOut("[ERROR]: Your " + type + " file contains " + toString(numUniques) + " unique sequences, but your fasta file contains " + toString(numSeqs) + ". File mismatch detected, quitting command.\n"); m->control_pressed = true;
+ }
+ }
+
+ if (m->control_pressed) { m->mothurRemove(summaryFile); return 0; }
+
long long ptile0_25 = 1+(long long)(size * 0.025); //number of sequences at 2.5%
long long ptile25 = 1+(long long)(size * 0.250); //number of sequences at 25%
long long ptile50 = 1+(long long)(size * 0.500);
View
@@ -309,14 +309,16 @@ void MothurOut::setFileName(string filename) {
void MothurOut::setDefaultPath(string pathname) {
try {
- //add / to name if needed
- string lastChar = pathname.substr(pathname.length()-1);
- #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
- if (lastChar != "/") { pathname += "/"; }
- #else
- if (lastChar != "\\") { pathname += "\\"; }
- #endif
-
+ if (pathname != "") {
+ //add / to name if needed
+ string lastChar = pathname.substr(pathname.length()-1);
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
+ if (lastChar != "/") { pathname += "/"; }
+#else
+ if (lastChar != "\\") { pathname += "\\"; }
+#endif
+ }
+
defaultPath = getFullPathName(pathname);
}
@@ -329,14 +331,15 @@ void MothurOut::setDefaultPath(string pathname) {
void MothurOut::setBlastPath(string pathname) {
try {
- //add / to name if needed
- string lastChar = pathname.substr(pathname.length()-1);
+ if (pathname != "") {
+ //add / to name if needed
+ string lastChar = pathname.substr(pathname.length()-1);
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
- if (lastChar != "/") { pathname += "/"; }
+ if (lastChar != "/") { pathname += "/"; }
#else
- if (lastChar != "\\") { pathname += "\\"; }
+ if (lastChar != "\\") { pathname += "\\"; }
#endif
-
+ }
blastPath = getFullPathName(pathname);
}

0 comments on commit 462a6de

Please sign in to comment.