]> git.donarmstrong.com Git - mothur.git/commitdiff
added unix to ifdefs. minor changes while testing 1.24.0.
authorSarah Westcott <mothur.westcott@gmail.com>
Tue, 13 Mar 2012 18:16:50 +0000 (14:16 -0400)
committerSarah Westcott <mothur.westcott@gmail.com>
Tue, 13 Mar 2012 18:16:50 +0000 (14:16 -0400)
76 files changed:
Mothur.xcodeproj/project.pbxproj
aligncommand.cpp
aligncommand.h
bayesian.cpp
bellerophon.cpp
blastdb.cpp
catchallcommand.cpp
chimeraccodecommand.cpp
chimeracheckcommand.cpp
chimeraperseuscommand.cpp
chimeraperseuscommand.h
chimerapintailcommand.cpp
chimeraslayercommand.cpp
chimeraslayercommand.h
chimerauchimecommand.cpp
chimerauchimecommand.h
classifyseqscommand.cpp
classifyseqscommand.h
clustersplitcommand.cpp
clustersplitcommand.h
cooccurrencecommand.cpp
distancecommand.cpp
distancecommand.h
engine.cpp
filterseqscommand.cpp
filterseqscommand.h
formatcolumn.cpp
formatphylip.cpp
indicatorcommand.cpp
makefile
matrixoutputcommand.cpp
matrixoutputcommand.h
metastatscommand.cpp
metastatscommand.h
mothur.cpp
mothur.h
mothurout.cpp
myseqdist.cpp
myutils.cpp
otuassociationcommand.cpp
pairwiseseqscommand.cpp
pairwiseseqscommand.h
parsefastaqcommand.cpp
parsimony.cpp
phylodiversitycommand.cpp
pintail.cpp
preclustercommand.cpp
preclustercommand.h
rarefact.cpp
rarefactcommand.cpp
rarefactcommand.h
screenseqscommand.cpp
screenseqscommand.h
seqerrorcommand.cpp
seqsummarycommand.cpp
seqsummarycommand.h
setdircommand.cpp
sffinfocommand.cpp
sffinfocommand.h
shhhercommand.cpp
shhhercommand.h
shhhseqscommand.cpp
shhhseqscommand.h
summaryqualcommand.cpp
summaryqualcommand.h
summarysharedcommand.cpp
summarysharedcommand.h
trialSwap2.cpp
trialswap2.h
trimflowscommand.cpp
trimflowscommand.h
trimseqscommand.cpp
trimseqscommand.h
unifracweightedcommand.cpp
unweighted.cpp
weighted.cpp

index 0951dd282539d7be981b1bc0b17fdeb52cb303fd..4d525544fe33ce894143e5b4880bbce04401fadf 100644 (file)
                                GCC_OPTIMIZATION_LEVEL = 0;
                                GCC_PREPROCESSOR_DEFINITIONS = (
                                        "MOTHUR_FILES=\"\\\"../release\\\"\"",
-                                       "VERSION=\"\\\"1.23.0\\\"\"",
-                                       "RELEASE_DATE=\"\\\"1/9/2012\\\"\"",
+                                       "VERSION=\"\\\"1.24.0\\\"\"",
+                                       "RELEASE_DATE=\"\\\"3/12/2012\\\"\"",
                                );
                                "GCC_VERSION[arch=*]" = "";
                                GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
                                GCC_MODEL_TUNING = "";
                                GCC_OPTIMIZATION_LEVEL = 0;
                                GCC_PREPROCESSOR_DEFINITIONS = (
-                                       "VERSION=\"\\\"1.19.0\\\"\"",
-                                       "RELEASE_DATE=\"\\\"5/9/2011\\\"\"",
+                                       "VERSION=\"\\\"1.24.0\\\"\"",
+                                       "RELEASE_DATE=\"\\\"3/12/2012\\\"\"",
                                );
                                GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
index f03a9017d4867f1d8634a0ef72a25f1590bf13b6..8215de301b646f4d4571944de85dddb40478e7e5 100644 (file)
@@ -422,7 +422,7 @@ int AlignCommand::execute(){
 #else
 
                        vector<unsigned long long> positions; 
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        positions = m->divideFile(candidateFileNames[s], processors);
                        for (int i = 0; i < (positions.size()-1); i++) {        lines.push_back(new linePair(positions[i], positions[(i+1)]));  }
                #else
@@ -430,7 +430,8 @@ int AlignCommand::execute(){
                                lines.push_back(new linePair(0, 1000));
                        }else {
                                positions = m->setFilePosFasta(candidateFileNames[s], numFastaSeqs); 
-                               
+                               if (positions.size() < processors) { processors = positions.size(); }
+                
                                //figure out how many sequences you have to process
                                int numSeqsPerProcessor = numFastaSeqs / processors;
                                for (int i = 0; i < processors; i++) {
@@ -617,7 +618,7 @@ int AlignCommand::driver(linePair* filePos, string alignFName, string reportFNam
                        }
                        delete candidateSeq;
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = inFASTA.tellg();
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
@@ -826,7 +827,7 @@ int AlignCommand::createProcesses(string alignFileName, string reportFileName, s
        try {
                int num = 0;
                processIDS.resize(0);
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                
                //loop through and create all the processes you want
index b455761ed6fdcf2e8c11a6bcbb52b1704caee464..c7ce14406c570f50a3510532e55ba7b5469c5c62 100644 (file)
@@ -120,7 +120,7 @@ struct alignData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ 
        alignData* pDataArray;
index eca63b1a9168613a92232777e520efcaa586f328..54a123c5a7835d7c1a2c48d36fe3ec7070462027 100644 (file)
@@ -605,7 +605,7 @@ void Bayesian::readProbFile(ifstream& in, ifstream& inNum, string inName, string
                                istringstream iss (tempBuf,istringstream::in);
                                float probTemp;
                                iss >> zeroCountProb[i] >> numbers[i] >> probTemp; 
-                               WordPairDiffArr[i].prob = tempProb;
+                               WordPairDiffArr[i].prob = probTemp;
 
                        }
                        
index 9dd21a4446e8d0ebd60ad7438dabe73d7a293128..833cfb907d6d4bd2aed8acb3d8522932ac3b2e7d 100644 (file)
@@ -314,7 +314,7 @@ int Bellerophon::getChimeras() {
        #else
        
                //divide breakpoints between processors
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        if(processors == 1){ 
                                lines.push_back(linePair(0, iters));    
                                
@@ -356,7 +356,7 @@ int Bellerophon::getChimeras() {
 
 int Bellerophon::createProcesses(vector<int> mid) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 0;
                int exitCommand = 1;
                vector<int> processIDS;
index bc646dfaa498750448ba741f5649450a185415dd..2eced7e14dc6fa42e0147747fc622bfa088250f7 100644 (file)
@@ -24,7 +24,7 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) {
                int randNumber = rand();
                //int randNumber = 12345;
                string pid = "";
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                pid += getpid();        
 #else
                pid += toString(threadID);      
@@ -42,7 +42,7 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) {
                        for (int i = 0; i < path.length(); i++) { tempPath[i] = tolower(path[i]); }
                        path = path.substr(0, (tempPath.find_last_of('m')));
                        
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        path += "blast/bin/";   
 #else
                        path += "blast\\bin\\";
@@ -51,7 +51,7 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) {
                
                
                string formatdbCommand;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                formatdbCommand = path + "formatdb";    //      format the database, -o option gives us the ability
 #else
                formatdbCommand = path + "formatdb.exe";
@@ -64,7 +64,7 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) {
                if(ableToOpen == 1) {   m->mothurOut("[ERROR]: " + formatdbCommand + " file does not exist. mothur requires formatdb.exe."); m->mothurOutEndLine(); m->control_pressed = true; }
                
                string blastCommand;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                blastCommand = path + "blastall";       //      format the database, -o option gives us the ability
 #else
                blastCommand = path + "blastall.exe";
@@ -80,7 +80,7 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) {
                
                
                string megablastCommand;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                megablastCommand = path + "megablast";  //      format the database, -o option gives us the ability
 #else
                megablastCommand = path + "megablast.exe";
@@ -114,7 +114,7 @@ BlastDB::BlastDB(string b, int tid) : Database() {
                        for (int i = 0; i < path.length(); i++) { tempPath[i] = tolower(path[i]); }
                        path = path.substr(0, (tempPath.find_last_of('m')));
                        
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        path += "blast/bin/";   
 #else
                        path += "blast\\bin\\";
@@ -123,7 +123,7 @@ BlastDB::BlastDB(string b, int tid) : Database() {
                
                int randNumber = rand();
                string pid = "";
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                pid += getpid();        
 #else
                pid += toString(threadID);      
@@ -134,7 +134,7 @@ BlastDB::BlastDB(string b, int tid) : Database() {
                blastFileName = pid + toString(randNumber) + ".blast";
                
                string formatdbCommand;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                formatdbCommand = path + "formatdb";    //      format the database, -o option gives us the ability
 #else
                formatdbCommand = path + "formatdb.exe";
@@ -149,7 +149,7 @@ BlastDB::BlastDB(string b, int tid) : Database() {
                if(ableToOpen == 1) {   m->mothurOut("[ERROR]: " +  formatdbCommand + " file does not exist. mothur requires formatdb.exe."); m->mothurOutEndLine(); m->control_pressed = true; }
                
                string blastCommand;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                blastCommand = path + "blastall";       //      format the database, -o option gives us the ability
 #else
                blastCommand = path + "blastall.exe";
@@ -165,7 +165,7 @@ BlastDB::BlastDB(string b, int tid) : Database() {
                
                
                string megablastCommand;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                megablastCommand = path + "megablast";  //      format the database, -o option gives us the ability
 #else
                megablastCommand = path + "megablast.exe";
@@ -226,7 +226,7 @@ vector<int> BlastDB::findClosestSequences(Sequence* seq, int n) {
                //      long.  With this setting, it seems comparable in speed to the suffix tree approach.
                
                string blastCommand;
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                
                        blastCommand = path + "blastall -p blastn -d " + dbFileName + " -m 8 -W 28 -v " + toString(n) + " -b " + toString(n);
                        blastCommand += (" -i " + (queryFileName+pid+toString(randNumber)) + " -o " + blastFileName+pid+toString(randNumber));
@@ -289,7 +289,7 @@ vector<int> BlastDB::findClosestMegaBlast(Sequence* seq, int n, int minPerID) {
                //      long.  With this setting, it seems comparable in speed to the suffix tree approach.
 //7000004128189528left 0       100             66      0       0       1       66      61      126     1e-31    131    
                string blastCommand;
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        blastCommand = path + "megablast -e 1e-10 -d " + dbFileName + " -m 8 -b " + toString(n) + " -v " + toString(n); //-W 28 -p blastn
                        blastCommand += (" -i " + (queryFileName+pid+toString(randNumber)) + " -o " + blastFileName+pid+toString(randNumber));
                #else
@@ -363,7 +363,7 @@ void BlastDB::generateDB() {
                        
                string formatdbCommand;
                
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        formatdbCommand = path + "formatdb -p F -o T -i " + dbFileName; //      format the database, -o option gives us the ability
                #else
                        //formatdbCommand = path + "blast\\bin\\formatdb -p F -o T -i " + dbFileName;   //      format the database, -o option gives us the ability
index 857f68431c54b8a0076577ae74b70ecfba6e9773..bf866cbedca07b7ee8b732eec683c64520ee2017 100644 (file)
@@ -176,7 +176,7 @@ int CatchAllCommand::execute() {
                
                savedOutputDir = outputDir;
                string catchAllCommandExe = ""; 
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        catchAllCommandExe += "mono " + path + "CatchAllcmdL.exe ";
                        if (outputDir == "") { outputDir = "./"; } //force full pathname to be created for catchall, this is necessary because if catchall is in the path it will look for input file whereever the exe is and not the cwd.
                #else
@@ -224,7 +224,7 @@ int CatchAllCommand::execute() {
                                                                                        
                                                //create system command
                                                string catchAllCommand = "";
-                                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                                        catchAllCommand += catchAllCommandExe + filename + " " + outputPath + " 1";
                                                #else
                                                        if (outputPath.length() > 0) { outputPath = outputPath.substr(0, outputPath.length()-1); }
@@ -269,7 +269,7 @@ int CatchAllCommand::execute() {
                                                                                        
                                                //create system command
                                                string catchAllCommand = "";
-                                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                                        catchAllCommand += catchAllCommandExe + filename + " " + outputPath + " 1";
                                                #else
                                                        if (outputPath.length() > 0) { outputPath = outputPath.substr(0, outputPath.length()-1); }
@@ -334,7 +334,7 @@ int CatchAllCommand::execute() {
                                
                                //create system command
                                string catchAllCommand = "";
-                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                        catchAllCommand += catchAllCommandExe + filename + " " + outputPath + " 1";
                                #else
                                        if (outputPath.length() > 0) { outputPath = outputPath.substr(0, outputPath.length()-1); }
index af6e33a1254adc623948604100f8b9109e6c18e6..fc98e0fc45c3b576a3e2420ac415c016266b4c1c 100644 (file)
@@ -393,7 +393,7 @@ int ChimeraCcodeCommand::execute(){
                        
                        
                        //break up file
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                vector<unsigned long long> positions = m->divideFile(fastaFileNames[s], processors);
                        
                                for (int i = 0; i < (positions.size()-1); i++) {
@@ -524,7 +524,7 @@ int ChimeraCcodeCommand::driver(linePair* filePos, string outputFName, string fi
                        }
                        delete candidateSeq;
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = inFASTA.tellg();
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
@@ -611,7 +611,7 @@ int ChimeraCcodeCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File
 
 int ChimeraCcodeCommand::createProcesses(string outputFileName, string filename, string accnos) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 0;
                int num = 0;
                
index 9f53b1753903a44b469f0766a261894cb3177476..cc486d3ab690fd655c1de8a22ae406eafc2c242f 100644 (file)
@@ -427,7 +427,7 @@ int ChimeraCheckCommand::execute(){
                        
                        
                        //break up file
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                vector<unsigned long long> positions = m->divideFile(fastaFileNames[i], processors);
                        
                                for (int s = 0; s < (positions.size()-1); s++) {
@@ -522,7 +522,7 @@ int ChimeraCheckCommand::driver(linePair* filePos, string outputFName, string fi
                        }
                        delete candidateSeq;
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = inFASTA.tellg();
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
@@ -599,7 +599,7 @@ int ChimeraCheckCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File
 
 int ChimeraCheckCommand::createProcesses(string outputFileName, string filename) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 0;
                int num = 0;
                
index 76f0103c38ec64a5ebc21f3175df441a15ccae0e..138a6b969b48b392e10ea1329a15444cc66deb97 100644 (file)
@@ -768,7 +768,7 @@ int ChimeraPerseusCommand::createProcessesGroups(SequenceParser& parser, string
                        lines.push_back(linePair(startIndex, endIndex));
                }
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)          
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)         
                
                //loop through and create all the processes you want
                while (process != processors) {
index 45627500f6f8f9944aee508db3ffbbd8960956c1..01f5768a0c070c70aa6c7264b6d482b3636d7148 100644 (file)
@@ -98,7 +98,7 @@ struct perseusData {
        }
 };
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyPerseusThreadFunction(LPVOID lpParam){ 
        perseusData* pDataArray;
index 3eb6589a83beebf79f8cf812ce519b35d0bcc37e..7311173265d55bbac59af028922de1f7f7e5d447 100644 (file)
@@ -488,7 +488,7 @@ int ChimeraPintailCommand::execute(){
                #else
                                                
                        //break up file
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                vector<unsigned long long> positions = m->divideFile(fastaFileNames[s], processors);
                        
                                for (int i = 0; i < (positions.size()-1); i++) {
@@ -611,7 +611,7 @@ int ChimeraPintailCommand::driver(linePair* filePos, string outputFName, string
                        }
                        delete candidateSeq;
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = inFASTA.tellg();
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
@@ -697,7 +697,7 @@ int ChimeraPintailCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_Fi
 
 int ChimeraPintailCommand::createProcesses(string outputFileName, string filename, string accnos) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 0;
                int num = 0;
                
index cfcad1514ca629823081f54e35156934275644b1..8647e7510088014e48153f33a81fec8fd62ee64e 100644 (file)
@@ -495,14 +495,14 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                        else {
                                //add / to name if needed
                                string lastChar = blastlocation.substr(blastlocation.length()-1);
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if (lastChar != "/") { blastlocation += "/"; }
 #else
                                if (lastChar != "\\") { blastlocation += "\\"; }        
 #endif
                                blastlocation = m->getFullPathName(blastlocation);
                                string formatdbCommand = "";
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                formatdbCommand = blastlocation + "formatdb";   
 #else
                                formatdbCommand = blastlocation + "formatdb.exe";
@@ -515,7 +515,7 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                                if(ableToOpen == 1) {   m->mothurOut("[ERROR]: " + formatdbCommand + " file does not exist. mothur requires formatdb.exe to run chimera.slayer."); m->mothurOutEndLine(); abort = true; }
                                
                                string blastCommand = "";
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                blastCommand = blastlocation + "megablast";     
 #else
                                blastCommand = blastlocation + "megablast.exe";
@@ -533,7 +533,7 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                        if (hasGroup && (templatefile != "self")) { m->mothurOut("You have provided a group file and the reference parameter is not set to self. I am not sure what reference you are trying to use, aborting."); m->mothurOutEndLine(); abort=true; }
 
                        //until we resolve the issue 10-18-11
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
                        //processors=1;
 #endif
@@ -594,13 +594,14 @@ int ChimeraSlayerCommand::execute(){
 #else
                                //break up file
                                vector<unsigned long long> positions; 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                positions = m->divideFile(thisFastaName, processors);
                                for (int i = 0; i < (positions.size()-1); i++) {        lines.push_back(linePair(positions[i], positions[(i+1)]));      }
 #else
                                if (processors == 1) {  lines.push_back(linePair(0, 1000)); }
                                else {
                                        positions = m->setFilePosFasta(thisFastaName, numSeqs); 
+                    if (positions.size() < processors) { processors = positions.size(); }
                                        
                                        //figure out how many sequences you have to process
                                        int numSeqsPerProcessor = numSeqs / processors;
@@ -900,6 +901,16 @@ int ChimeraSlayerCommand::deconvoluteResults(SequenceParser* parser, string outp
                map<string, string> uniqueNames = parser->getAllSeqsMap();
                map<string, string>::iterator itUnique;
                int total = 0;
+        
+        if (trimera) { //add in more potential uniqueNames
+            map<string, string> newUniqueNames = uniqueNames;
+            for (map<string, string>::iterator it = uniqueNames.begin(); it != uniqueNames.end(); it++) {
+                newUniqueNames[(it->first)+"_LEFT"] = (it->first)+"_LEFT";
+                newUniqueNames[(it->first)+"_RIGHT"] = (it->first)+"_RIGHT";
+            }
+            uniqueNames = newUniqueNames;
+            newUniqueNames.clear();
+        }
                
                //edit accnos file
                ifstream in2; 
@@ -1187,7 +1198,7 @@ int ChimeraSlayerCommand::driverGroups(string outputFName, string accnos, string
                        m->mothurOutEndLine(); m->mothurOut("Checking sequences from group: " + fileGroup[thisFastaName] + "."); m->mothurOutEndLine(); 
                        
                        lines.clear();
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        int proc = 1;
                        vector<unsigned long long> positions = m->divideFile(thisFastaName, proc);
                        lines.push_back(linePair(positions[0], positions[1]));  
@@ -1244,7 +1255,7 @@ int ChimeraSlayerCommand::createProcessesGroups(string outputFName, string accno
                        breakUp.push_back(thisFileToPriority);
                }
                                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                //loop through and create all the processes you want
                while (process != processors) {
                        int pid = fork();
@@ -1447,7 +1458,7 @@ int ChimeraSlayerCommand::driver(linePair filePos, string outputFName, string fi
                                count++;
                        }
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = inFASTA.tellg();
                                if ((pos == -1) || (pos >= filePos.end)) { break; }
                        #else
@@ -1628,7 +1639,7 @@ int ChimeraSlayerCommand::createProcesses(string outputFileName, string filename
                int num = 0;
                processIDS.clear();
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                //loop through and create all the processes you want
                while (process != processors) {
                        int pid = fork();
index 6f3455debc4b6f161102a7bd2a75e797d3c639f0..2c6fec8d8d1082ea270f5e2c2a8832a7b57033a4 100644 (file)
@@ -172,7 +172,7 @@ struct slayerData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MySlayerThreadFunction(LPVOID lpParam){ 
        slayerData* pDataArray;
index 01289a0d0edf66969827d65a11a703c24da86845..98976ce39070321aa5b94964c49ebd238cd9b778 100644 (file)
@@ -461,7 +461,7 @@ ChimeraUchimeCommand::ChimeraUchimeCommand(string option)  {
                        path = path.substr(0, (tempPath.find_last_of('m')));
                        
                        string uchimeCommand;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        uchimeCommand = path + "uchime";        //      format the database, -o option gives us the ability
 #else
                        uchimeCommand = path + "uchime.exe";
@@ -1005,7 +1005,7 @@ int ChimeraUchimeCommand::driver(string outputFName, string filename, string acc
                path = path.substr(0, (tempPath.find_last_of('m')));
                
                string uchimeCommand = path;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                uchimeCommand += "uchime ";
 #else
                uchimeCommand += "uchime";
@@ -1243,7 +1243,7 @@ int ChimeraUchimeCommand::driver(string outputFName, string filename, string acc
                
                //uchime_main(numArgs, uchimeParameters); 
                //cout << "commandString = " << commandString << endl;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
                commandString = "\"" + commandString + "\"";
 #endif
@@ -1309,7 +1309,7 @@ int ChimeraUchimeCommand::createProcesses(string outputFileName, string filename
                int num = 0;
                vector<string> files;
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)          
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)         
                //break up file into multiple files
                m->divideFile(filename, processors, files);
                
@@ -1492,7 +1492,7 @@ int ChimeraUchimeCommand::createProcessesGroups(SequenceParser& parser, string o
                        lines.push_back(linePair(startIndex, endIndex));
                }
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)          
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)         
                                
                //loop through and create all the processes you want
                while (process != processors) {
index b401ae85ae3c22e6d587fd27e649d27db9c6d939..499b18298dfffc66657f62fd00d48d7c3846bb15 100644 (file)
@@ -141,7 +141,7 @@ struct uchimeData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){ 
        uchimeData* pDataArray;
@@ -189,7 +189,7 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){
                        path = path.substr(0, (tempPath.find_last_of('m')));
                        
                        string uchimeCommand = path;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        uchimeCommand += "uchime ";
 #else
                        uchimeCommand += "uchime";
@@ -403,7 +403,7 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){
                        
                        //uchime_main(numArgs, uchimeParameters); 
                        //cout << "commandString = " << commandString << endl;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
                        commandString = "\"" + commandString + "\"";
 #endif
index 72acd2265a06af1b77dc525f3627e51c458e6aed..664db6b3fdf7f991b851472405dc1493b0369147 100644 (file)
@@ -615,7 +615,7 @@ int ClassifySeqsCommand::execute(){
 #else
                
                        vector<unsigned long long> positions; 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        positions = m->divideFile(fastaFileNames[s], processors);
                        for (int i = 0; i < (positions.size()-1); i++) {        lines.push_back(new linePair(positions[i], positions[(i+1)]));  }
 #else
@@ -623,6 +623,7 @@ int ClassifySeqsCommand::execute(){
                                lines.push_back(new linePair(0, 1000));
                        }else {
                                positions = m->setFilePosFasta(fastaFileNames[s], numFastaSeqs); 
+                if (positions.size() < processors) { processors = positions.size(); }
                                
                                //figure out how many sequences you have to process
                                int numSeqsPerProcessor = numFastaSeqs / processors;
@@ -821,7 +822,7 @@ int ClassifySeqsCommand::createProcesses(string taxFileName, string tempTaxFile,
                int num = 0;
                processIDS.clear();
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                
                //loop through and create all the processes you want
@@ -1021,7 +1022,7 @@ int ClassifySeqsCommand::driver(linePair* filePos, string taxFName, string tempT
                        }
                        delete candidateSeq;
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = inFASTA.tellg();
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
index f0c67ba3d1ff812cef4026c43a81503b9379eec4..d410558785a4dd00a2df9bb9df71cfb8527093d5 100644 (file)
@@ -130,7 +130,7 @@ struct classifyData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyClassThreadFunction(LPVOID lpParam){ 
        classifyData* pDataArray;
index bb9296fe93b25e663d8f0f226dfaf8b4fadc4b54..8a19f1d4f1b7991e8a5155ed5156e638276d860e 100644 (file)
@@ -554,7 +554,7 @@ int ClusterSplitCommand::execute(){
                //sanity check
                if (processors > distName.size()) { processors = distName.size(); }
                
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if(processors == 1){
                                        listFileNames = cluster(distName, labels); //clusters individual files and returns names of list files
                                }else{
@@ -868,7 +868,7 @@ vector<string>  ClusterSplitCommand::createProcesses(vector< map<string, string>
         
         if (m->control_pressed) { return listFiles; }
        
-       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                processIDS.clear();
                
index cf52ff27d01c28d61f90aa0a8c514d4a04b2136d..0e32ffaea7710189859f458de4adc897362e12ef 100644 (file)
@@ -102,7 +102,7 @@ struct clusterData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyClusterThreadFunction(LPVOID lpParam){ 
        clusterData* pDataArray;
index b67c6ea02c5b71befcd467127b0db554f124cb4b..6864f799f99a1533766f7350f0a6d8a409fe2876 100644 (file)
@@ -253,6 +253,7 @@ int CooccurrenceCommand::execute(){
         
                //reset groups parameter 
                delete input; 
+        m->clearGroups(); 
 
         m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
@@ -271,12 +272,12 @@ int CooccurrenceCommand::execute(){
 int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp, ofstream& out){
        try {
         int numOTUS = thisLookUp[0]->getNumBins();
-        vector< vector<int> > initmatrix (thisLookUp.size());
-        vector< vector<int> > co_matrix (thisLookUp[0]->getNumBins());
+        vector< vector<int> > initmatrix; initmatrix.resize(thisLookUp.size());
+        vector< vector<int> > co_matrix; co_matrix.resize(thisLookUp[0]->getNumBins());
         for (int i = 0; i < thisLookUp[0]->getNumBins(); i++) { co_matrix[i].resize((thisLookUp.size()), 0); }
         for (int i = 0; i < thisLookUp.size(); i++) { initmatrix[i].resize((thisLookUp[i]->getNumBins()), 0); }
-        vector<int> columntotal(thisLookUp.size(), 0);
-        vector<int> rowtotal(numOTUS, 0);
+        vector<int> columntotal; columntotal.resize(thisLookUp.size(), 0);
+        vector<int> rowtotal; rowtotal.resize(numOTUS, 0);
         
         int rowcount = 0;
         for (int i = 0; i < thisLookUp.size(); i++) {
@@ -298,7 +299,7 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
         //nrows is ncols of inital matrix. All the functions need this value. They assume the transposition has already taken place and nrows and ncols refer to that matrix.
         //comatrix and initmatrix are still vectors of vectors of ints as in the original script. The abundancevector is only what was read in ie not a co-occurrence matrix!
         int ncols = numOTUS;//rows of inital matrix
-        int nrows = thisLookUp.size();//OTUs
+        int nrows = thisLookUp.size();//groups
         double initscore = 0.0;
         //transpose matrix
         int newmatrows = ncols;
@@ -308,8 +309,8 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
         nrows = newmatrows;//ncols;
         ncols = newmatcols;//nrows;
         
-        vector<int> initcolumntotal(ncols, 0);
-        vector<int> initrowtotal(nrows, 0);
+        vector<int> initcolumntotal; initcolumntotal.resize(ncols, 0);
+        vector<int> initrowtotal; initrowtotal.resize(nrows, 0);
         vector<double> stats;
                
         TrialSwap2 trial;
index 0ac17877b2bed9bfc441a70dcece14cd99081727..79b8fe7c10544dafd2675a963a2229eb2e3e7046 100644 (file)
@@ -380,7 +380,7 @@ int DistanceCommand::execute(){
                MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
 #else          
                                
-       //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+       //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                //if you don't need to fork anything
                if(processors == 1){
                        if (output != "square") {  driver(0, numSeqs, outputFile, cutoff); }
@@ -507,7 +507,7 @@ int DistanceCommand::execute(){
 /**************************************************************************************************/
 void DistanceCommand::createProcesses(string filename) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                processIDS.clear();
                
@@ -1014,7 +1014,7 @@ int DistanceCommand::convertMatrix(string outputFile) {
                string outfile = m->getRootName(outputFile) + "sorted.dist.temp";
                
                //use the unix sort 
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        string command = "sort -n " + outputFile + " -o " + outfile;
                        system(command.c_str());
                #else //sort using windows sort
@@ -1102,7 +1102,7 @@ int DistanceCommand::convertToLowerTriangle(string outputFile) {
                string outfile = m->getRootName(outputFile) + "sorted.dist.temp";
                
                //use the unix sort 
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        string command = "sort -n " + outputFile + " -o " + outfile;
                        system(command.c_str());
                #else //sort using windows sort
index f55f7144fa548fe30eae2b075a8abcf8fd4584f0..91f0ed50b3003345454690b7aecc049c449854d8 100644 (file)
@@ -53,7 +53,7 @@ struct distanceData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyDistThreadFunction(LPVOID lpParam){ 
        distanceData* pDataArray;
index ea1c0e14dc9f89fe0157d24828a2e9552297389c..ffbe324acd490ec6eb621ce0fe8d26b3b38d3ac0 100644 (file)
@@ -34,7 +34,7 @@ string Engine::findMothursPath(){
                
                //delimiting path char
                char delim;
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        delim = ':';
                #else
                        delim = ';';
@@ -56,7 +56,7 @@ string Engine::findMothursPath(){
                
                if (mothurPath != "") {
                        //add mothur so it looks like what argv would look like
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                mothurPath += "/mothur";
                        #else
                                mothurPath += "\\mothur";
@@ -71,7 +71,7 @@ string Engine::findMothursPath(){
                                //is this mothurs path?
                                ifstream in;
                                string tempIn = dirs[i];
-                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                        tempIn += "/mothur";
                                #else
                                        tempIn += "\\mothur";
@@ -219,7 +219,7 @@ bool InteractEngine::getInput(){
 string Engine::getCommand()  {
        try {
        
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        #ifdef USE_READLINE
                                char* nextCommand = NULL;
                                nextCommand = readline("mothur > ");
index 9096bb671c830a7f5b0b3638ef0ef0a1d0a5f65d..93e18e82f374c9fa5bad6a90f6fc2ff56e20246a 100644 (file)
@@ -424,16 +424,17 @@ int FilterSeqsCommand::filterSequences() {
             vector<unsigned long long> positions;
             if (savedPositions.size() != 0) { positions = savedPositions[s]; }
             else {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                positions = m->divideFile(fastafileNames[s], processors);
 #else
                 if(processors != 1){
                     int numFastaSeqs = 0;
                     positions = m->setFilePosFasta(fastafileNames[s], numFastaSeqs); 
+                    if (positions.size() < processors) { processors = positions.size(); }
                 }
 #endif
             }
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        //vector<unsigned long long> positions = m->divideFile(fastafileNames[s], processors);
                        
                        for (int i = 0; i < (positions.size()-1); i++) {
@@ -590,7 +591,7 @@ int FilterSeqsCommand::driverRunFilter(string F, string outputFilename, string i
                                count++;
                        }
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = in.tellg();
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
@@ -623,7 +624,7 @@ int FilterSeqsCommand::createProcessesRunFilter(string F, string filename, strin
                int num = 0;
                processIDS.clear();
         
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                
                
                //loop through and create all the processes you want
@@ -811,7 +812,7 @@ string FilterSeqsCommand::createFilter() {
 #else
                                
                 vector<unsigned long long> positions;
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                positions = m->divideFile(fastafileNames[s], processors);
                                for (int i = 0; i < (positions.size()-1); i++) {
                                        lines.push_back(new linePair(positions[i], positions[(i+1)]));
@@ -832,6 +833,7 @@ string FilterSeqsCommand::createFilter() {
                                }else {
                     int numFastaSeqs = 0;
                     positions = m->setFilePosFasta(fastafileNames[s], numFastaSeqs); 
+                    if (positions.size() < processors) { processors = positions.size(); }
                     
                     //figure out how many sequences you have to process
                     int numSeqsPerProcessor = numFastaSeqs / processors;
@@ -969,7 +971,7 @@ int FilterSeqsCommand::driverCreateFilter(Filters& F, string filename, linePair*
                                        count++;
                        }
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = in.tellg();
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
@@ -1045,7 +1047,7 @@ int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename)
                int num = 0;
                processIDS.clear();
 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                
                //loop through and create all the processes you want
                while (process != processors) {
index 16062f33e79582a13e56154a9e0830998cc0d5e0..4405c33f52165d5c89cbe47e8513147cb14dd879 100644 (file)
@@ -121,7 +121,7 @@ struct filterRunData {
 };\r
 \r
 /**************************************************************************************************/\r
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)\r
 #else\r
 static DWORD WINAPI MyCreateFilterThreadFunction(LPVOID lpParam){ \r
        filterData* pDataArray;\r
index d43f85d16907d92583ba95069002661253569a6c..6b29f90464f3259c6c625421d9ee1cadbc8b2ef8 100644 (file)
@@ -82,7 +82,7 @@ int FormatColumnMatrix::read(NameAssignment* nameMap){
                string outfile = m->getRootName(squareFile) + "sorted.dist.temp";
                
                //use the unix sort 
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        string command = "sort -n " + squareFile + " -o " + outfile;
                        system(command.c_str());
                #else //sort using windows sort
index de49daa32a31c6aa2a4bfbac97257ca993656a03..60591178836ee793a83cbd3ec75776b463af4ead 100644 (file)
@@ -96,7 +96,7 @@ int FormatPhylipMatrix::read(NameAssignment* nameMap){
                                string outfile = m->getRootName(tempFile) + "sorted.dist.temp";
                                
                                //use the unix sort 
-                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                        string command = "sort -n " + tempFile + " -o " + outfile;
                                        system(command.c_str());
                                #else //sort using windows sort
index 1864f7473b0e21ff06d84ce76968f81374189954..01d8c2e8634d65c31f11515f89ecfa950b81a1ae 100644 (file)
@@ -1120,7 +1120,7 @@ vector<float> IndicatorCommand::getPValues(vector< vector<SharedRAbundFloatVecto
        try {
                vector<float> pvalues;
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                if(processors == 1){
                        pvalues = driver(groupings, groupingsMap, num, indicatorValues, iters);
                        for (int i = 0; i < pvalues.size(); i++) { pvalues[i] /= (double)iters; }
@@ -1234,7 +1234,7 @@ vector<float> IndicatorCommand::getPValues(vector< vector<SharedRAbundVector*> >
        try {
                vector<float> pvalues;
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                if(processors == 1){
                        pvalues = driver(groupings, groupingsMap, num, indicatorValues, iters);
                        for (int i = 0; i < pvalues.size(); i++) { pvalues[i] /= (double)iters; }
index 476070eb2fbb654d054238c45ee335b2ce8fe0eb..c389a9468706d4ea214c7f4e3dfffc3c220da365 100644 (file)
--- a/makefile
+++ b/makefile
@@ -9,15 +9,15 @@
 # Macros
 #
 
-USEMPI ?= no
+USEMPI ?= yes
 64BIT_VERSION ?= yes
-USEREADLINE ?= yes
+USEREADLINE ?= no
 CYGWIN_BUILD ?= no
 USECOMPRESSION ?= no
 MOTHUR_FILES="\"Enter_your_default_path_here\""
-RELEASE_DATE = "\"1/9/2012\""
-VERSION = "\"1.23.0\""
-FORTAN_COMPILER = gfortran
+RELEASE_DATE = "\"3/12/2012\""
+VERSION = "\"1.24.4\""
+FORTAN_COMPILER = /usr/local/gfortran/bin/gfortran
 
 # Optimize to level 3:
 CXXFLAGS += -O3 
@@ -38,7 +38,7 @@ ifeq  ($(strip $(64BIT_VERSION)),yes)
        #if you are a linux user use the following line
        #CXXFLAGS += -mtune=native -march=native -m64
        
-        CXXFLAGS += -DBIT_VERSION
+       CXXFLAGS += -DBIT_VERSION
 endif
 
 
@@ -97,12 +97,12 @@ mothur : fortranSource $(OBJECTS) uchime
        $(CXX) $(LDFLAGS) $(TARGET_ARCH) -o $@ $(OBJECTS) $(LIBS)
        
        strip mothur
-
 uchime:
        cd uchime_src && ./mk && mv uchime .. && cd ..
        
 fortranSource:
-       ${FORTAN_COMPILER} -c *.f
+       ${FORTAN_COMPILER} -c -m64 *.f
 
 install : mothur
 #      cp mothur ../Release/mothur
index 6537963bb58e034ef00da3812cc6af2bb167be71..5bfec377de51d966de6d759161a99b43b7dccfdc 100644 (file)
@@ -425,7 +425,7 @@ int MatrixOutputCommand::process(vector<SharedRAbundVector*> thisLookup){
                        int process = 1;
                        vector<int> processIDS;
             
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        //loop through and create all the processes you want
                        while (process != processors) {
                                int pid = fork();
index 762b0e10a02b0428e6a3e8119c1e0a2ee0887d84..dc77bdf067ff194dce8bd2e5fcb8f078a9450dcc 100644 (file)
@@ -130,7 +130,7 @@ struct distSharedData {
        }
 };
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyDistSharedThreadFunction(LPVOID lpParam){ 
        distSharedData* pDataArray;
index 59916492213cf56c8851969876b1df7907f26f23..a0e6ed5d9bfe95b0fa6724aa05c8a06c4350762e 100644 (file)
@@ -343,7 +343,7 @@ int MetaStatsCommand::process(vector<SharedRAbundVector*>& thisLookUp){
                                }else{
                                        int process = 1;
                                        vector<int> processIDS;
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                        //loop through and create all the processes you want
                                        while (process != processors) {
                                                int pid = fork();
index 2c5c80cd863760f56d7f7653d49a713559c84821..b4800b71d75bcda1bfa5a39db6f8191849d0b348 100644 (file)
@@ -87,7 +87,7 @@ struct metastatsData {
        }
 };
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyMetastatsThreadFunction(LPVOID lpParam){ 
        metastatsData* pDataArray;
index c9914229c9d41c72da266a46d5f26516e0f60fe4..accdb2962c198988c457dc8f837b8817dc2799f0 100644 (file)
@@ -46,7 +46,7 @@ int main(int argc, char *argv[]){
 
                m->setFileName(logFileName);
                
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        system("clear");
                #else
                        system("CLS");
@@ -57,7 +57,7 @@ int main(int argc, char *argv[]){
                
                        //add / to name if needed
                        string lastChar = temp.substr(temp.length()-1);
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if (lastChar != "/") { temp += "/"; }
                        #else
                                if (lastChar != "\\") { temp += "\\"; } 
@@ -88,7 +88,7 @@ int main(int argc, char *argv[]){
                
                if (outputHeader)  {
                        //version
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                #if defined (__APPLE__) || (__MACH__)
                                        m->mothurOutJustToLog("Mac version");
                                        m->mothurOutEndLine(); m->mothurOutEndLine();
index 57b409e51605df2d0dbab805e3d8b1b7060e7b3e..1a07b6f930ec77b58a888cac1e715e2a292ea42f 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -54,7 +54,7 @@
 #endif
 /***********************************************************************/
 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
        #include <sys/wait.h>
        #include <sys/time.h>
        #include <sys/resource.h>
index 25e534e43880497955512ce7dc2240adf99157e9..c89d580d64f6c69a6afedada448143ae114453a3 100644 (file)
@@ -143,7 +143,7 @@ void MothurOut::setDefaultPath(string pathname)  {
        
                //add / to name if needed
                string lastChar = pathname.substr(pathname.length()-1);
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        if (lastChar != "/") { pathname += "/"; }
                #else
                        if (lastChar != "\\") { pathname += "\\"; }     
@@ -334,7 +334,7 @@ void MothurOut::errorOut(exception& e, string object, string function) {
 //
 // On failure, returns 0.0, 0.0
 int MothurOut::mem_usage(double& vm_usage, double& resident_set) {
-  #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+  #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
   
           vm_usage     = 0.0;
           resident_set = 0.0;
@@ -506,7 +506,7 @@ string MothurOut::getline(ifstream& fileHandle) {
 }
 /***********************************************************************/
 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #ifdef USE_COMPRESSION
 inline bool endsWith(string s, const char * suffix){
   size_t suffixLength = strlen(suffix);
@@ -520,7 +520,7 @@ string MothurOut::getRootName(string longName){
        
                string rootName = longName;
 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #ifdef USE_COMPRESSION
     if (endsWith(rootName, ".gz") || endsWith(rootName, ".bz2")) {
       int pos = rootName.find_last_of('.');
@@ -675,7 +675,7 @@ string MothurOut::getFullPathName(string fileName){
                                
                string cwd;
                //get current working directory 
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)   
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)  
                        
                        if (path.find("~") != -1) { //go to home directory
                                string homeDir;
@@ -798,7 +798,7 @@ int MothurOut::openInputFile(string fileName, ifstream& fileHandle, string m){
        try {
                        //get full path name
                        string completeFileName = getFullPathName(fileName);
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #ifdef USE_COMPRESSION
       // check for gzipped or bzipped file
       if (endsWith(completeFileName, ".gz") || endsWith(completeFileName, ".bz2")) {
@@ -844,7 +844,7 @@ int MothurOut::openInputFile(string fileName, ifstream& fileHandle){
 
                //get full path name
                string completeFileName = getFullPathName(fileName);
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #ifdef USE_COMPRESSION
   // check for gzipped or bzipped file
   if (endsWith(completeFileName, ".gz") || endsWith(completeFileName, ".bz2")) {
@@ -895,7 +895,7 @@ int MothurOut::renameFile(string oldName, string newName){
                int exist = openInputFile(newName, inTest, "");
                inTest.close();
                
-       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)           
+       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)          
                if (exist == 0) { //you could open it so you want to delete it
                        string command = "rm " + newName;
                        system(command.c_str());
@@ -922,7 +922,7 @@ int MothurOut::openOutputFile(string fileName, ofstream& fileHandle){
        try { 
        
                string completeFileName = getFullPathName(fileName);
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #ifdef USE_COMPRESSION
     // check for gzipped file
     if (endsWith(completeFileName, ".gz") || endsWith(completeFileName, ".bz2")) {
@@ -998,7 +998,7 @@ string MothurOut::sortFile(string distFile, string outputDir){
 
                
                //if you can, use the unix sort since its been optimized for years
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        string command = "sort -n -k +3 " + distFile + " -o " + outfile;
                        system(command.c_str());
                #else //you are stuck with my best attempt...
@@ -1201,7 +1201,7 @@ vector<unsigned long long> MothurOut::divideFile(string filename, int& proc) {
                        fclose (pFile);
                }
                
-       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                
                //estimate file breaks
                unsigned long long chunkSize = 0;
index f5c8b40cd81d9d06a65a861c1e0e66355b275f58..78255d8f73d894c7cb4032d925b684843094bee7 100644 (file)
@@ -46,7 +46,7 @@ int correctDist::addSeq(string seqName, string seqSeq){
 /**************************************************************************************************/
 int correctDist::execute(string distanceFileName){
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
                processors = 1;
 #endif
@@ -146,7 +146,7 @@ vector<int> correctDist::fixSequence(string sequence){
 
 int correctDist::createProcess(string distanceFileName){
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                vector<int> processIDs;
                
index 226b0f63560b04348ea425290c98b48b1abc4de6..b1846499021624c64733cb44afcc344fdfecbb37 100755 (executable)
@@ -11,7 +11,7 @@
 #include <signal.h>\r
 #include <float.h>\r
 \r
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)\r
 #include <sys/time.h>\r
 #include <sys/resource.h>\r
 #include <unistd.h>\r
@@ -139,7 +139,7 @@ bool myisatty(int fd)
        return isatty(fd) != 0;\r
 }\r
 \r
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)\r
 #else\r
 //#ifdef BIT_VERSION\r
 //#include <io.h>\r
@@ -176,7 +176,7 @@ void LogStdioFileState(FILE *f)
        Log("fpos       %ld (retval %d)\n", (long) fpos, fgetpos_retval);\r
        //      Log("eof        %d\n", _eof(fd));\r
 #endif\r
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)\r
 #else\r
 #ifdef BIT_VERSION\r
        __int64 pos64 = _ftelli64(f);\r
@@ -612,7 +612,7 @@ void Die(const char *Format, ...)
        fprintf(stderr, "\n---Fatal error---\n%s\n", szStr);\r
        Log("\n---Fatal error---\n%s\n", szStr);\r
        \r
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)\r
 #else\r
        //if (IsDebuggerPresent())\r
        //      __debugbreak();\r
@@ -1205,7 +1205,7 @@ static void AddOpt(const OptInfo &Opt)
        g_Opts.insert(Opt);\r
 }\r
 \r
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)\r
 #else\r
 #pragma warning(disable: 4505) // unreferenced local function\r
 #endif\r
index 4b5596441081ce9e2becf9df5d61c4f4636a51e3..b520ca69ceb898c9321cf8b7b6cf565588377079 100644 (file)
@@ -300,18 +300,6 @@ int OTUAssociationCommand::process(vector<SharedRAbundVector*>& lookup){
                        for (int k = 0; k < i; k++) {
                                
                                if (m->control_pressed) { out.close(); return 0; }
-                               
-                /*cout << m->binLabelsInFile[i] << " <- c(" << xy[i][0];
-                for (int l = 1; l < xy[i].size(); l++){
-                    cout << ", " << xy[i][l];
-                }
-                cout << ")\n";
-                
-                cout << m->binLabelsInFile[k] << " <- c(" << xy[k][0];
-                for (int l = 1; l < xy[k].size(); l++){
-                    cout << ", " << xy[k][l];
-                }
-                cout << ")\n";*/
 
                                double coef = 0.0;
                                double sig = 0.0;
index ed11dfbdd56e0ff480bfd281b944dcaa1fab34eb..98b0fde32dbb4cf9bf86aad283fa1d6ad3a7ea44 100644 (file)
@@ -393,7 +393,7 @@ int PairwiseSeqsCommand::execute(){
                                        if (output != "square"){ driverMPI(start, end, (outputFile + toString(pid) + ".temp"), size); }
                                        else { driverMPI(start, end, (outputFile + toString(pid) + ".temp"), size, output); }
                                        
-                                       if (m->control_pressed) { delete distCalculator;  return 0; }
+                                       if (m->control_pressed) {  return 0; }
                                
                                        //tell parent you are done.
                                        MPI_Send(&size, 1, MPI_LONG, 0, tag, MPI_COMM_WORLD);
@@ -402,7 +402,7 @@ int PairwiseSeqsCommand::execute(){
                        MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
        #else           
                                        
-               //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        //if you don't need to fork anything
                        if(processors == 1){
                                if (output != "square") {  driver(0, numSeqs, outputFile, cutoff); }
@@ -494,7 +494,7 @@ void PairwiseSeqsCommand::createProcesses(string filename) {
         int process = 1;
                processIDS.clear();
         
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                
                
                //loop through and create all the processes you want
@@ -991,6 +991,22 @@ int PairwiseSeqsCommand::driverMPI(int startLine, int endLine, string file, unsi
                        alignment = new NeedlemanOverlap(gapOpen, match, misMatch, longestBase);
                }
                
+        ValidCalculators validCalculator;
+        Dist* distCalculator;
+        if (countends) {
+            if (validCalculator.isValidCalculator("distance", Estimators[0]) == true) { 
+                if (Estimators[0] == "nogaps")                 {       distCalculator = new ignoreGaps();      }
+                else if (Estimators[0] == "eachgap")   {       distCalculator = new eachGapDist();     }
+                else if (Estimators[0] == "onegap")            {       distCalculator = new oneGapDist();      }
+            }
+        }else {
+            if (validCalculator.isValidCalculator("distance", Estimators[0]) == true) { 
+                if (Estimators[0] == "nogaps")         {       distCalculator = new ignoreGaps();                                      }
+                else if (Estimators[0] == "eachgap"){  distCalculator = new eachGapIgnoreTermGapDist();        }
+                else if (Estimators[0] == "onegap")    {       distCalculator = new oneGapIgnoreTermGapDist();         }
+            }
+        }
+        
                string outputString = "";
                size = 0;
                
index ba82f47dfc7025481d3a6b7763a525aff690cece..e75f63c3fe80a4eaad7a2bccfae3ad266346b9e4 100644 (file)
@@ -115,7 +115,7 @@ struct pairwiseData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyPairwiseSquareThreadFunction(LPVOID lpParam){ 
        pairwiseData* pDataArray;
index 730873a4bd64e5409c5e3580bfd15338179a787c..e6d7ce6d1aa30da836bb88f2833bd666ae11bd85 100644 (file)
@@ -33,8 +33,10 @@ string ParseFastaQCommand::getHelpString(){
        try {
                string helpString = "";
                helpString += "The fastq.info command reads a fastq file and creates a fasta and quality file.\n";
-               helpString += "The fastq.info command parameter is fastq, and it is required.\n";
+               helpString += "The fastq.info command parameters are fastq, fasta and qfile; fastq is required.\n";
                helpString += "The fastq.info command should be in the following format: fastq.info(fastaq=yourFastaQFile).\n";
+        helpString += "The fasta parameter allows you to indicate whether you want a fasta file generated. Default=T.\n";
+        helpString += "The qfile parameter allows you to indicate whether you want a quality file generated. Default=T.\n";
                helpString += "Example fastq.info(fastaq=test.fastaq).\n";
                helpString += "Note: No spaces between parameter labels (i.e. fastq), '=' and yourFastQFile.\n";
                return helpString;
index 49a73505c3df0c77b4ff3fe0b6e71f038eb5f13c..d26bc270efcdd7fff7cb1292ddc2bfb786a48665 100644 (file)
@@ -54,7 +54,7 @@ EstOutput Parsimony::getValues(Tree* t, int p, string o) {
                        }
                }
                
-       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                if(processors == 1){
                        data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size());
                }else{
@@ -91,7 +91,7 @@ EstOutput Parsimony::getValues(Tree* t, int p, string o) {
 
 EstOutput Parsimony::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                vector<int> processIDS;
                
index 2b15d11d29580d1455ffea983788ab0715fe194b..abf9591f4060482a158df9b008e0f357d6c6b069 100644 (file)
@@ -353,7 +353,7 @@ int PhyloDiversityCommand::execute(){
                                if (numSampledList.count(diversity[mGroups[j]].size()-1) == 0) {  numSampledList.insert(diversity[mGroups[j]].size()-1); }
                        }
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if(processors == 1){
                                        driver(trees[i], diversity, sumDiversity, iters, increment, randomLeaf, numSampledList, outCollect, outSum, true);      
                                }else{
@@ -403,7 +403,7 @@ int PhyloDiversityCommand::execute(){
 //**********************************************************************************************************************
 int PhyloDiversityCommand::createProcesses(vector<int>& procIters, Tree* t, map< string, vector<float> >& div, map<string, vector<float> >& sumDiv, int numIters, int increment, vector<int>& randomLeaf, set<int>& numSampledList, ofstream& outCollect, ofstream& outSum){
        try {
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                
                vector<int> processIDS;
index af64c25ce290a808a5edc8295645bc16bf277856..b9f2434d19d4cc842bfac1dce4f6de5a0d1b742d 100644 (file)
@@ -74,7 +74,7 @@ int Pintail::doPrep() {
        #ifdef USE_MPI
                //do nothing
        #else
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        //find breakup of templatefile for quantiles
                        if (processors == 1) {   templateLines.push_back(new linePair(0, templateSeqs.size()));  }
                        else { 
@@ -529,7 +529,7 @@ Sequence* Pintail::findPairs(Sequence* q) {
 //**************************************************************************************************
 void Pintail::createProcessesQuan() {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                vector<int> processIDS;
                                
index 58fd99777a809afd6384861b4a3237218138c29f..32080870d4be38de900e5b2b881c6d360faebc32 100644 (file)
@@ -302,7 +302,7 @@ int PreClusterCommand::createProcessesGroups(SequenceParser* parser, string newF
                        lines.push_back(linePair(startIndex, endIndex));
                }
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)          
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)         
                
                //loop through and create all the processes you want
                while (process != processors) {
index 3712302bee105cec37e6834dbc2b017584c9e2d5..64efc7fc1d43aca03d17497e28bee2fdb61cc74a 100644 (file)
@@ -113,7 +113,7 @@ struct preClusterData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyPreclusterThreadFunction(LPVOID lpParam){ 
        preClusterData* pDataArray;
index ca105b7f82fad6be8cc45e7b9e7953da3f4471e4..6a9cb3180172b8aa06aed0039d252de8bdd8873d 100644 (file)
@@ -24,7 +24,7 @@ int Rarefact::getCurve(float percentFreq = 0.01, int nIters = 1000){
                if (percentFreq < 1.0) {  increment = numSeqs * percentFreq;  }
                else { increment = percentFreq;  }      
                
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if(processors == 1){
                                        driver(rcd, increment, nIters); 
                                }else{
@@ -114,7 +114,7 @@ int Rarefact::driver(RarefactionCurveData* rcd, int increment, int nIters = 1000
 
 int Rarefact::createProcesses(vector<int>& procIters, RarefactionCurveData* rcd, int increment) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                
                vector<int> processIDS;
index b8c1c6f1a6420f8a139eb5c71b0320b87277035e..47d55a0f07459c4128ed737f420c102ae42ea791 100644 (file)
@@ -287,7 +287,7 @@ int RareFactCommand::execute(){
                                
                if (m->control_pressed) { return 0; }
                
-               map<string, string> nameMap;
+               map<int, string> file2Group; //index in outputNames[i] -> group
                for (int p = 0; p < inputFileNames.size(); p++) {
                        
                        string fileNameRoot = outputDir + m->getRootName(m->getSimpleName(inputFileNames[p]));
@@ -296,7 +296,6 @@ int RareFactCommand::execute(){
                        
                        if (inputFileNames.size() > 1) {
                                m->mothurOutEndLine(); m->mothurOut("Processing group " + groups[p]); m->mothurOutEndLine(); m->mothurOutEndLine();
-                               nameMap[fileNameRoot] = groups[p];
                        }
                        int i;
                        ValidCalculators validCalculator;
@@ -352,6 +351,7 @@ int RareFactCommand::execute(){
                                                rDisplays.push_back(new RareDisplay(new NSeqs(), new ThreeColumnFile(fileNameRoot+"r_nseqs")));
                                                outputNames.push_back(fileNameRoot+"r_nseqs"); outputTypes["r_nseqs"].push_back(fileNameRoot+"r_nseqs");
                                        }
+                    file2Group[outputNames.size()-1] = groups[p];
                                }
                        }
                        
@@ -450,7 +450,7 @@ int RareFactCommand::execute(){
                if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]); } return 0; }
 
                //create summary file containing all the groups data for each label - this function just combines the info from the files already created.
-               if ((sharedfile != "") && (groupMode)) {   outputNames = createGroupFile(outputNames, nameMap);  }
+               if ((sharedfile != "") && (groupMode)) {   outputNames = createGroupFile(outputNames, file2Group);  }
 
                if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]); } return 0; }
 
@@ -467,7 +467,7 @@ int RareFactCommand::execute(){
        }
 }
 //**********************************************************************************************************************
-vector<string> RareFactCommand::createGroupFile(vector<string>& outputNames, map<string, string> nameMap) {
+vector<string> RareFactCommand::createGroupFile(vector<string>& outputNames, map<int, string> file2Group) {
        try {
                
                vector<string> newFileNames;
@@ -485,7 +485,7 @@ vector<string> RareFactCommand::createGroupFile(vector<string>& outputNames, map
                        
                        newLine += "\tGroup" + labels.substr(labels.find_first_of('\t'));
                        
-                       typesFiles[extension].push_back(outputNames[i]);
+                       typesFiles[extension].push_back(outputNames[i]+"_"+file2Group[i]);
                        
                        string combineFileName = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + "groups" + extension;
                        
@@ -513,23 +513,26 @@ vector<string> RareFactCommand::createGroupFile(vector<string>& outputNames, map
                        int maxLines = 0;
                        int numColumns = 0;
                        for (int i=0; i<thisTypesFiles.size(); i++) {
-                                                               
+                
+                string thisfilename = thisTypesFiles[i].substr(0, thisTypesFiles[i].find_last_of('_'));
+                string group = thisTypesFiles[i].substr(thisTypesFiles[i].find_last_of('_')+1);
+                
                                ifstream temp;
-                               m->openInputFile(thisTypesFiles[i], temp);
+                               m->openInputFile(thisfilename, temp);
                                
                                //read through first line - labels
                                m->getline(temp);       m->gobble(temp);
                                
                                vector<string> thisFilesLines;
-                               string fileNameRoot = m->getRootName(thisTypesFiles[i]);
-                               map<string, string>::iterator itName = nameMap.find(fileNameRoot);
-                               string group = "";
-                               if (itName != nameMap.end()) {
-                                       group = itName->second;
-                               }else {
-                                       group = "not found" + i;
-                                       m->mothurOut("[ERROR]: can't parse filename."); m->mothurOutEndLine();
-                               }
+                               //string fileNameRoot = m->getRootName(thisTypesFiles[i]);
+                               //map<string, string>::iterator itName = nameMap.find(fileNameRoot);
+                               //string group = "";
+                               //if (itName != nameMap.end()) {
+                               //      group = itName->second;
+                               //}else {
+                               //      group = "not found" + i;
+                               //      m->mothurOut("[ERROR]: can't parse filename."); m->mothurOutEndLine();
+                               //}
                                
                                thisFilesLines.push_back(group);
                                int count = 1;
@@ -555,7 +558,7 @@ vector<string> RareFactCommand::createGroupFile(vector<string>& outputNames, map
                                if (maxLines < thisFilesLines.size()) { maxLines = thisFilesLines.size(); }
                                
                                temp.close();
-                               m->mothurRemove(thisTypesFiles[i]);
+                               m->mothurRemove(thisfilename);
                        }
                        
                        
index 72d24151193076eea753f5b17d97e135da7d42d0..6aaa3de401e07f653abcd29cff4e98c868a94e4b 100644 (file)
@@ -51,7 +51,7 @@ private:
        string outputDir;
        
        vector<string> parseSharedFile(string);
-       vector<string> createGroupFile(vector<string>&, map<string, string>);
+       vector<string> createGroupFile(vector<string>&, map<int, string>);
 };
 
 #endif
index 686bdaf4fb43486b87b8f3ad9ba39a874c670ce0..09ff9b5fea6a92ba4a45bb721cb33df9337e7ef6 100644 (file)
@@ -288,7 +288,7 @@ int ScreenSeqsCommand::execute(){
                        getSummary(positions); 
                } 
                else { 
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                 positions = m->divideFile(fastafile, processors);
                 for (int i = 0; i < (positions.size()-1); i++) { lines.push_back(linePair(positions[i], positions[(i+1)])); }
                        #else 
@@ -296,6 +296,7 @@ int ScreenSeqsCommand::execute(){
                 else {
                     int numFastaSeqs = 0;
                     positions = m->setFilePosFasta(fastafile, numFastaSeqs); 
+                    if (positions.size() < processors) { processors = positions.size(); }
                 
                     //figure out how many sequences you have to process
                     int numSeqsPerProcessor = numFastaSeqs / processors;
@@ -611,7 +612,7 @@ int ScreenSeqsCommand::getSummary(vector<unsigned long long>& positions){
                vector<int> longHomoPolymer;
                
         vector<unsigned long long> positions;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                positions = m->divideFile(fastafile, processors);
                for (int i = 0; i < (positions.size()-1); i++) { lines.push_back(linePair(positions[i], positions[(i+1)])); }   
 #else
@@ -619,6 +620,7 @@ int ScreenSeqsCommand::getSummary(vector<unsigned long long>& positions){
         else {
             int numFastaSeqs = 0;
             positions = m->setFilePosFasta(fastafile, numFastaSeqs); 
+            if (positions.size() < processors) { processors = positions.size(); }
             
             //figure out how many sequences you have to process
             int numSeqsPerProcessor = numFastaSeqs / processors;
@@ -638,7 +640,7 @@ int ScreenSeqsCommand::getSummary(vector<unsigned long long>& positions){
                        driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, fastafile, lines[0]);
 #else
                int numSeqs = 0;
-               //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        if(processors == 1){
                                numSeqs = driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, fastafile, lines[0]);
                        }else{
@@ -743,7 +745,7 @@ int ScreenSeqsCommand::driverCreateSummary(vector<int>& startPosition, vector<in
                                count++;
                        }
                        //if((count) % 100 == 0){       m->mothurOut("Optimizing sequence: " + toString(count)); m->mothurOutEndLine();         }
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = in.tellg();
                                if ((pos == -1) || (pos >= filePos.end)) { break; }
                        #else
@@ -769,7 +771,7 @@ int ScreenSeqsCommand::createProcessesCreateSummary(vector<int>& startPosition,
                int num = 0;
                vector<int> processIDS;
 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                
                //loop through and create all the processes you want
                while (process != processors) {
@@ -1163,7 +1165,7 @@ int ScreenSeqsCommand::driver(linePair filePos, string goodFName, string badAccn
                        count++;
                        }
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = inFASTA.tellg();
                                if ((pos == -1) || (pos >= filePos.end)) { break; }
                        #else
@@ -1275,7 +1277,7 @@ int ScreenSeqsCommand::createProcesses(string goodFileName, string badAccnos, st
         int process = 1;
                int num = 0;
 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                
                //loop through and create all the processes you want
                while (process != processors) {
index 007b6d6302d4062c09c62d9017fa663f3a902072..cbeed469b0b571a66f79238aaac6d758658c0ac0 100644 (file)
@@ -131,7 +131,7 @@ struct sumScreenData {
 
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MySumThreadFunction(LPVOID lpParam){ 
        sumData* pDataArray;
index d8ebe50fb11859367256a28286dec9789cc70d36..9bda05a912551eca035bdd776387954619f5a8d8 100644 (file)
@@ -298,7 +298,7 @@ int SeqErrorCommand::execute(){
                if(qualFileName == "")  {       qLines = lines; rLines = lines; } //fills with duds
                
                int numSeqs = 0;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                if(processors == 1){
                        numSeqs = driver(queryFileName, qualFileName, reportFileName, errorSummaryFileName, errorSeqFileName, errorChimeraFileName, lines[0], qLines[0], rLines[0]);
                }else{
@@ -366,7 +366,7 @@ int SeqErrorCommand::createProcesses(string filename, string qFileName, string r
                processIDS.clear();
                map<char, vector<int> >::iterator it;
                int num = 0;
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                
                //loop through and create all the processes you want
                while (process != processors) {
@@ -739,7 +739,7 @@ int SeqErrorCommand::driver(string filename, string qFileName, string rFileName,
                        
                        index++;
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = queryFile.tellg();
                                if ((pos == -1) || (pos >= line.end)) { break; }
                        #else
@@ -1215,7 +1215,7 @@ void SeqErrorCommand::printQualityFR(vector<vector<int> > qualForwardMap, vector
 
 int SeqErrorCommand::setLines(string filename, string qfilename, string rfilename, vector<unsigned long long>& fastaFilePos, vector<unsigned long long>& qfileFilePos, vector<unsigned long long>& rfileFilePos) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                //set file positions for fasta file
                fastaFilePos = m->divideFile(filename, processors);
                
index 647334af7f8d66711c8db37b8d6fd00f9a9e38bb..68d3bf583f9c7de2db85ebfa27a2fecdd7738922 100644 (file)
@@ -286,11 +286,12 @@ int SeqSummaryCommand::execute(){
                                MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
 #else
                        vector<unsigned long long> positions; 
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                positions = m->divideFile(fastafile, processors);
                                for (int i = 0; i < (positions.size()-1); i++) {        lines.push_back(new linePair(positions[i], positions[(i+1)]));  }
                        #else
                                positions = m->setFilePosFasta(fastafile, numSeqs); 
+                if (positions.size() < processors) { processors = positions.size(); }
                
                                //figure out how many sequences you have to process
                                int numSeqsPerProcessor = numSeqs / processors;
@@ -433,7 +434,7 @@ int SeqSummaryCommand::driverCreateSummary(vector<int>& startPosition, vector<in
                                outSummary << current.getLongHomoPolymer() << '\t' << num << endl;
                        }
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = in.tellg();
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
@@ -529,7 +530,7 @@ int SeqSummaryCommand::createProcessesCreateSummary(vector<int>& startPosition,
                int num = 0;
                processIDS.clear();
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                
                //loop through and create all the processes you want
                while (process != processors) {
index dcae434d42d08e38f223292a5c2647428e1d9475..d8837a374d070298ceb9d224aaf8c621680bf249 100644 (file)
@@ -91,7 +91,7 @@ struct seqSumData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MySeqSumThreadFunction(LPVOID lpParam){ 
        seqSumData* pDataArray;
index 67a1f59f8388dbfec55ae7b552f02640b5d6b93f..081a306d712a8ee10bb67cf1d72bbf0663d0ff07 100644 (file)
@@ -122,7 +122,7 @@ int SetDirectoryCommand::execute(){
                }else {
                        //add / to name if needed
                        string lastChar = output.substr(output.length()-1);
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if (lastChar != "/") { output += "/"; }
                        #else
                                if (lastChar != "\\") { output += "\\"; }       
@@ -154,7 +154,7 @@ int SetDirectoryCommand::execute(){
                }else {
                        //add / to name if needed
                        string lastChar = input.substr(input.length()-1);
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if (lastChar != "/") { input += "/"; }
                        #else
                                if (lastChar != "\\") { input += "\\"; }        
@@ -196,7 +196,7 @@ int SetDirectoryCommand::execute(){
                }else {
                        //add / to name if needed
                        string lastChar = tempdefault.substr(tempdefault.length()-1);
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if (lastChar != "/") { tempdefault += "/"; }
                        #else
                                if (lastChar != "\\") { tempdefault += "\\"; }  
index e008ce47d2153530af1c0ab09a585a94d4963662..40dd09b9820b9689ab4d30ba9f5666ceb2e9573b 100644 (file)
@@ -298,7 +298,6 @@ SffInfoCommand::SffInfoCommand(string option)  {
 //**********************************************************************************************************************
 int SffInfoCommand::execute(){
        try {
-               
                if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                for (int s = 0; s < filenames.size(); s++) {
@@ -406,7 +405,9 @@ int SffInfoCommand::extractSffInfo(string input, string accnos){
                        //read data
                        seqRead read; 
                        readSeqData(in, read, header.numFlowsPerRead, readheader.numBases);
-                               
+            bool okay = sanityCheck(readheader, read);
+            if (!okay) { break; }
+            
                        //if you have provided an accosfile and this seq is not in it, then dont print
                        if (seqNames.size() != 0) {   if (seqNames.count(readheader.name) == 0) { print = false; }  }
                        
@@ -609,7 +610,7 @@ int SffInfoCommand::readSeqData(ifstream& in, seqRead& read, int numFlowReads, i
                                in.read(buffer, 2);
                                read.flowgram[i] = be_int2(*(unsigned short *)(&buffer));
                        }
-       
+            
                        //read flowIndex
                        read.flowIndex.resize(numBases);
                        for (int i = 0; i < numBases; i++) {  
@@ -741,11 +742,39 @@ int SffInfoCommand::printHeader(ofstream& out, Header& header) {
                exit(1);
        }
 }
-
+//**********************************************************************************************************************
+bool SffInfoCommand::sanityCheck(Header& header, seqRead& read) {
+       try {
+        bool okay = true;
+        string message = "[WARNING]: Your sff file may be corrupted! Sequence: " + header.name + "\n";
+        
+        if (header.clipQualLeft > read.bases.length()) {
+            okay = false; message += "Clip Qual Left = " + toString(header.clipQualLeft) + ", but we only read " + toString(read.bases.length()) + " bases.\n";
+        }
+        if (header.clipQualRight > read.bases.length()) {
+            okay = false; message += "Clip Qual Right = " + toString(header.clipQualRight) + ", but we only read " + toString(read.bases.length()) + " bases.\n";
+        }
+        if (header.clipQualLeft > read.qualScores.size()) {
+            okay = false; message += "Clip Qual Left = " + toString(header.clipQualLeft) + ", but we only read " + toString(read.qualScores.size()) + " quality scores.\n";
+        }
+        if (header.clipQualRight > read.qualScores.size()) {
+            okay = false; message += "Clip Qual Right = " + toString(header.clipQualRight) + ", but we only read " + toString(read.qualScores.size()) + " quality scores.\n";
+        }
+        
+        if (okay == false) {
+            m->mothurOut(message); m->mothurOutEndLine();
+        }
+        
+               return okay;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "SffInfoCommand", "sanityCheck");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 int SffInfoCommand::printSffTxtSeqData(ofstream& out, seqRead& read, Header& header) {
        try {
-               
                out << "Flowgram: ";
                for (int i = 0; i < read.flowgram.size(); i++) { out << setprecision(2) << (read.flowgram[i]/(float)100) << '\t';  }
                
@@ -775,10 +804,9 @@ int SffInfoCommand::printSffTxtSeqData(ofstream& out, seqRead& read, Header& hea
 //**********************************************************************************************************************
 int SffInfoCommand::printFastaSeqData(ofstream& out, seqRead& read, Header& header) {
        try {
-               
                string seq = read.bases;
                
-               if (trim) {
+        if (trim) {
                        if(header.clipQualRight < header.clipQualLeft){
                                seq = "NNNN";
                        }
index 903a589cd777b89b7e508e48d1173d550210f864..837435b3a6ca4c4c7f2e7e7579141b8fbece342b 100644 (file)
@@ -82,7 +82,7 @@ private:
        bool abort, fasta, qual, trim, flow, sfftxt, hasAccnos;
        int mycount;
        set<string> seqNames;
-       
+    
        //extract sff file functions
        int extractSffInfo(string, string);
        int readCommonHeader(ifstream&, CommonHeader&);
@@ -98,7 +98,8 @@ private:
        int printQualSeqData(ofstream&, seqRead&, Header&);
        int readAccnosFile(string);
        int parseSffTxt();
-       
+       bool sanityCheck(Header&, seqRead&);
+    
        //parsesfftxt file functions
        int parseHeaderLineToInt(ifstream&);
        vector<unsigned short> parseHeaderLineToFloatVector(ifstream&, int);
index 5d8263c86e2a1f3eae24da047897e2c642d243eb..28e6615f3dffba8fb88c88cd9ca76e79e66faa06 100644 (file)
@@ -1823,7 +1823,7 @@ int ShhherCommand::execute(){
                
         if (numFiles < processors) { processors = numFiles; }
         
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
         if (processors == 1) { driver(flowFileVector, compositeFASTAFileName, compositeNamesFileName, 0, flowFileVector.size()); }
         else { createProcesses(flowFileVector); } //each processor processes one file
 #else
@@ -1869,7 +1869,7 @@ int ShhherCommand::createProcesses(vector<string> filenames){
                        lines.push_back(linePair(startIndex, endIndex));
                }
                
-        #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)          
+        #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)         
                
                //loop through and create all the processes you want
                while (process != processors) {
index a7af7da4f1ce8a7d0c0e6daa809a58f95f2164fb..c9772af6f0e87e32d24518ee0419885770e11998 100644 (file)
@@ -202,7 +202,7 @@ struct shhhFlowsData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ 
        shhhFlowsData* pDataArray;
index 72504196039c9f337f8051ecdf54a4af1eed5c90..f6bfd81974628e9f5246b25237f79c25c4bf320e 100644 (file)
@@ -364,7 +364,7 @@ vector<string> ShhhSeqsCommand::createProcessesGroups(SequenceParser& parser, st
                        lines.push_back(linePair(startIndex, endIndex));
                }
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)          
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)         
                
                //loop through and create all the processes you want
                while (process != processors) {
index 1b0211afba43e5577abce79f89704114b3705b2f..7174ac70caf3f55e146d1cdf09e2b15e5b0cfaf4 100644 (file)
@@ -97,7 +97,7 @@ struct shhhseqsData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyShhhSeqsThreadFunction(LPVOID lpParam){ 
        shhhseqsData* pDataArray;
index a0d786f47518290bd71b88d15f386326d61acd64..5c175106ecb2584d07ca15a06c71f27284a3571c 100644 (file)
@@ -162,7 +162,7 @@ int SummaryQualCommand::execute(){
                if (namefile != "") { nameMap = m->readNames(namefile); }
                
                vector<unsigned long long> positions; 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                positions = m->divideFile(qualfile, processors);
                for (int i = 0; i < (positions.size()-1); i++) {        lines.push_back(linePair(positions[i], positions[(i+1)]));      }
 #else  
@@ -170,6 +170,7 @@ int SummaryQualCommand::execute(){
                        lines.push_back(linePair(0, 1000)); 
                }else {
                        positions = m->setFilePosFasta(qualfile, numSeqs); 
+            if (positions.size() < processors) { processors = positions.size(); }
                        
                        //figure out how many sequences you have to process
                        int numSeqsPerProcessor = numSeqs / processors;
@@ -267,7 +268,7 @@ int SummaryQualCommand::driverCreateSummary(vector<int>& position, vector<int>&
                                count += num;
                        }
                        
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        unsigned long long pos = in.tellg();
                        if ((pos == -1) || (pos >= filePos.end)) { break; }
 #else
@@ -291,7 +292,7 @@ int SummaryQualCommand::createProcessesCreateSummary(vector<int>& position, vect
                int numSeqs = 0;
                processIDS.clear();
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                
                //loop through and create all the processes you want
                while (process != processors) {
index d7aa39a5c60fa927c057cc86660b8062c6a5ab5d..bbd103c1d14f7b40badd9654152aec0fd2b47a10 100644 (file)
@@ -81,7 +81,7 @@ struct seqSumQualData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MySeqSumQualThreadFunction(LPVOID lpParam){ 
        seqSumQualData* pDataArray;
index f63a2ad16531731f6aee5eb7f6d20dcf81a85ee1..8c4ea0d6cd5b4cf26e15ec3460da8e5fd74e5fb6 100644 (file)
@@ -484,7 +484,7 @@ int SummarySharedCommand::process(vector<SharedRAbundVector*> thisLookup, string
             int process = 1;
             vector<int> processIDS;
             
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
             //loop through and create all the processes you want
             while (process != processors) {
                 int pid = fork();
index 2ffe90d6ab061601b8e1f8ecc89ee24170d02c7e..fbfea7bd98fac33bb8570934b6bcd9e9d99ceaba 100644 (file)
@@ -121,7 +121,7 @@ struct summarySharedData {
        }
 };
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MySummarySharedThreadFunction(LPVOID lpParam){ 
        summarySharedData* pDataArray;
index 750c89ff2f6d10493be697d3f8d8932f0507648d..c580436b3b3d542150502d2b771f426bc4aed8a7 100644 (file)
@@ -4,7 +4,7 @@
 //The sum_of_squares, havel_hakimi and calc_c_score algorithms have been adapted from I. Miklos and J. Podani. 2004. Randomization of presence-absence matrices: comments and new algorithms. Ecology 85:86-92.
 
 
-/**************************************************************************************************/
+/**************************************************************************************************
 int TrialSwap2::intrand(int n){
     try {
         double z;
@@ -644,102 +644,6 @@ int TrialSwap2::sim8(vector<int> columntotal, vector<int> rowtotal, vector<vecto
        }
 }
 /**************************************************************************************************/
-int TrialSwap2::havel_hakimi(vector<int> rowtotal,vector<int> columntotal,vector<vector<int> > &co_matrix) 
-{
-    try {
-        int nrows = co_matrix.size();
-        int ncols = co_matrix[0].size();
-        int i,j,k;
-        vector<int> r1; r1.resize(nrows,0);
-        vector<int> c;  c.resize(ncols,0);
-        vector<int> c1; c1.resize(ncols,0);
-       
-        
-        for(i=0;i<nrows;i++) {
-            for(j=0;j<ncols;j++) {
-                co_matrix[i][j]=0;
-            }
-        }
-        for(i=0;i<nrows;i++) {
-            r1[i]=1; 
-        }
-           
-        for(i=0;i<ncols;i++)
-        {
-            c[i]=columntotal[i];
-            c1[i]=i;
-        }
-        
-        for(k=0;k<nrows;k++)
-        {
-            if (m->control_pressed) { return 0; }
-            i=intrand(nrows);
-            while(r1[i]==0) {
-                if (m->control_pressed) { return 0; }
-                i=intrand(nrows);
-            }
-            r1[i]=0;
-            sho(c,c1,ncols);
-            for(j=0;j<rowtotal[i];j++)
-            {
-                if (m->control_pressed) { return 0; }
-                co_matrix[i][c1[j]]=1;
-                c[j]--;
-                if(c[j]<0)
-                    m->mothurOut("Uhh! " + toString(c1[j]) + "\n");
-            }
-        }
-        return 0;
-    }
-       catch(exception& e) {
-               m->errorOut(e, "TrialSwap2", "havel_hakimi");
-               exit(1);
-       }
-}
-/**************************************************************************************************/
-int TrialSwap2::sho(vector<int> c, vector<int> c1, int k)
-{
-    try {
-        int i,j,temp;
-        
-        for(j=k-1;j>0;j--)
-        {
-            if (m->control_pressed) { return 0; }
-            for(i=0;i<j;i++)
-            {
-                if(c[i]<c[i+1])
-                {
-                    temp=c[i];
-                    c[i]=c[i+1];
-                    c[i+1]=temp;
-                    temp=c1[i];
-                    c1[i]=c1[i+1];
-                    c1[i+1]=temp;
-                }
-            }
-        }
-        for(j=1;j<1000;j++)
-        {
-            if (m->control_pressed) { return 0; }
-            i=intrand(k-1);
-            if(c[i]==c[i+1])
-            {
-                temp=c[i];
-                c[i]=c[i+1];
-                c[i+1]=temp;
-                temp=c1[i];
-                c1[i]=c1[i+1];
-                c1[i+1]=temp;
-            }
-        }
-        return(0);
-    }
-       catch(exception& e) {
-               m->errorOut(e, "TrialSwap2", "sho");
-               exit(1);
-       }
-}
-/**************************************************************************************************/
 double TrialSwap2::calc_c_score (vector<vector<int> > &co_matrix,vector<int>  rowtotal)
 {
     try {
@@ -749,7 +653,9 @@ double TrialSwap2::calc_c_score (vector<vector<int> > &co_matrix,vector<int>  ro
         double normcscore = 0.0;
         int nonzeros = 0;
         int ncols = co_matrix[0].size(); int nrows = rowtotal.size(); 
-        vector<vector<double> > s(nrows, vector<double>(nrows,0.0)); //only fill half the matrix
+        vector<vector<double> > s; s.resize(nrows);
+        for (int i = 0; i < nrows; i++) { s[i].resize(nrows,0.0); }//only fill half the matrix
+
         
         for(int i=0;i<nrows-1;i++)
         {
@@ -801,7 +707,8 @@ int TrialSwap2::calc_checker (vector<vector<int> > &co_matrix, vector<int>  rowt
         int cunits=0;
         //int s[nrows][ncols];
         int ncols = co_matrix[0].size(); int nrows = rowtotal.size(); 
-        vector<vector<int> > s(nrows, vector<int>(nrows,0)); //only fill half the matrix
+        vector<vector<int> > s; s.resize(nrows);
+        for (int i = 0; i < nrows; i++) { s[i].resize(nrows,0); }//only fill half the matrix
         
         for(int i=0;i<nrows-1;i++)
         {
@@ -915,10 +822,11 @@ int TrialSwap2::swap_checkerboards (vector<vector<int> > &co_matrix)
     try {
         int ncols = co_matrix[0].size(); int nrows = co_matrix.size(); 
         int i, j, k, l;
-        i=intrand(nrows);
-        while((j = intrand(nrows) ) == i ) {;if (m->control_pressed) { return 0; }}
-        k=intrand(ncols);
-        while((l = intrand(ncols) ) == k ) {;if (m->control_pressed) { return 0; }}
+        i = m->getRandomIndex(nrows-1);
+        while((j = m->getRandomIndex(nrows-1) ) == i ) {;if (m->control_pressed) { return 0; }}
+        k = m->getRandomIndex(ncols-1);
+        while((l = m->getRandomIndex(ncols-1)) == k ) {;if (m->control_pressed) { return 0; }}
+                
         //cout << co_matrix[i][k] << " " << co_matrix[j][l] << endl;
         //cout << co_matrix[i][l] << " " << co_matrix[j][k] << endl;
         //cout << co_matrix[i][l] << " " << co_matrix[j][k] << endl;
@@ -1074,8 +982,8 @@ int TrialSwap2::update_row_col_totals(vector<vector<int> > &co_matrix, vector<in
         //generate (columntotal.begin(), columntotal.end(), 0);
         int nrows = co_matrix.size();
         int ncols = co_matrix[0].size();
-        vector<int> tmpcolumntotal(ncols, 0);
-        vector<int> tmprowtotal(nrows, 0);
+        vector<int> tmpcolumntotal; tmpcolumntotal.resize(ncols, 0);
+        vector<int> tmprowtotal; tmprowtotal.resize(nrows, 0);
         
         int rowcount = 0;
         
@@ -1109,431 +1017,8 @@ int TrialSwap2::update_row_col_totals(vector<vector<int> > &co_matrix, vector<in
     }
 }
 /**************************************************************************************************/
-/*int main(int argc, char *argv[])
-{
-    srand (time(0));
-    char* input_filename = argv[1];
-    std::ifstream infile (input_filename);
-   
-    //skip the first line of headers
-    getline(infile, line);
-    //get the first line of data
-    getline(infile, line);
-    
-    nrows = 0;
-    ncols = 0;
-    
-    //int numspaces = 0;
-    char nextChar;
-    
-    for (int i=0; i<int(line.length()); i++)
-    {
-      nextChar = line.at(i); // gets a character
-      if (isspace(line[i]))
-          ncols++;
-    }
-    
-    ncols = ncols-3;
-    
-    cout << "number of OTUs: ";
-    cout << ncols << endl;
-    
-    infile.close();
-    
-    std::ifstream infile2 (input_filename);
-    
-    //skip first line of headers
-    getline(infile2, line);
-    
-    while (!infile2.eof())
-    { 
-        getline(infile2, line);
-        if (!line.empty())
-            nrows++;
-    }
-    
-    cout << "number of sites: ";
-    cout << nrows << endl;
-    
-    infile2.close();
-    
-    std::ifstream infile3 (input_filename);
-    
-    //skip first line
-    getline(infile3, line);
-    
-    //variables that depend on info from initial matrix
-    vector<vector<int> > co_matrix;//[nrows][ncols];
-    vector<vector<int> > initmatrix;
-    vector<int> tmprow;
-    vector<double> stats;
-    int tmpnrows = nrows;
-    
-    for (int row1=0; row1<nrows; row1++) // first line was skipped when counting, so we can start from 0
-    {
-        //ignore first 3 cols in each row, data starts on the 3th col
-        for (int i = 0; i < 3; i++)
-            infile3 >> tmp;
-
-        for (int col=0; col<ncols; col++) 
-        {
-            infile3 >> tmp;
-            //cout << tmp << endl;
-            if (atoi(tmp.c_str()) > 0)
-                tmprow.push_back(1);
-            else
-                tmprow.push_back(0);        
-        }
-        if (accumulate( tmprow.begin(), tmprow.end(), 0 ) == 0)
-        {
-            tmpnrows--;
-        }
-        else
-            initmatrix.push_back(tmprow);
-        //add the row to the matrix
-        //initmatrix.push_back(tmprow);
-        tmprow.clear();
-        //cout << tmprow << endl;
-    }   
-    
-    infile3.close();
-    nrows = tmpnrows;
-    
-    //print init matrix    
-    /* cout << "original matrix:" << endl;
-
-    for (int i = 0; i < nrows; i++)
-    {
-        for (int j = 0; j < ncols; j++)
-        {
-            cout << initmatrix[i][j];            
-        }    
-        cout << endl;
-    } */
-    
-        //for (i=0;i<ncols;i++)
-        //cout << "col "<< i<< ": " << columntotal[i] << endl;
-    
-    //co_matrix is now initmatrix and newmatrix is now co_matrix
-    
-    //remove cols where sum is 0
-    
-    //transpose matrix
-   /* int newmatrows = ncols;
-    int newmatcols = nrows;
-    int initcols = ncols; //for the combo metric
-    int initrows = nrows; //for the combo metric
-    //swap for transposed matrix
-    nrows = newmatrows;//ncols;
-    ncols = newmatcols;//nrows;
-    
-    vector<int> columntotal(ncols, 0);
-    vector<int> initcolumntotal(ncols, 0);
-    vector<int> initrowtotal(nrows, 0);
-    vector<int> rowtotal(nrows, 0);
-    
-    transpose_matrix(initmatrix,co_matrix);
-    //remove degenerate rows and cols
-
-    //cout << "transposed matrix:" << endl;
-    int rowcount = 0;
-    for (int i = 0; i < nrows; i++)
-    {
-        for (int j = 0; j < ncols; j++)
-        {
-            if (co_matrix[i][j] == 1)
-            {
-                rowcount++;
-                columntotal[j]++;
-            }
-            //cout << co_matrix[i][j];            
-        }    
-        //cout << " row total: " << rowcount << endl;
-        //cout << endl;
-        rowtotal[i] = rowcount;
-        rowcount = 0;
-    }
-    
-    initcolumntotal = rowtotal;
-    initrowtotal = columntotal;
-    
-    cout << endl;    
-    
-    runs = atol(argv[2]);    
-    int metric = atol(argv[3]);
-    int nullModel = atol(argv[4]);
-    double initscore;
-    update_row_col_totals(co_matrix, rowtotal, columntotal, ncols, nrows);
-    //do initial metric: checker, c score, v ratio or combo
-    switch(metric) 
-    {
-        case 1:
-            //c score
-            initscore = calc_c_score(co_matrix, rowtotal);
-            cout << "initial c score: " << initscore << endl;
-            //print_matrix(co_matrix, nrows, ncols);
-            break;
-            
-        case 2:
-            //checker
-            initscore = calc_checker(co_matrix, rowtotal);
-            cout << "initial checker score: " << initscore << endl;
-            break;
-            
-        case 3:
-            //v ratio
-            initscore = calc_vratio(nrows, ncols, rowtotal, columntotal);
-            cout << "initial v ratio: " << initscore << endl;
-            break;
-            
-        case 4:
-            //combo
-            initscore = calc_combo(initrows, initcols, initmatrix);
-            cout << "initial combo score: " << initscore << endl;
-            //set co_matrix equal to initmatrix because combo requires row comparisons
-            co_matrix = initmatrix;
-            break;
-            
-        case 5:
-            //test!
-            
-            //print_matrix(co_matrix, nrows, ncols);
-            //sim1(nrows, ncols, co_matrix);
-            //sim2(nrows, ncols, co_matrix);
-            //sim3(initrows, initcols, initmatrix);
-            //sim4(columntotal, rowtotal, co_matrix);
-            //sim5(initcolumntotal, initmatrix);
-            //sim6(columntotal, co_matrix);
-            //sim7(initcolumntotal, initmatrix);          
-            sim8(columntotal, rowtotal, co_matrix);
-            //print_matrix(initmatrix, initrows, initcols);
-            //print_matrix(co_matrix, nrows, ncols);
-            
-            break;
-            
-        default:
-            cout << "no metric selected!" << endl;
-            return 1;
-            
-    }
-      
-    //matrix initialization
-    //havel_hakimi(nrows, ncols, rowtotal, columntotal, co_matrix);
-    //sum_of_square(nrows, ncols, rowtotal, columntotal, co_matrix);
-    //co-matrix is now a random matrix with the same row and column totals as the initial matrix
-    
-    //null matrix burn in
-    cout << "initializing null matrix...";
-    for(int l=0;l<10000;l++)
-    {
-       //swap_checkerboards (co_matrix); 
-       //if(l%10 == 0)        
-        switch(nullModel)
-        {
-            case 1:
-                //
-                sim1(nrows, ncols, co_matrix);
-                break;
-
-            case 2:
-                //sim2
-                sim2(nrows, ncols, co_matrix);
-                //sim2plus(nrows, ncols, initrowtotal, co_matrix);
-                break;
-
-            case 3:
-                //sim3
-                sim3(initrows, initcols, initmatrix);
-                //transpose_matrix(initmatrix,co_matrix);
-                co_matrix = initmatrix;
-                break;
-
-            case 4:
-                //sim4
-                sim4(columntotal, rowtotal, co_matrix);
-                break;
-
-            case 5:
-                //sim5
-                sim5(initcolumntotal, initrowtotal, initmatrix);
-                transpose_matrix(initmatrix,co_matrix);
-                //co_matrix = initmatrix;
-                break;
-
-            case 6:
-                sim6(columntotal, co_matrix);
-                break;
-
-            case 7:
-                //sim7(ncols, nrows, initrowtotal, co_matrix);          
-                //transpose_matrix(initmatrix,co_matrix);
-                //co_matrix = initmatrix;
-                break;
-
-            case 8:
-                sim8(columntotal, rowtotal, co_matrix);
-                break;
-
-            case 9:
-                //swap_checkerboards
-                swap_checkerboards (co_matrix);
-                break;
 
-            default:
-                cout << "no null model selected!" << endl;
-                return 1;
-        }
-    }
-    cout << "done!" << endl;
-      
-    //generate null matrices and calculate the metrics
-    
-    cout << "run: " << endl;
-    for(int trial=0;trial<runs;trial++) //runs
-    {
-        printf("\b\b\b\b\b\b\b%7d",trial+1);
-        fflush(stdout);
-        
-        switch(nullModel)
-        {
-            case 1: 
-                //
-                sim1(nrows, ncols, co_matrix);
-                break;
-
-            case 2:
-                //sim2
-                sim2(nrows, ncols, co_matrix);
-                //for(int i=0;i<nrows;i++)
-                    //cout << rowtotal[i] << " ";
-                //sim2plus(nrows, ncols, initrowtotal, co_matrix);
-                break;
-
-            case 3:
-                //sim3
-                for(int i=0;i<nrows;i++)
-                    cout  << " " << rowtotal[i];
-                sim3(initrows, initcols, initmatrix);
-                transpose_matrix(initmatrix,co_matrix);
-                break;
-
-            case 4:
-                //sim4
-                sim4(columntotal, rowtotal, co_matrix);
-                break;
-
-            case 5:
-                //sim5
-                sim5(initcolumntotal, initrowtotal, initmatrix);
-                transpose_matrix(initmatrix,co_matrix);
-                break;
-
-            case 6:
-                sim6(columntotal, co_matrix);
-                break;
 
-            case 7:
-                sim7(ncols, nrows, initrowtotal, co_matrix);
-                //print_matrix(co_matrix, nrows, ncols);
-                //transpose_matrix(initmatrix,co_matrix);
-                break;
 
-            case 8:
-                //sim8(initcolumntotal, initrowtotal, co_matrix);
-                //initrow and initcol are flipped because of transposition. this is super ugly!
-                sim8(initrowtotal, initcolumntotal, co_matrix);
-                break;
-
-            case 9:
-                //swap_checkerboards
-                swap_checkerboards (co_matrix);
-                break;
-
-            default:
-                cout << "no null model selected!" << endl;
-                return 1;
-        }
-
-        //cout << endl;
-        //print_matrix(co_matrix, nrows, ncols);
-        update_row_col_totals(co_matrix, rowtotal, columntotal, ncols, nrows);
-        //cout << columntotal[1]<<endl;
-        double tmp;
-        switch(metric) 
-        {
-            case 1:
-                //c score
-                //swap_checkerboards(co_matrix);
-                //cout <<  "%" << tmp << " nrows " << nrows << " ncols " << ncols << " rowtotals ";
-                //for(int i = 0; i<nrows; i++) { cout << rowtotal[i]; }
-                //cout << endl;
-                tmp = calc_c_score(co_matrix, rowtotal);
-                //cout << "%" << tmp << " ";
-                stats.push_back(tmp);
-                //cout << "%" << tmp << " ";
-                //print_matrix(co_matrix, nrows, ncols);
-                break;
-                
-            case 2:
-                //checker
-                //swap_checkerboards(co_matrix);
-                //cout <<  "%" << tmp << " nrows " << nrows << " ncols " << ncols << " rowtotals ";
-                //for(int i = 0; i<nrows; i++) { cout << rowtotal[i]; }
-                //cout << endl;
-                tmp = calc_checker(co_matrix, rowtotal);
-                stats.push_back(tmp);
-                //cout << "%" << tmp << endl;
-                break;
-                
-            case 3:
-                //v ratio
-                stats.push_back(calc_vratio(nrows, ncols, rowtotal, columntotal));
-                break;
-                
-            case 4:
-                //combo
-                stats.push_back(calc_combo(nrows, ncols, co_matrix));
-                break;
-                
-            case 5:
-                //test!
-                break;
-                
-            default:
-                cout << "no metric selected!" << endl;
-                return 1;
-                
-        } 
-        
-    //print_matrix(co_matrix, nrows, ncols);
-    //print_matrix(initmatrix, initrows, initcols);
-
-    }
-    
-    cout << endl;
-    
-    double total = 0.0;
-    for (int i=0; i<stats.size();i++)
-    {
-        total+=stats[i];
-    }
-        
-    double nullMean = double (total/stats.size()); 
-
-    cout << '\n' << "average metric score: " << nullMean << endl;
-
-    //cout << "t-test: " << t_test(initscore, runs, nullMean, stats) << endl;
-    
-    if (metric == 1 || metric == 2)
-        cout << "pvalue: " << calc_pvalue_greaterthan (stats, initscore) << endl;
-    else
-        cout << "pvalue: " << calc_pvalue_lessthan (stats, initscore) << endl;
-         
-    //print_matrix(co_matrix, nrows, ncols);
-    
-    return 0;
-    
-}*/
-/**************************************************************************************************/
 
 
index 9c5dd10e8d5f0f65ccf5220bc19764a1a6150c98..ece071b338d704a24ade8685eb4662c2cc9b392f 100644 (file)
@@ -26,9 +26,6 @@ public:
     double calc_vratio (vector<int>, vector<int>);
     int calc_checker (vector<vector<int> > &,vector<int>);
     double calc_c_score (vector<vector<int> > &,vector<int>);
-    int sho(vector<int>,vector<int>,int k);
-    int havel_hakimi(vector<int>,vector<int>,vector<vector<int> > &);
-    int intrand(int);
     
     int sim1 (vector<vector<int> > &);
     void sim2(vector<vector<int> >&);
index c0c569cfd7975ba34e08adaf6fafdba203be9e9b..00c4d94e1027c63d8a0c324167bb3d7ec8e4c570 100644 (file)
@@ -235,7 +235,7 @@ int TrimFlowsCommand::execute(){
                }
                
                vector<unsigned long long> flowFilePos;
-       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                flowFilePos = getFlowFileBreaks();
                for (int i = 0; i < (flowFilePos.size()-1); i++) {
                        lines.push_back(new linePair(flowFilePos[i], flowFilePos[(i+1)]));
@@ -468,7 +468,7 @@ int TrimFlowsCommand::driverCreateTrim(string flowFileName, string trimFlowFileN
                        //report progress
                        if((count) % 10000 == 0){       m->mothurOut(toString(count)); m->mothurOutEndLine();           }
 
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        unsigned long long pos = flowFile.tellg();
 
                        if ((pos == -1) || (pos >= line->end)) { break; }
@@ -715,7 +715,7 @@ int TrimFlowsCommand::createProcessesCreateTrim(string flowFileName, string trim
                processIDS.clear();
                int exitCommand = 1;
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                
                //loop through and create all the processes you want
index 8c996dd9782734a5e9e209ecea4a57f1b1e1d333..f4faacb899a8fd547a14d2bd2224b07882356cdf 100644 (file)
@@ -132,7 +132,7 @@ struct trimFlowData {
 };
 
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyTrimFlowThreadFunction(LPVOID lpParam){ 
        trimFlowData* pDataArray;
index 9913727dcdc8257816e1f83fab2f8a4b903ff1cd..b0fa7a0a2e2f1dbe733207686ec5ed8647ba888e 100644 (file)
@@ -746,7 +746,7 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                                count++;
                        }
                        
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                unsigned long long pos = inFASTA.tellg();
                                if ((pos == -1) || (pos >= line.end)) { break; }
                        
@@ -786,7 +786,7 @@ int TrimSeqsCommand::createProcessesCreateTrim(string filename, string qFileName
                int exitCommand = 1;
                processIDS.clear();
                
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                //loop through and create all the processes you want
                while (process != processors) {
                        int pid = fork();
@@ -1027,7 +1027,7 @@ int TrimSeqsCommand::createProcessesCreateTrim(string filename, string qFileName
                                }
                        }
                        
-            #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+            #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        if(createGroup){
                                ifstream in;
                                string tempFile =  filename + toString(processIDS[i]) + ".num.temp";
@@ -1067,7 +1067,7 @@ int TrimSeqsCommand::setLines(string filename, string qfilename) {
         vector<unsigned long long> fastaFilePos;
                vector<unsigned long long> qfileFilePos;
                
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                //set file positions for fasta file
                fastaFilePos = m->divideFile(filename, processors);
                
@@ -1157,6 +1157,7 @@ int TrimSeqsCommand::setLines(string filename, string qfilename) {
         }else{
             int numFastaSeqs = 0;
             fastaFilePos = m->setFilePosFasta(filename, numFastaSeqs); 
+            if (fastaFilePos.size() < processors) { processors = fastaFilePos.size(); }
         
             if (qfilename != "") { 
                 int numQualSeqs = 0;
index 5006ce923d00183b0bc22ed08adbfaa6240df247..780b4c7381cad9732d41b6fae8fc41736f6083e0 100644 (file)
@@ -169,7 +169,7 @@ struct trimData {
        }
 };
 /**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
 #else
 static DWORD WINAPI MyTrimThreadFunction(LPVOID lpParam){ 
        trimData* pDataArray;
index f9dc450444b242555710f91dc3567f96e69e6d3d..b3a54c929ace3221fe3ba736a3b5fad7f87818f9 100644 (file)
@@ -342,7 +342,7 @@ int UnifracWeightedCommand::execute() {
                                
                                lines.clear();
                                
-                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                        if(processors != 1){
                                                int numPairs = namesOfGroupCombos.size();
                                                int numPairsPerProcessor = numPairs / processors;
@@ -361,7 +361,7 @@ int UnifracWeightedCommand::execute() {
                                //get scores for random trees
                                for (int j = 0; j < iters; j++) {
                                
-                                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                                if(processors == 1){
                                                        driver(T[i],  namesOfGroupCombos, 0, namesOfGroupCombos.size(),  rScores);
                                                }else{
@@ -459,7 +459,7 @@ int UnifracWeightedCommand::execute() {
 
 int UnifracWeightedCommand::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, vector< vector<double> >& scores) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                vector<int> processIDS;
                
index 431323f066665bd07edce8da80c32dadb1600cf2..d4fd32731336913a5ab767736cf52ab1ffc2cd0a 100644 (file)
@@ -48,7 +48,7 @@ EstOutput Unweighted::getValues(Tree* t, int p, string o) {
                        }
                }
 
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        if(processors == 1){
                                data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size());
                        }else{
@@ -83,7 +83,7 @@ EstOutput Unweighted::getValues(Tree* t, int p, string o) {
 
 EstOutput Unweighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                vector<int> processIDS;
                
@@ -291,7 +291,7 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB, int p, st
                        }
                }
 
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        if(processors == 1){
                                data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true);
                        }else{
@@ -326,7 +326,7 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB, int p, st
 
 EstOutput Unweighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, bool usingGroups) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                vector<int> processIDS;
                
index d8a4b857ad19d8057ed4eb11a592aa11e6787721..7a31da4d55d398f47d022de7b80396bb44f6c6b4 100644 (file)
@@ -34,7 +34,7 @@ EstOutput Weighted::getValues(Tree* t, int p, string o) {
                        }
                }
                
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        if(processors == 1){
                                data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size());
                        }else{
@@ -69,7 +69,7 @@ EstOutput Weighted::getValues(Tree* t, int p, string o) {
 
 EstOutput Weighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                vector<int> processIDS;