*/
#include "clearcutcommand.h"
-#include "globaldata.hpp"
/**************************************************************************************/
ClearcutCommand::ClearcutCommand(string option) {
else {
//valid paramters for this command
string Array[] = {"fasta","phylip","version","verbose","quiet","seed","norandom","shuffle","neighbor","expblen",
- "expdist","ntrees","matrixout","stdout","kimura","jukes","protein","DNA","stdin","outputdir","inputdir"};
+ "expdist","ntrees","matrixout","stdout","kimura","jukes","protein","DNA","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
temp = validParameter.validFile(parameters, "neighbor", false); if (temp == "not found"){ temp = "F"; }
neighbor = isTrue(temp);
- temp = validParameter.validFile(parameters, "stdin", false); if (temp == "not found"){ temp = "F"; }
- stdin = isTrue(temp);
-
temp = validParameter.validFile(parameters, "DNA", false); if (temp == "not found"){ temp = "F"; }
DNA = isTrue(temp);
kimura = isTrue(temp);
temp = validParameter.validFile(parameters, "stdout", false); if (temp == "not found"){ temp = "F"; }
- stdout = isTrue(temp);
+ stdoutWanted = isTrue(temp);
matrixout = validParameter.validFile(parameters, "matrixout", false); if (matrixout == "not found"){ matrixout = ""; }
try {
m->mothurOut("The clearcut command interfaces mothur with the clearcut program written by Initiative for Bioinformatics and Evolutionary Studies (IBEST) at the University of Idaho.\n");
m->mothurOut("For more information about clearcut refer to http://bioinformatics.hungry.com/clearcut/ \n");
- m->mothurOut("The clearcut command parameters are phylip, fasta, version, verbose, quiet, seed, norandom, shuffle, neighbor, expblen, expdist, ntrees, matrixout, stdout, kimura, jukes, protein, DNA, stdin. \n");
+ m->mothurOut("The clearcut executable must be in a folder called clearcut in the same folder as your mothur executable, similar to mothur's requirements for using blast. \n");
+ m->mothurOut("The clearcut command parameters are phylip, fasta, version, verbose, quiet, seed, norandom, shuffle, neighbor, expblen, expdist, ntrees, matrixout, stdout, kimura, jukes, protein, DNA. \n");
m->mothurOut("The phylip parameter allows you to enter your phylip formatted distance matrix. \n");
m->mothurOut("The fasta parameter allows you to enter your aligned fasta file, if you enter a fastafile you specify if the sequences are DNA or protein using the DNA or protein parameters. \n");
m->mothurOut("The shuffle parameter allows you to randomly shuffle the distance matrix, default=F. \n");
m->mothurOut("The neighbor parameter allows you to use traditional Neighbor-Joining algorithm, default=F. \n");
- m->mothurOut("The stdin parameter reads input from STDIN, default=F. \n");
m->mothurOut("The DNA parameter allows you to indicate your fasta file contains DNA sequences, default=F. \n");
m->mothurOut("The protein parameter allows you to indicate your fasta file contains protein sequences, default=F. \n");
m->mothurOut("The clearcut command should be in the following format: \n");
m->mothurOut("clearcut(phylip=yourDistanceFile) \n");
m->mothurOut("Example: clearcut(phylip=abrecovery.phylip.dist) \n");
+
}
catch(exception& e) {
m->errorOut(e, "ClearcutCommand", "help");
GlobalData* globaldata = GlobalData::getInstance();
string path = globaldata->argv;
path = path.substr(0, (path.find_last_of('m')));
-
- string clearcutCommand = path + "clearcut/clearcut ";
+
+ string clearcutCommand = "";
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+ clearcutCommand = path + "clearcut/clearcut ";
+ #else
+ clearcutCommand = path + "clearcut\\clearcut ";
+ #endif
//you gave us a distance matrix
if (phylipfile != "") { clearcutCommand += "--distance "; }
if (shuffle) { clearcutCommand += "--shuffle "; }
if (neighbor) { clearcutCommand += "--neighbor "; }
- if (stdin) { clearcutCommand += "--stdin "; }
- else { clearcutCommand += "--in=" + inputFile + " "; }
- if (stdout) { clearcutCommand += "--stdout "; }
- else { clearcutCommand += "--out=" + outputName + " "; }
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+ clearcutCommand += "--in=" + inputFile + " ";
+ #else
+ clearcutCommand += "--in=\"" + inputFile + "\" ";
+ #endif
+
+ if (stdoutWanted) { clearcutCommand += "--stdout "; }
+ else{
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+ clearcutCommand += "--out=" + outputName + " "; }
+ #else
+ clearcutCommand += "--out=\"" + outputName + "\" "; }
+ #endif
if (DNA) { clearcutCommand += "--DNA "; }
if (protein) { clearcutCommand += "--protein "; }
if (jukes) { clearcutCommand += "--jukes "; }
if (kimura) { clearcutCommand += "--kimura "; }
- if (matrixout != "") { clearcutCommand += "--matrixout=" + matrixout + " "; }
+ if (matrixout != "") { clearcutCommand += "--matrixout=" + matrixout + " "; }
if (ntrees != "1") { clearcutCommand += "--ntrees=" + ntrees + " "; }
if (expblen) { clearcutCommand += "--expblen "; }
if (expdist) { clearcutCommand += "--expdist "; }
-
+
//run clearcut
system(clearcutCommand.c_str());
- if (!stdout) {
+ if (!stdoutWanted) {
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
- m->mothurOut(outputName); m->mothurOutEndLine();
+ m->mothurOut(outputName); m->mothurOutEndLine();
+ if (matrixout != "") { m->mothurOut(matrixout); m->mothurOutEndLine(); }
m->mothurOutEndLine();
}
}
}
/**************************************************************************************/
+
+
+
+