37D9289F0F21331F001D4494 /* validparameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928530F21331F001D4494 /* validparameter.cpp */; };
37E5F3E30F29FD4200F8D827 /* treenode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E5F3E20F29FD4200F8D827 /* treenode.cpp */; };
37E5F4920F2A3DA800F8D827 /* readtreecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */; };
+ 7E09C5140FDA79C5002ECAE5 /* reversecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E09C5130FDA79C5002ECAE5 /* reversecommand.cpp */; };
7E412F490F8D21B600381DD0 /* slibshuff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E412F480F8D21B600381DD0 /* slibshuff.cpp */; };
7E412FEA0F8D3E2C00381DD0 /* libshuff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E412FE90F8D3E2C00381DD0 /* libshuff.cpp */; };
7E4130F80F8E58FA00381DD0 /* dlibshuff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4130F60F8E58FA00381DD0 /* dlibshuff.cpp */; };
37E5F3E20F29FD4200F8D827 /* treenode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = treenode.cpp; sourceTree = SOURCE_ROOT; };
37E5F4900F2A3DA800F8D827 /* readtreecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readtreecommand.h; sourceTree = SOURCE_ROOT; };
37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readtreecommand.cpp; sourceTree = SOURCE_ROOT; };
+ 7E09C5120FDA79C5002ECAE5 /* reversecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reversecommand.h; sourceTree = "<group>"; };
+ 7E09C5130FDA79C5002ECAE5 /* reversecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = reversecommand.cpp; sourceTree = "<group>"; };
7E412F420F8D213C00381DD0 /* libshuff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libshuff.h; sourceTree = SOURCE_ROOT; };
7E412F470F8D21B600381DD0 /* slibshuff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slibshuff.h; sourceTree = SOURCE_ROOT; };
7E412F480F8D21B600381DD0 /* slibshuff.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slibshuff.cpp; sourceTree = SOURCE_ROOT; };
37D928A90F2133E5001D4494 /* commands */ = {
isa = PBXGroup;
children = (
+ 7E09C5120FDA79C5002ECAE5 /* reversecommand.h */,
+ 7E09C5130FDA79C5002ECAE5 /* reversecommand.cpp */,
37D927CD0F21331F001D4494 /* command.hpp */,
378DC5CD0FBDE1C8003B8607 /* aligncommand.h */,
378DC5CE0FBDE1C8003B8607 /* aligncommand.cpp */,
3799A9500FD6A58C00E33EDE /* distancedb.cpp in Sources */,
3799A9510FD6A58C00E33EDE /* seqsummarycommand.cpp in Sources */,
371B30B40FD7EE67000414CA /* screenseqscommand.cpp in Sources */,
+ 7E09C5140FDA79C5002ECAE5 /* reversecommand.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
#include "getrabundcommand.h"
#include "seqsummarycommand.h"
#include "screenseqscommand.h"
-
+#include "reversecommand.h"
/***********************************************************/
else if(commandName == "align.seqs") { command = new AlignCommand(); }
else if(commandName == "summary.seqs") { command = new SeqSummaryCommand(); }
else if(commandName == "screen.seqs") { command = new ScreenSeqsCommand(); }
+ else if(commandName == "reverse.seqs") { command = new ReverseSeqsCommand(); }
else { command = new NoCommand(); }
return command;
if(keep == 0) { filter[i] = 0; }
}
-
}
/**************************************************************************************/
--- /dev/null
+/*
+ * reversecommand.cpp
+ * Mothur
+ *
+ * Created by Pat Schloss on 6/6/09.
+ * Copyright 2009 Patrick D. Schloss. All rights reserved.
+ *
+ */
+
+#include "reversecommand.h"
+#include "sequence.hpp"
+
+
+//***************************************************************************************************************
+
+ReverseSeqsCommand::ReverseSeqsCommand(){
+ try {
+ globaldata = GlobalData::getInstance();
+ if(globaldata->getFastaFile() == "") { cout << "you need to at least enter a fasta file name" << endl; }
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the SeqCoordCommand class Function SeqCoordCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the SeqCoordCommand class function SeqCoordCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+//***************************************************************************************************************
+
+ReverseSeqsCommand::~ReverseSeqsCommand(){ /* do nothing */ }
+
+//***************************************************************************************************************
+
+
+int ReverseSeqsCommand::execute(){
+ try{
+
+ ifstream inFASTA;
+ openInputFile(globaldata->getFastaFile(), inFASTA);
+
+ ofstream outFASTA;
+ string reverseFile = getRootName(globaldata->getFastaFile()) + "rc" + getExtension(globaldata->getFastaFile());
+ openOutputFile(reverseFile, outFASTA);
+
+ while(!inFASTA.eof()){
+ Sequence currSeq(inFASTA);
+ currSeq.reverseComplement();
+ currSeq.printSequence(outFASTA);
+ }
+ inFASTA.close();
+ outFASTA.close();
+
+ return 0;
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the FilterSeqsCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the FilterSeqsCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+//***************************************************************************************************************
--- /dev/null
+#ifndef REVERSECOMMAND_H
+#define REVERSECOMMAND_H
+
+/*
+ * reversecommand.h
+ * Mothur
+ *
+ * Created by Pat Schloss on 6/6/09.
+ * Copyright 2009 Patrick D. Schloss. All rights reserved.
+ *
+ */
+
+#include "mothur.h"
+#include "command.hpp"
+#include "globaldata.hpp"
+
+class ReverseSeqsCommand : public Command {
+public:
+ ReverseSeqsCommand();
+ ~ReverseSeqsCommand();
+ int execute();
+
+private:
+ GlobalData* globaldata;
+
+};
+
+#endif
set<string> badSeqNames;
- string goodSeqFile = getRootName(globaldata->inputFileName) + "good" + getExtension(globaldata->inputFileName);
- string badSeqFile = getRootName(globaldata->inputFileName) + "bad" + getExtension(globaldata->inputFileName);
+ string goodSeqFile = getRootName(globaldata->getFastaFile()) + "good" + getExtension(globaldata->getFastaFile());
+ string badSeqFile = getRootName(globaldata->getFastaFile()) + "bad" + getExtension(globaldata->getFastaFile());
ofstream goodSeqOut; openOutputFile(goodSeqFile, goodSeqOut);
ofstream badSeqOut; openOutputFile(badSeqFile, badSeqOut);
}
gobble(inFASTA);
}
+ if(globaldata->getNameFile() != ""){
+ screenNameGroupFile(badSeqNames);
+ }
+ else if(globaldata->getGroupFile() != ""){
+ screenGroupFile(badSeqNames);
+ }
return 0;
}
commands["align.seqs"] = "align.seqs";
commands["summary.seqs"] = "summary.seqs";
commands["screen.seqs"] = "screen.seqs";
+ commands["reverse.seqs"] = "reverse.seqs";
commands["quit"] = "quit";
string screenseqsArray[] = {"fasta", "start", "end", "maxambig", "maxhomop", "minlength", "maxlength", "name", "group"};
commandParameters["screen.seqs"] = addParameters(screenseqsArray, sizeof(screenseqsArray)/sizeof(string));
+ string reverseseqsArray[] = {"fasta"};
+ commandParameters["reverse.seqs"] = addParameters(reverseseqsArray, sizeof(reverseseqsArray)/sizeof(string));
+
string vennArray[] = {"groups","line","label","calc"};
commandParameters["venn"] = addParameters(vennArray, sizeof(vennArray)/sizeof(string));