8DD76FAF0486AB0100D96B5E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
- dstPath = /usr/share/man/man1/;
- dstSubfolderSpec = 0;
+ dstPath = Users/SarahsWork/desktop/debug;
+ dstSubfolderSpec = 16;
files = (
8DD76FB00486AB0100D96B5E /* mothur.1 in CopyFiles */,
);
A7E9B67112D37EC400DA6239 /* canberra.h */,
A7E9B67612D37EC400DA6239 /* chao1.cpp */,
A7E9B67712D37EC400DA6239 /* chao1.h */,
- A7E9B6A412D37EC400DA6239 /* cmdargs.cpp */,
- A7E9B6A512D37EC400DA6239 /* cmdargs.h */,
A7E9B6BB12D37EC400DA6239 /* coverage.cpp */,
A7E9B6BC12D37EC400DA6239 /* coverage.h */,
A7E9B6CA12D37EC400DA6239 /* dist.h */,
children = (
A7E9B69412D37EC400DA6239 /* clearcut.cpp */,
A7E9B69512D37EC400DA6239 /* clearcut.h */,
+ A7E9B6A412D37EC400DA6239 /* cmdargs.cpp */,
+ A7E9B6A512D37EC400DA6239 /* cmdargs.h */,
A7E9B6B312D37EC400DA6239 /* common.h */,
A7E9B6CF12D37EC400DA6239 /* distclearcut.cpp */,
A7E9B6D012D37EC400DA6239 /* distclearcut.h */,
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
DEPLOYMENT_LOCATION = YES;
+ DSTROOT = TARGET_BUILD_DIR;
+ "DSTROOT[sdk=*]" = TARGET_BUILD_DIR;
GCC_DYNAMIC_NO_PIC = NO;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 3;
+ "INSTALL_PATH[sdk=*]" = TARGET_BUILD_DIR;
PRODUCT_NAME = mothur;
SDKROOT = macosx10.6;
SKIP_INSTALL = NO;
ALWAYS_SEARCH_USER_PATHS = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_LOCATION = YES;
+ DSTROOT = TARGET_BUILD_DIR;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_WARN_UNUSED_VALUE = YES;
1DEB928708733DD80010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
+ defaultConfigurationName = Debug;
};
1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "Mothur" */ = {
isa = XCConfigurationList;
1DEB928B08733DD80010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
+ defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
/**************************************************************************************************/
Bayesian::~Bayesian() {
try {
-
- delete phyloTree;
- if (database != NULL) { delete database; }
+ if (phyloTree != NULL) { delete phyloTree; }
+ if (database != NULL) { delete database; }
}
catch(exception& e) {
m->errorOut(e, "Bayesian", "~Bayesian");
}
}
/**************************************************************************************************/
-Classify::Classify() { m = MothurOut::getInstance(); database = NULL; flipped=false; }
+Classify::Classify() { m = MothurOut::getInstance(); database = NULL; phyloTree=NULL; flipped=false; }
/**************************************************************************************************/
int Classify::readTaxonomy(string file) {
m->mothurOut("Classifying sequences from " + fastaFileNames[s] + " ..." ); m->mothurOutEndLine();
string baseTName = m->getSimpleName(taxonomyFileName);
- if (taxonomyFileName == "saved") {baseTName = rdb->getSavedTaxonomy(); }
+ if (taxonomyFileName == "saved") { baseTName = rdb->getSavedTaxonomy(); }
//set rippedTaxName to
string RippedTaxName = "";
}
#endif
}
+ delete classify;
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
}
- delete classify;
+
return 0;
}
vector<char*> cPara;
- char* tempClearcut = new char[8];
- strcpy(tempClearcut, "clearcut");
+ char* tempClearcut = new char[9];
+ *tempClearcut = '\0'; strncat(tempClearcut, "clearcut", 8);
cPara.push_back(tempClearcut);
//you gave us a distance matrix
- if (phylipfile != "") { char* temp = new char[10]; strcpy(temp, "--distance"); cPara.push_back(temp); }
+ if (phylipfile != "") { char* temp = new char[11]; *temp = '\0'; strncat(temp, "--distance", 10); cPara.push_back(temp); }
//you gave us a fastafile
- if (fastafile != "") { char* temp = new char[11]; strcpy(temp, "--alignment"); cPara.push_back(temp); }
+ if (fastafile != "") { char* temp = new char[12]; *temp = '\0'; strncat(temp, "--alignment", 11); cPara.push_back(temp); }
- if (version) { char* temp = new char[9]; strcpy(temp, "--version"); cPara.push_back(temp); }
- if (verbose) { char* temp = new char[9]; strcpy(temp, "--verbose"); cPara.push_back(temp); }
- if (quiet) { char* temp = new char[7]; strcpy(temp, "--quiet"); cPara.push_back(temp); }
+ if (version) { char* temp = new char[10]; *temp = '\0'; strncat(temp, "--version", 9); cPara.push_back(temp); }
+ if (verbose) { char* temp = new char[10]; *temp = '\0'; strncat(temp, "--verbose", 9); cPara.push_back(temp); }
+ if (quiet) { char* temp = new char[8]; *temp = '\0'; strncat(temp, "--quiet", 7); cPara.push_back(temp); }
if (seed != "*") {
string tempSeed = "--seed=" + seed;
- char* temp = new char[tempSeed.length()];
- strcpy(temp, tempSeed.c_str());
+ char* temp = new char[tempSeed.length()+1];
+ *temp = '\0'; strncat(temp, tempSeed.c_str(), tempSeed.length());
cPara.push_back(temp);
}
- if (norandom) { char* temp = new char[10]; strcpy(temp, "--norandom"); cPara.push_back(temp); }
- if (shuffle) { char* temp = new char[9]; strcpy(temp, "--shuffle"); cPara.push_back(temp); }
- if (neighbor) { char* temp = new char[10]; strcpy(temp, "--neighbor"); cPara.push_back(temp); }
+ if (norandom) { char* temp = new char[11]; *temp = '\0'; strncat(temp, "--norandom", 10); cPara.push_back(temp); }
+ if (shuffle) { char* temp = new char[10]; *temp = '\0'; strncat(temp, "--shuffle", 9); cPara.push_back(temp); }
+ if (neighbor) { char* temp = new char[11]; *temp = '\0'; strncat(temp, "--neighbor", 10); cPara.push_back(temp); }
string tempIn = "--in=" + inputFile;
- char* tempI = new char[tempIn.length()];
- strcpy(tempI, tempIn.c_str());
+ char* tempI = new char[tempIn.length()+1];
+ *tempI = '\0'; strncat(tempI, tempIn.c_str(), tempIn.length());
cPara.push_back(tempI);
- if (stdoutWanted) { char* temp = new char[8]; strcpy(temp, "--stdout"); cPara.push_back(temp); }
+ if (stdoutWanted) { char* temp = new char[9]; *temp = '\0'; strncat(temp, "--stdout", 8); cPara.push_back(temp); }
else{
string tempOut = "--out=" + outputName;
-
- char* temp = new char[tempOut.length()];
- strcpy(temp, tempOut.c_str());
+ char* temp = new char[tempOut.length()+1];
+ *temp = '\0'; strncat(temp, tempOut.c_str(), tempOut.length());
cPara.push_back(temp);
}
- if (DNA) { char* temp = new char[5]; strcpy(temp, "--DNA"); cPara.push_back(temp); }
- if (protein) { char* temp = new char[9]; strcpy(temp, "--protein"); cPara.push_back(temp); }
- if (jukes) { char* temp = new char[7]; strcpy(temp, "--jukes"); cPara.push_back(temp); }
- if (kimura) { char* temp = new char[8]; strcpy(temp, "--kimura"); cPara.push_back(temp); }
+ if (DNA) { char* temp = new char[6]; *temp = '\0'; strncat(temp, "--DNA", 5); cPara.push_back(temp); }
+ if (protein) { char* temp = new char[10]; *temp = '\0'; strncat(temp, "--protein", 9); cPara.push_back(temp); }
+ if (jukes) { char* temp = new char[8]; *temp = '\0'; strncat(temp, "--jukes", 7); cPara.push_back(temp); }
+ if (kimura) { char* temp = new char[9]; *temp = '\0'; strncat(temp, "--kimura", 8); cPara.push_back(temp); }
if (matrixout != "") {
string tempMatrix = "--matrixout=" + outputDir + matrixout;
- char* temp = new char[tempMatrix.length()];
- strcpy(temp, tempMatrix.c_str());
+ char* temp = new char[tempMatrix.length()+1];
+ *temp = '\0'; strncat(temp, tempMatrix.c_str(), tempMatrix.length());
cPara.push_back(temp);
outputNames.push_back((outputDir + matrixout));
outputTypes["matrixout"].push_back((outputDir + matrixout));
if (ntrees != "1") {
string tempNtrees = "--ntrees=" + ntrees;
- char* temp = new char[tempNtrees.length()];
- strcpy(temp, tempNtrees.c_str());
+ char* temp = new char[tempNtrees.length()+1];
+ *temp = '\0'; strncat(temp, tempNtrees.c_str(), tempNtrees.length());
cPara.push_back(temp);
}
- if (expblen) { char* temp = new char[9]; strcpy(temp, "--expblen"); cPara.push_back(temp); }
- if (expdist) { char* temp = new char[9]; strcpy(temp, "--expdist"); cPara.push_back(temp); }
+ if (expblen) { char* temp = new char[10]; *temp = '\0'; strncat(temp, "--expblen", 9); cPara.push_back(temp); }
+ if (expdist) { char* temp = new char[10]; *temp = '\0'; strncat(temp, "--expdist", 9); cPara.push_back(temp); }
char** clearcutParameters;
clearcutParameters = new char*[cPara.size()];
ct = new CountTable();
ct->readTable(countfile);
read->read(ct);
- }
+ }else { read->read(nameMap); }
list = read->getListVector();
matrix = read->getDMatrix();
ct = new CountTable();
ct->readTable(thisNamefile);
read->read(ct);
- }
+ }else { read->read(nameMap); }
list = read->getListVector();
oldList = *list;
/**************************************************************************************************/
vector< map<string, float> > GetLineageCommand::getTaxons(string tax) {
try {
-
+
vector< map<string, float> > t;
string taxon = "";
int taxLength = tax.length();
+
for(int i=0;i<taxLength;i++){
if(tax[i] == ';'){
-
- int openParen = taxon.find_first_of('(');
+
+ int openParen = taxon.find_last_of('(');
int closeParen = taxon.find_last_of(')');
string newtaxon, confidence;
if ((openParen != string::npos) && (closeParen != string::npos)) {
- newtaxon = taxon.substr(0, openParen); //rip off confidence
- confidence = taxon.substr((openParen+1), (closeParen-openParen-1));
+ string confidenceScore = taxon.substr(openParen+1, (closeParen-(openParen+1)));
+ if (m->isNumeric1(confidenceScore)) { //its a confidence
+ newtaxon = taxon.substr(0, openParen); //rip off confidence
+ confidence = taxon.substr((openParen+1), (closeParen-openParen-1));
+ }else { //its part of the taxon
+ newtaxon = taxon;
+ confidence = "0";
+ }
}else{
newtaxon = taxon;
confidence = "0";
map<string, float> temp;
temp[newtaxon] = con;
+
t.push_back(temp);
-
taxon = "";
}
else{
taxon += tax[i];
+
}
}
#include "ordervector.hpp"
#include "listvector.hpp"
+//sorts highest to lowest
+/***********************************************************************/
+inline bool abundNamesSort(string left, string right){
+
+ int countLeft = 0;
+ if(left != ""){
+ countLeft = 1;
+ for(int i=0;i<left.size();i++){ if(left[i] == ','){ countLeft++; } }
+ }
+
+ int countRight = 0;
+ if(right != ""){
+ countRight = 1;
+ for(int i=0;i<right.size();i++){ if(right[i] == ','){ countRight++; } }
+ }
+
+ if (countLeft > countRight) {
+ return true;
+ }
+ return false;
+}
/***********************************************************************/
try {
output << label << '\t' << numBins << '\t';
- for(int i=0;i<data.size();i++){
- if(data[i] != ""){
- output << data[i] << '\t';
+ vector<string> hold = data;
+ sort(hold.begin(), hold.end(), abundNamesSort);
+
+ for(int i=0;i<hold.size();i++){
+ if(hold[i] != ""){
+ output << hold[i] << '\t';
}
}
output << endl;
CYGWIN_BUILD ?= no
USECOMPRESSION ?= no
MOTHUR_FILES="\"Enter_your_default_path_here\""
-RELEASE_DATE = "\"7/9/2012\""
-VERSION = "\"1.26.0\""
-FORTAN_COMPILER = /usr/local/gfortran/bin/gfortran
+RELEASE_DATE = "\"11/2/2012\""
+VERSION = "\"1.28.0\""
+FORTAN_COMPILER = gfortran
FORTRAN_FLAGS =
# Optimize to level 3:
else { subsample = false; }
}
- if (subsample == false) { iters = 1; }
+ if (subsample == false) { iters = 0; }
if (abort == false) {
string distFileName = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + matrixCalculators[i]->getName() + "." + thisLookup[0]->getLabel() + "." + output + "." + getOutputFileNameTag("phylip");
outputNames.push_back(distFileName); outputTypes["phylip"].push_back(distFileName);
+
ofstream outDist;
m->openOutputFile(distFileName, outDist);
outDist.setf(ios::fixed, ios::floatfield); outDist.setf(ios::showpoint);
for (int i = 0; i < calcDists.size(); i++) { calcDists[i].clear(); }
}
- if (iters != 1) {
+ if (iters != 0) {
//we need to find the average distance and standard deviation for each groups distance
vector< vector<seqDist> > calcAverages; calcAverages.resize(matrixCalculators.size());
string firstName, secondName;
float dist;
- while (input) {
+ while (!input.eof()) {
input >> firstName >> secondName >> dist;
output << dist << '\t' << firstName << '\t' << secondName << endl;
gobble(input);
//read in sorted file and put distance at end again
ifstream input2;
+ ofstream output2;
openInputFile(tempOutfile, input2);
- openOutputFile(outfile, output);
+ openOutputFile(outfile, output2);
- while (input2) {
+ while (!input2.eof()) {
input2 >> dist >> firstName >> secondName;
- output << firstName << '\t' << secondName << '\t' << dist << endl;
+ output2 << firstName << '\t' << secondName << '\t' << dist << endl;
gobble(input2);
}
input2.close();
- output.close();
+ output2.close();
//remove temp files
mothurRemove(tempDistFile);
//This function parses the estimator options and puts them in a vector
void MothurOut::splitAtChar(string& estim, vector<string>& container, char symbol) {
try {
+
+ if (symbol == '-') { splitAtDash(estim, container); return; }
+
string individual = "";
int estimLength = estim.size();
for(int i=0;i<estimLength;i++){
*/
#include "phylosummary.h"
+#include "referencedb.h"
/**************************************************************************************************/
PhyloSummary::PhyloSummary(string refTfile, CountTable* c){
groupmap = NULL;
//check for necessary files
+ if (refTfile == "saved") { ReferenceDB* rdb = ReferenceDB::getInstance(); refTfile = rdb->getSavedTaxonomy(); }
string taxFileNameTest = m->getFullPathName((refTfile.substr(0,refTfile.find_last_of(".")+1) + "tree.sum"));
ifstream FileTest(taxFileNameTest.c_str());
ct = NULL;
//check for necessary files
+ if (refTfile == "saved") { ReferenceDB* rdb = ReferenceDB::getInstance(); refTfile = rdb->getSavedTaxonomy(); }
string taxFileNameTest = m->getFullPathName((refTfile.substr(0,refTfile.find_last_of(".")+1) + "tree.sum"));
ifstream FileTest(taxFileNameTest.c_str());
int taxLength = tax.length();
for(int i=0;i<taxLength;i++){
if(tax[i] == ';'){
-
- int openParen = taxon.find_first_of('(');
+
+ int openParen = taxon.find_last_of('(');
int closeParen = taxon.find_last_of(')');
string newtaxon, confidence;
if ((openParen != string::npos) && (closeParen != string::npos)) {
- newtaxon = taxon.substr(0, openParen); //rip off confidence
- confidence = taxon.substr((openParen+1), (closeParen-openParen-1));
+ string confidenceScore = taxon.substr(openParen+1, (closeParen-(openParen+1)));
+ if (m->isNumeric1(confidenceScore)) { //its a confidence
+ newtaxon = taxon.substr(0, openParen); //rip off confidence
+ confidence = taxon.substr((openParen+1), (closeParen-openParen-1));
+ }else { //its part of the taxon
+ newtaxon = taxon;
+ confidence = "0";
+ }
}else{
newtaxon = taxon;
confidence = "0";
- }
+ }
float con = 0;
convert(confidence, con);
map<string, float> temp;
temp[newtaxon] = con;
t.push_back(temp);
-
taxon = "";
}
else{
string SplitGroupCommand::getHelpString(){
try {
string helpString = "";
- helpString += "The split.group command reads a group or count file, and parses your fasta and names or count files by groups. \n";
- helpString += "The split.group command parameters are fasta, name, group, count and groups.\n";
+ helpString += "The split.groups command reads a group or count file, and parses your fasta and names or count files by groups. \n";
+ helpString += "The split.groups command parameters are fasta, name, group, count and groups.\n";
helpString += "The fasta and group or count parameters are required.\n";
helpString += "The groups parameter allows you to select groups to create files for. \n";
helpString += "For example if you set groups=A-B-C, you will get a .A.fasta, .A.names, .B.fasta, .B.names, .C.fasta, .C.names files. \n";
helpString += "If you want .fasta and .names files for all groups, set groups=all. \n";
- helpString += "The split.group command should be used in the following format: split.group(fasta=yourFasta, group=yourGroupFile).\n";
- helpString += "Example: split.group(fasta=abrecovery.fasta, group=abrecovery.groups).\n";
+ helpString += "The split.groups command should be used in the following format: split.group(fasta=yourFasta, group=yourGroupFile).\n";
+ helpString += "Example: split.groups(fasta=abrecovery.fasta, group=abrecovery.groups).\n";
helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n";
return helpString;
}
ofstream out;
string newtempNameFile = tempNameFile + "2";
m->openOutputFile(newtempNameFile, out);
- out << headers << endl;
+ out << "Representative_Sequence\ttotal" << endl;
out.close();
m->appendFiles(tempNameFile, newtempNameFile);
m->mothurRemove(tempNameFile);
ofstream out;
string newtempNameFile = singleton + "2";
m->openOutputFile(newtempNameFile, out);
- out << headers << endl;
+ out << "Representative_Sequence\ttotal" << endl;
out.close();
m->appendFiles(singleton, newtempNameFile);
m->mothurRemove(singleton);
readMatrix->setCutoff(cutoff);
ct = NULL;
+ nameMap = NULL;
if(namefile != ""){
nameMap = new NameAssignment(namefile);
nameMap->readMap();
ct = new CountTable();
ct->readTable(countfile);
readMatrix->read(ct);
+ }else {
+ readMatrix->read(nameMap);
}
list = readMatrix->getListVector();
string s; //to make work with setgroups
Groups = m->getGroups();
vector<string> nameGroups = ct->getNamesOfGroups();
- util.setGroups(Groups, nameGroups, s, numGroups, "weighted"); //sets the groups the user wants to analyze
+ if (nameGroups.size() < 2) { m->mothurOut("[ERROR]: You cannot run unifrac.weighted with less than 2 groups, aborting.\n"); delete ct; for (int i = 0; i < T.size(); i++) { delete T[i]; } return 0; }
+ util.setGroups(Groups, nameGroups, s, numGroups, "weighted"); //sets the groups the user wants to analyze
m->setGroups(Groups);
if (m->control_pressed) { delete ct; for (int i = 0; i < T.size(); i++) { delete T[i]; } return 0; }