]> git.donarmstrong.com Git - mothur.git/commitdiff
added count.seqs command and made some modifcations to the uchime code to allow it...
authorwestcott <westcott>
Wed, 1 Jun 2011 14:36:06 +0000 (14:36 +0000)
committerwestcott <westcott>
Wed, 1 Jun 2011 14:36:06 +0000 (14:36 +0000)
12 files changed:
Mothur.xcodeproj/project.pbxproj
blastdb.cpp
chimeraslayer.cpp
chimerauchimecommand.cpp
commandfactory.cpp
countseqscommand.cpp
countseqscommand.h [new file with mode: 0644]
myutils.cpp
myutils.h
seqerrorcommand.cpp
systemcommand.cpp
timing.h

index 546a2f6ec8b54f4adcabce6fc7c0404767379937..9699584ca4e8a856ad85470accae4b08b121f1c8 100644 (file)
@@ -39,6 +39,7 @@
                A74D369C137DAB8400332B0C /* writechhit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74D3686137DAB8300332B0C /* writechhit.cpp */; };
                A74D36B8137DAFAA00332B0C /* chimerauchimecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74D36B7137DAFAA00332B0C /* chimerauchimecommand.cpp */; };
                A75790591301749D00A30DAB /* homovacommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75790581301749D00A30DAB /* homovacommand.cpp */; };
+               A7730EFF13967241007433A3 /* countseqscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7730EFE13967241007433A3 /* countseqscommand.cpp */; };
                A778FE6B134CA6CA00C0BA33 /* getcommandinfocommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A778FE6A134CA6CA00C0BA33 /* getcommandinfocommand.cpp */; };
                A77A221F139001B600B0BE70 /* deuniquetreecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77A221E139001B600B0BE70 /* deuniquetreecommand.cpp */; };
                A799F5B91309A3E000AEEFA0 /* makefastqcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A799F5B81309A3E000AEEFA0 /* makefastqcommand.cpp */; };
                A74D36B7137DAFAA00332B0C /* chimerauchimecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimerauchimecommand.cpp; sourceTree = "<group>"; };
                A75790571301749D00A30DAB /* homovacommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = homovacommand.h; sourceTree = "<group>"; };
                A75790581301749D00A30DAB /* homovacommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = homovacommand.cpp; sourceTree = "<group>"; };
+               A7730EFD13967241007433A3 /* countseqscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = countseqscommand.h; sourceTree = "<group>"; };
+               A7730EFE13967241007433A3 /* countseqscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = countseqscommand.cpp; sourceTree = "<group>"; };
                A778FE69134CA6CA00C0BA33 /* getcommandinfocommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getcommandinfocommand.h; sourceTree = "<group>"; };
                A778FE6A134CA6CA00C0BA33 /* getcommandinfocommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getcommandinfocommand.cpp; sourceTree = "<group>"; };
                A77A221D139001B600B0BE70 /* deuniquetreecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deuniquetreecommand.h; sourceTree = "<group>"; };
                                A7E9B6B712D37EC400DA6239 /* consensusseqscommand.cpp */,
                                A7E9B6BA12D37EC400DA6239 /* corraxescommand.h */,
                                A7E9B6B912D37EC400DA6239 /* corraxescommand.cpp */,
+                               A7730EFD13967241007433A3 /* countseqscommand.h */,
+                               A7730EFE13967241007433A3 /* countseqscommand.cpp */,
                                A7E9B6C412D37EC400DA6239 /* deconvolutecommand.h */,
                                A7E9B6C312D37EC400DA6239 /* deconvolutecommand.cpp */,
                                A7E9B6C612D37EC400DA6239 /* degapseqscommand.h */,
                                A74D369C137DAB8400332B0C /* writechhit.cpp in Sources */,
                                A74D36B8137DAFAA00332B0C /* chimerauchimecommand.cpp in Sources */,
                                A77A221F139001B600B0BE70 /* deuniquetreecommand.cpp in Sources */,
+                               A7730EFF13967241007433A3 /* countseqscommand.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index c7003f4489232b347d6927d718c5d7497d050ae8..48b09fba5fad87eca53d089ec369ee0149b19ade 100644 (file)
@@ -35,9 +35,9 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                formatdbCommand = path + "blast/bin/formatdb";  //      format the database, -o option gives us the ability
 #else
-               formatdbCommand = path + "blast\\bin\\formatdb";
+               formatdbCommand = path + "blast\\bin\\formatdb.exe";
                //wrap entire string in ""
-               formatdbCommand = "\"" + formatdbCommand + "\"";
+               //formatdbCommand = "\"" + formatdbCommand + "\"";
 #endif
                
                //test to make sure formatdb exists
@@ -50,9 +50,9 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                blastCommand = path + "blast/bin/blastall";     //      format the database, -o option gives us the ability
 #else
-               blastCommand = path + "blast\\bin\\blastall";
+               blastCommand = path + "blast\\bin\\blastall.exe";
                //wrap entire string in ""
-               blastCommand = "\"" + blastCommand + "\"";
+               //blastCommand = "\"" + blastCommand + "\"";
 #endif
                
                //test to make sure formatdb exists
@@ -66,9 +66,9 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                megablastCommand = path + "blast/bin/megablast";        //      format the database, -o option gives us the ability
 #else
-               megablastCommand = path + "blast\\bin\\megablast";
+               megablastCommand = path + "blast\\bin\\megablast.exe";
                //wrap entire string in ""
-               megablastCommand = "\"" + blastCommmegablastCommandand + "\"";
+               //megablastCommand = "\"" + megablastCommand + "\"";
 #endif
                
                //test to make sure formatdb exists
@@ -105,9 +105,9 @@ BlastDB::BlastDB() : Database() {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                formatdbCommand = path + "blast/bin/formatdb";  //      format the database, -o option gives us the ability
 #else
-               formatdbCommand = path + "blast\\bin\\formatdb";
+               formatdbCommand = path + "blast\\bin\\formatdb.exe";
                //wrap entire string in ""
-               formatdbCommand = "\"" + formatdbCommand + "\"";
+               //formatdbCommand = "\"" + formatdbCommand + "\"";
 #endif
                
                //test to make sure formatdb exists
@@ -120,9 +120,9 @@ BlastDB::BlastDB() : Database() {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                blastCommand = path + "blast/bin/blastall";     //      format the database, -o option gives us the ability
 #else
-               blastCommand = path + "blast\\bin\\blastall";
+               blastCommand = path + "blast\\bin\\blastall.exe";
                //wrap entire string in ""
-               blastCommand = "\"" + blastCommand + "\"";
+               //blastCommand = "\"" + blastCommand + "\"";
 #endif
                
                //test to make sure formatdb exists
@@ -136,9 +136,9 @@ BlastDB::BlastDB() : Database() {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                megablastCommand = path + "blast/bin/megablast";        //      format the database, -o option gives us the ability
 #else
-               megablastCommand = path + "blast\\bin\\megablast";
+               megablastCommand = path + "blast\\bin\\megablast.exe";
                //wrap entire string in ""
-               megablastCommand = "\"" + blastCommmegablastCommandand + "\"";
+               //megablastCommand = "\"" + megablastCommand + "\"";
 #endif
                
                //test to make sure formatdb exists
index b00cedfba5b4edf8463343618ebdd80acae209be..97b331b65b556baafbd721cc6d0186097bdfa09e 100644 (file)
@@ -1127,7 +1127,7 @@ vector<Sequence> ChimeraSlayer::getBlastSeqs(Sequence q, vector<Sequence*>& db,
                delete queryRight;
                delete queryLeft;
                
-               if (refResults.size() == 0) { m->mothurOut("[WARNING]: megablast found 0 potential parents, so we are not able to check " + q.getName() + ". This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors."); m->mothurOutEndLine(); }
+               if (refResults.size() == 0) { m->mothurOut("[WARNING]: megablast returned 0 potential parents, so we are not able to check " + q.getName() + ". This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors."); m->mothurOutEndLine(); }
                
                return refResults;
        }
index d4cb57a3158a85008d30d9c875e331f5be5801e9..33b48bd184ba95f1db5e1db2117a32a64254c664 100644 (file)
@@ -744,7 +744,7 @@ int ChimeraUchimeCommand::createProcesses(string outputFileName, string filename
                processIDS.clear();
                int process = 1;
                int num = 0;
-               
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)          
                //break up file into multiple files
                vector<string> files;
                m->divideFile(filename, processors, files);
@@ -852,7 +852,7 @@ int ChimeraUchimeCommand::createProcesses(string outputFileName, string filename
 #endif         
                //get rid of the file pieces.
                for (int i = 0; i < files.size(); i++) { remove(files[i].c_str()); }
-               
+#endif         
                return num;     
        }
        catch(exception& e) {
index 71558a9292280dcc9f28acb29b2944fb62a05eb6..620536d8628931d8b9f9a5db1132ab04e28f456f 100644 (file)
 #include "sharedcommand.h"
 #include "getcommandinfocommand.h"
 #include "deuniquetreecommand.h"
+#include "countseqscommand.h"
 
 /*******************************************************/
 
@@ -241,6 +242,7 @@ CommandFactory::CommandFactory(){
        commands["set.current"]                 = "set.current";
        commands["get.commandinfo"]             = "get.commandinfo";
        commands["deunique.tree"]               = "deunique.tree";
+       commands["count.seqs"]                  = "count.seqs";
        commands["pairwise.seqs"]               = "MPIEnabled";
        commands["pipeline.pds"]                = "MPIEnabled";
        commands["classify.seqs"]               = "MPIEnabled"; 
@@ -412,6 +414,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString){
                else if(commandName == "make.shared")                   {       command = new SharedCommand(optionString);                                      }
                else if(commandName == "get.commandinfo")               {       command = new GetCommandInfoCommand(optionString);                      }
                else if(commandName == "deunique.tree")                 {       command = new DeuniqueTreeCommand(optionString);                        }
+               else if(commandName == "count.seqs")                    {       command = new CountSeqsCommand(optionString);                           }
                else                                                                                    {       command = new NoCommand(optionString);                                          }
 
                return command;
@@ -549,6 +552,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString, str
                else if(commandName == "make.shared")                   {       pipecommand = new SharedCommand(optionString);                                  }
                else if(commandName == "get.commandinfo")               {       pipecommand = new GetCommandInfoCommand(optionString);                  }
                else if(commandName == "deunique.tree")                 {       pipecommand = new DeuniqueTreeCommand(optionString);                    }
+               else if(commandName == "count.seqs")                    {       pipecommand = new CountSeqsCommand(optionString);                               }
                else                                                                                    {       pipecommand = new NoCommand(optionString);                                              }
 
                return pipecommand;
@@ -674,6 +678,7 @@ Command* CommandFactory::getCommand(string commandName){
                else if(commandName == "make.shared")                   {       shellcommand = new SharedCommand();                                     }
                else if(commandName == "get.commandinfo")               {       shellcommand = new GetCommandInfoCommand();                     }
                else if(commandName == "deunique.tree")                 {       shellcommand = new DeuniqueTreeCommand();                       }
+               else if(commandName == "count.seqs")                    {       shellcommand = new CountSeqsCommand();                          }
                else                                                                                    {       shellcommand = new NoCommand();                                         }
 
                return shellcommand;
index 8164e2714db5fc4c1f2c1d59f9593475717386b5..a4464692607df14d08384f3cfdf112a4e18debb8 100644 (file)
@@ -33,7 +33,7 @@ vector<string> CountSeqsCommand::setParameters(){
 string CountSeqsCommand::getHelpString(){      
        try {
                string helpString = "";
-               helpString += "The count.seqs command reads a name file and outputs a .count.summary file.  You may also provide a group file to get the counts broken down by group.\n";
+               helpString += "The count.seqs command reads a name file and outputs a .seq.count file.  You may also provide a group file to get the counts broken down by group.\n";
                helpString += "The groups parameter allows you to indicate which groups you want to include in the counts, by default all groups in your groupfile are used.\n";
                helpString += "When you use the groups parameter and a sequence does not represent any sequences from the groups you specify it is not included in the .count.summary file.\n";
                helpString += "The count.seqs command should be in the following format: count.seqs(name=yourNameFile).\n";
@@ -146,7 +146,7 @@ int CountSeqsCommand::execute(){
                if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                ofstream out;
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + "count.summary";
+               string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + ".seq.count";
                m->openOutputFile(outputFileName, out); outputTypes["summary"].push_back(outputFileName);
                out << "Representative Sequence\t total\t";
                
diff --git a/countseqscommand.h b/countseqscommand.h
new file mode 100644 (file)
index 0000000..385cd13
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef COuNTSEQSCOMMAND_H
+#define COuNTSEQSCOMMAND_H
+
+/*
+ *  countseqscommand.h
+ *  Mothur
+ *
+ *  Created by westcott on 6/1/11.
+ *  Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "command.hpp"
+
+class CountSeqsCommand : public Command {
+       
+public:
+       
+       CountSeqsCommand(string);
+       CountSeqsCommand();     
+       ~CountSeqsCommand(){}
+       
+       vector<string> setParameters();
+       string getCommandName()                 { return "count.seqs";                          }
+       string getCommandCategory()             { return "Sequence Processing";         }
+       string getHelpString(); 
+       string getCitation() { return "http://www.mothur.org/wiki/Count.seqs"; }
+       
+       int execute(); 
+       void help() { m->mothurOut(getHelpString()); }  
+       
+       
+private:
+       string namefile, groupfile, outputDir, groups;
+       bool abort;
+       vector<string> Groups;
+};
+
+#endif
+
+
index e9d52c2c936eb2d131109f7b46fe365d41931a9d..b9c01470f75a9f26baae58a174765fc154ce20d3 100755 (executable)
 #include <signal.h>\r
 #include <float.h>\r
 \r
-#ifdef _MSC_VER\r
-#include <crtdbg.h>\r
-#include <process.h>\r
-#include <windows.h>\r
-#include <psapi.h>\r
-#include <io.h>\r
-#else\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
 #include <sys/time.h>\r
 #include <sys/resource.h>\r
 #include <unistd.h>\r
 #include <errno.h>\r
 #include <fcntl.h>\r
 #include <stdlib.h>\r
+#else\r
+//#include <crtdbg.h>\r
+#include <process.h>\r
+#include <windows.h>\r
+#include <psapi.h>\r
+#include <io.h>\r
 #endif\r
 \r
 #include "myutils.h"\r
@@ -141,7 +141,9 @@ bool myisatty(int fd)
        return isatty(fd) != 0;\r
        }\r
 \r
-#ifdef _MSC_VER\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#else\r
+#ifdef BIT_VERSION\r
 #include <io.h>\r
 int fseeko(FILE *stream, off_t offset, int whence)\r
        {\r
@@ -149,6 +151,14 @@ int fseeko(FILE *stream, off_t offset, int whence)
        return (FilePos == -1L) ? -1 : 0;\r
        }\r
 #define ftello(fm) (off_t) _ftelli64(fm)\r
+#else \r
+int fseeko(FILE *stream, off_t offset, int whence)\r
+{\r
+       off_t FilePos = fseek(stream, offset, whence);\r
+       return (FilePos == -1L) ? -1 : 0;\r
+}\r
+#define ftello(fm) (off_t) ftell(fm)\r
+#endif\r
 #endif\r
 \r
 void LogStdioFileState(FILE *f)\r
@@ -168,9 +178,16 @@ void LogStdioFileState(FILE *f)
        Log("fpos       %ld (retval %d)\n", (long) fpos, fgetpos_retval);\r
 //     Log("eof        %d\n", _eof(fd));\r
 #endif\r
-#ifdef _MSC_VER\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#else\r
+#ifdef BIT_VERSION\r
        __int64 pos64 = _ftelli64(f);\r
        Log("_ftelli64  %lld\n", pos64);\r
+#else\r
+       __int32 pos32 = ftell(f);\r
+       Log("ftell  %lld\n", pos32);\r
+               \r
+#endif\r
 #endif\r
        }\r
 \r
@@ -596,10 +613,11 @@ 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
-#ifdef _MSC_VER\r
-       if (IsDebuggerPresent())\r
-               __debugbreak();\r
-       _CrtSetDbgFlag(0);\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#else\r
+       //if (IsDebuggerPresent())\r
+       //      __debugbreak();\r
+       //_CrtSetDbgFlag(0);\r
 #endif\r
 \r
        exit(1);\r
@@ -624,20 +642,7 @@ void Warning(const char *Format, ...)
                }\r
        }\r
 \r
-#ifdef _MSC_VER\r
-double GetMemUseBytes()\r
-       {\r
-       HANDLE hProc = GetCurrentProcess();\r
-       PROCESS_MEMORY_COUNTERS PMC;\r
-       BOOL bOk = GetProcessMemoryInfo(hProc, &PMC, sizeof(PMC));\r
-       if (!bOk)\r
-               return 1000000;\r
-       double Bytes = (double) PMC.WorkingSetSize;\r
-       if (Bytes > g_PeakMemUseBytes)\r
-               g_PeakMemUseBytes = Bytes;\r
-       return Bytes;\r
-       }\r
-#elif  linux || __linux__\r
+#if defined linux || __linux__\r
 double GetMemUseBytes()\r
        {\r
        static char statm[64];\r
@@ -668,7 +673,7 @@ double GetMemUseBytes()
                g_PeakMemUseBytes = Bytes;\r
        return Bytes;\r
        }\r
-#elif defined(__MACH__)\r
+#elif defined(__APPLE__) || (__MACH__)\r
 #include <memory.h>\r
 #include <stdlib.h>\r
 #include <stdio.h>\r
@@ -709,9 +714,9 @@ double GetMemUseBytes()
        }\r
 #else\r
 double GetMemUseBytes()\r
-       {\r
+{\r
        return 0;\r
-       }\r
+}\r
 #endif\r
 \r
 double GetPeakMemUseBytes()\r
@@ -1201,7 +1206,8 @@ static void AddOpt(const OptInfo &Opt)
        g_Opts.insert(Opt);\r
        }\r
 \r
-#ifdef _MSC_VER\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#else\r
 #pragma warning(disable: 4505) // unreferenced local function\r
 #endif\r
 \r
index 61220546b81894283bb6350f5c2c51ecc8800cb2..6374c8bee360033277aba81f73e836ef9a86cc13 100644 (file)
--- a/myutils.h
+++ b/myutils.h
 #include <cstdlib>\r
 #include <climits>\r
 \r
-#ifndef _MSC_VER\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#else\r
 #include <inttypes.h>\r
 #endif\r
 \r
 using namespace std;\r
 \r
-#ifdef _MSC_VER\r
-#include <crtdbg.h>\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#else\r
+//#include <crtdbg.h>\r
 #pragma warning(disable: 4996) // deprecated functions\r
 #define _CRT_SECURE_NO_DEPRECATE       1\r
 #endif\r
 \r
-#if defined(_DEBUG) && !defined(DEBUG)\r
+//#if defined(_DEBUG) && !defined(DEBUG)\r
 #define DEBUG  1\r
-#endif\r
+//#endif\r
 \r
-#if defined(DEBUG) && !defined(_DEBUG)\r
+//#if defined(DEBUG) && !defined(_DEBUG)\r
 #define _DEBUG 1\r
-#endif\r
+//#endif\r
 \r
-#ifndef NDEBUG\r
+//#ifndef NDEBUG\r
 #define        DEBUG   1\r
 #define        _DEBUG  1\r
-#endif\r
+//#endif\r
 \r
 typedef unsigned char byte;\r
 typedef unsigned short uint16;\r
@@ -49,10 +51,10 @@ typedef double float32;
 typedef signed char int8;\r
 typedef unsigned char uint8;\r
 \r
-#ifdef _MSC_VER\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
 \r
-typedef __int64 int64;\r
-typedef unsigned __int64 uint64;\r
+typedef long long int64;\r
+typedef unsigned long long uint64;\r
 \r
 #define INT64_PRINTF           "lld"\r
 #define UINT64_PRINTF          "llu"\r
@@ -66,6 +68,7 @@ typedef unsigned __int64 uint64;
 #define SIZE_T_PRINTFX         "x"\r
 #define OFF64_T_PRINTFX                "llx"\r
 \r
+\r
 #elif defined(__x86_64__)\r
 \r
 typedef long int64;\r
@@ -85,8 +88,8 @@ typedef unsigned long uint64;
 \r
 #else\r
 \r
-typedef long long int64;\r
-typedef unsigned long long uint64;\r
+typedef __int64 int64;\r
+typedef unsigned __int64 uint64;\r
 \r
 #define INT64_PRINTF           "lld"\r
 #define UINT64_PRINTF          "llu"\r
@@ -99,6 +102,7 @@ typedef unsigned long long uint64;
 \r
 #define SIZE_T_PRINTFX         "x"\r
 #define OFF64_T_PRINTFX                "llx"\r
+\r
 #endif\r
 \r
 #define d64            INT64_PRINTF\r
@@ -160,7 +164,8 @@ void myfree(void *p);
 \r
 bool myisatty(int fd);\r
 \r
-#ifdef _MSC_VER\r
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+#else\r
 #define off_t  __int64\r
 #endif\r
 \r
index 2774922a78d43f08186d15d29e15632b2af76de8..5efb1ce78c659577c520defc124c48e60b848dc8 100644 (file)
@@ -347,6 +347,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)
                
                //loop through and create all the processes you want
                while (process != processors) {
@@ -569,7 +570,7 @@ int SeqErrorCommand::createProcesses(string filename, string qFileName, string r
                        in.close(); remove(tempFile.c_str());
                        
                }
-               
+#endif         
                return num;
        }
        catch(exception& e) {
index e5aeb3e8b73dfb59008f6ddccaa3b0703b25e696..5ace75e3a2d152f27e6483aab2ad4a697f952c79 100644 (file)
@@ -91,20 +91,23 @@ int SystemCommand::execute(){
                
                if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
-               //system(command.c_str());
-               FILE *lsofFile_p = popen(command.c_str(), "r");
+               command += " > ./commandScreen.output 2>&1";
+               system(command.c_str());
                
-               if (!lsofFile_p) { return 0; }
+               ifstream in;
+               string filename = "./commandScreen.output";
+               m->openInputFile(filename, in);
                
-               char buffer[1024];
-               while ( fgets(buffer, 1024, lsofFile_p) != NULL ) {
-                       string temp = buffer;
-                       m->mothurOut(temp); 
+               string output = "";
+               while(char c = in.get()){
+                       if(in.eof())            {       break;                  }
+                       else                            {       output += c;    }
                }
-               m->mothurOutEndLine();
-               
-               pclose(lsofFile_p);
+               in.close();
                
+               m->mothurOut(output); m->mothurOutEndLine();
+               remove(filename.c_str());
+                               
                return 0;               
        }
 
index 10bd1f7705bed69363a08c9a2b3d2dd99cf3c054..4db7847346356b41a8a12a9e226413f2e81abecb 100644 (file)
--- a/timing.h
+++ b/timing.h
@@ -59,30 +59,29 @@ const unsigned AllocerCount =
 #undef A
        ;
 
-#ifdef _MSC_VER
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+typedef uint64_t TICKS;
+__inline__ uint64_t GetClockTicks()
+{
+       uint32_t lo, hi;
+       /* We cannot use "=A", since this would use %rax on x86_64 */
+       __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
+       return (uint64_t)hi << 32 | lo;
+}
 
+
+#else  // ifdef _MSC_VER
 typedef unsigned __int64 TICKS;
 
 #pragma warning(disable:4035)
 inline TICKS GetClockTicks()
-       {
+{
        _asm
-               {
+       {
                _emit   0x0f
                _emit   0x31
-               }
-       }
-
-#else  // ifdef _MSC_VER
-
-typedef uint64_t TICKS;
-__inline__ uint64_t GetClockTicks()
-       {
-       uint32_t lo, hi;
-       /* We cannot use "=A", since this would use %rax on x86_64 */
-       __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
-       return (uint64_t)hi << 32 | lo;
        }
+}
 
 #endif // ifdef _MSC_VER