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;
};
#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
#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
#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
#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
#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
#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
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;
}
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);
#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) {
#include "sharedcommand.h"
#include "getcommandinfocommand.h"
#include "deuniquetreecommand.h"
+#include "countseqscommand.h"
/*******************************************************/
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";
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;
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;
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;
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";
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";
--- /dev/null
+#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
+
+
#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
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
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
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
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
}\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
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
}\r
#else\r
double GetMemUseBytes()\r
- {\r
+{\r
return 0;\r
- }\r
+}\r
#endif\r
\r
double GetPeakMemUseBytes()\r
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
#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
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
#define SIZE_T_PRINTFX "x"\r
#define OFF64_T_PRINTFX "llx"\r
\r
+\r
#elif defined(__x86_64__)\r
\r
typedef long int64;\r
\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
\r
#define SIZE_T_PRINTFX "x"\r
#define OFF64_T_PRINTFX "llx"\r
+\r
#endif\r
\r
#define d64 INT64_PRINTF\r
\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
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) {
in.close(); remove(tempFile.c_str());
}
-
+#endif
return num;
}
catch(exception& e) {
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;
}
#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