//**********************************************************************************************************************
ClusterFragmentsCommand::ClusterFragmentsCommand(){
try {
- abort = true;
- //initialize outputTypes
+ abort = true; calledHelp = true;
vector<string> tempOutNames;
outputTypes["fasta"] = tempOutNames;
outputTypes["name"] = tempOutNames;
//**********************************************************************************************************************
ClusterFragmentsCommand::ClusterFragmentsCommand(string option) {
try {
- abort = false;
+ abort = false; calledHelp = false;
//allow user to run help
- if(option == "help") { help(); abort = true; }
+ if(option == "help") { help(); abort = true; calledHelp = true; }
else {
//valid paramters for this command
int ClusterFragmentsCommand::execute(){
try {
- if (abort == true) { return 0; }
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
int start = time(NULL);
if (alignSeqs[j].active) { //this sequence has not been merged yet
string jBases = alignSeqs[j].seq.getUnaligned();
-
+
if (isFragment(iBases, jBases)) {
//merge
alignSeqs[i].names += ',' + alignSeqs[j].names;
m->mothurOut(newNamesFile); m->mothurOutEndLine();
outputNames.push_back(newFastaFile); outputNames.push_back(newNamesFile); outputTypes["fasta"].push_back(newFastaFile); outputTypes["name"].push_back(newNamesFile);
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
return 0;
int percentDiff = floor((seq2.length() * (percent / 100.0)));
if (percentDiff < totalDiffs) { totalDiffs = percentDiff; }
}
-
+
Alignment* alignment = new NeedlemanOverlap(-1.0, 1.0, -1.0, (seq1.length()+totalDiffs+1));
//use needleman to align
}
if (numDiffs <= totalDiffs) { fragment = true; }
+
}
return fragment;