AlignCommand::AlignCommand(){
try {
globaldata = GlobalData::getInstance();
- candidateFileName = globaldata->inputFileName;
- templateFileName = globaldata->getTemplateFile();
+ candidateFileName = globaldata->getCandidateFile();
+ templateFileName = globaldata->getFastaFile();
openInputFile(candidateFileName, in);
convert(globaldata->getKSize(), kmerSize);
convert(globaldata->getMatch(), match);
if (parameter == "ends" ) { ends = value; }
if (parameter == "processors" ) { processors = value; }
if (parameter == "size" ) { size = value; }
- if (parameter == "template") { templatefile = value; }
+ if (parameter == "candidate") { candidatefile = value; }
if (parameter == "search") { search = value; }
if (parameter == "ksize") { ksize = value; }
if (parameter == "align") { align = value; }
if (parameter == "ends" ) { ends = value; }
if (parameter == "processors" ) { processors = value; }
if (parameter == "size" ) { size = value; }
- if (parameter == "template") { templatefile = value; }
+ if (parameter == "candidate") { candidatefile = value; }
if (parameter == "search") { search = value; }
if (parameter == "ksize") { ksize = value; }
if (parameter == "align") { align = value; }
}
}
- if ((commandName == "filter.seqs") || (commandName == "dist.seqs") || (commandName == "align.seqs")) {
+ if ((commandName == "filter.seqs") || (commandName == "dist.seqs")) {
if ((fastafile == "") && (nexusfile == "") && (clustalfile == "") && (phylipfile == "")) {
- cout << "You must enter either a fasta, nexus, clustal, or phylip file before you can use the filter.seqs, dist.seqs or align.seqs command." << endl; return false;
- }else if ((commandName == "align.seqs") && (templatefile == "")) {
- cout << "You must enter a template to use the align.seqs command." << endl; return false;
+ cout << "You must enter either a fasta, nexus, clustal, or phylip file before you can use the filter.seqs or dist.seqs command." << endl; return false;
+ }
+ validateSeqsFiles();
+ }
+
+ if (commandName == "align.seqs") {
+ if ((fastafile == "") || (candidatefile == "")) {
+ cout << "You must enter fasta and a candidate file to use the align.seqs command." << endl; return false;
}
validateSeqsFiles();
}
errorFree = false;
}
}
- }else if (templatefile != "") {
- ableToOpen = openInputFile(templatefile, filehandle);
+ }else if (candidatefile != "") {
+ ableToOpen = openInputFile(candidatefile, filehandle);
filehandle.close();
if (ableToOpen == 1) { //unable to open
errorFree = false;
fastafile = "";
nexusfile = "";
clustalfile = "";
- templatefile = "";
+ candidatefile = "";
line = "";
label = "";
method = "furthest";
void refresh();
string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, nexusfile, clustalfile, treefile, sharedfile, cutoff, format;
string precision, method, fileroot, label, line, iters, jumble, freq, single, rarefaction, shared, summary, randomtree, abund, sorted, trump, soft, filter, scale, ends, processors, size;
- string templatefile, search, ksize, align, match, mismatch, gapopen, gapextend;
+ string candidatefile, search, ksize, align, match, mismatch, gapopen, gapextend;
string commandName, optionText;
bool errorFree;
if (key == "ends" ) { ends = value; }
if (key == "processors" ) { processors = value; }
if (key == "size" ) { size = value; }
- if (key == "template") { templatefile = value; }
+ if (key == "candidate") { candidatefile = value; }
if (key == "search") { search = value; }
if (key == "ksize") { ksize = value; }
if (key == "align") { align = value; }
if (key == "ends" ) { ends = value; }
if (key == "processors" ) { processors = value; }
if (key == "size" ) { size = value; }
- if (key == "template") { templatefile = value; }
+ if (key == "candidate") { candidatefile = value; }
if (key == "search") { search = value; }
if (key == "ksize") { ksize = value; }
if (key == "align") { align = value; }
string GlobalData::getEnds() { return ends; }
string GlobalData::getProcessors() { return processors; }
string GlobalData::getSize() { return size; }
-string GlobalData::getTemplateFile() { return templatefile;}
+string GlobalData::getCandidateFile() { return candidatefile;}
string GlobalData::getSearch() { return search; }
string GlobalData::getKSize() { return ksize; }
string GlobalData::getAlign() { return align; }
clustalfile = "";
treefile = "";
sharedfile = "";
- templatefile = "";
+ candidatefile = "";
cutoff = "10.00";
format = "";
precision = "100";
ends = "T"; //yes
processors = "1";
size = "1000";
- search = "suffix";
+ search = "kmer";
ksize = "7";
- align = "blast";
+ align = "needleman";
match = "1.0";
mismatch = "-1.0";
- gapopen = "-5.0";
+ gapopen = "-1.0";
gapextend = "-2.0";
}
ends = "T";
processors = "1";
size = "1000";
- search = "suffix";
+ search = "kmer";
ksize = "7";
- align = "blast";
+ align = "needleman";
match = "1.0";
mismatch = "-1.0";
- gapopen = "-5.0";
+ gapopen = "-1.0";
gapextend = "-2.0";
}
/*******************************************************/
string getEnds();
string getProcessors();
string getSize();
- string getTemplateFile();
+ string getCandidateFile();
string getSearch();
string getKSize();
string getAlign();
private:
string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, nexusfile, clustalfile, treefile, sharedfile, line, label, randomtree, groups;
- string cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted, trump, soft, filter, scale, ends, processors, templatefile, search, ksize, align, match, size;
+ string cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted, trump, soft, filter, scale, ends, processors, candidatefile, search, ksize, align, match, size;
string mismatch, gapopen, gapextend;
cout << "Note: No spaces between parameter labels (i.e. calc), '=' and parameters (i.e.yourCalc)." << "\n" << "\n";
}else if (globaldata->helpRequest == "align.seqs") {
cout << "The align.seqs command reads a file containing sequences and creates an alignment file and a report file." << "\n";
- cout << "The align.seqs command parameters are fasta, phylip, clustal, nexus, template, search, ksize, align, match, mismatch, gapopen and gapextend. " << "\n";
- cout << "You must use one of the following parameters for your candidate filename: fasta, phylip, clustal or nexus. " << "\n";
+ cout << "The align.seqs command parameters are fasta, candidate, search, ksize, align, match, mismatch, gapopen and gapextend. " << "\n";
cout << "The template parameter is also required." << "\n";
- cout << "The search parameter allows you to specify the method to find most similar template. Your options are: suffix, kmer and blast. The default is suffix." << "\n";
- cout << "The align parameter allows you to specify the alignment method to use. Your options are: gotoh, needleman, blast and noalign. The default is blast." << "\n";
+ cout << "The search parameter allows you to specify the method to find most similar template. Your options are: suffix, kmer and blast. The default is kmer." << "\n";
+ cout << "The align parameter allows you to specify the alignment method to use. Your options are: gotoh, needleman, blast and noalign. The default is needleman." << "\n";
cout << "The ksize parameter allows you to specify the kmer size for finding most similar template to candidate. The default is 7." << "\n";
cout << "The match parameter allows you to specify the bonus for having the same base. The default is 1.0." << "\n";
cout << "The mistmatch parameter allows you to specify the penalty for having different bases. The default is -1.0." << "\n";
- cout << "The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -5.0." << "\n";
+ cout << "The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -1.0." << "\n";
cout << "The gapextend parameter allows you to specify the penalty for extending a gap in an alignment. The default is -2.0." << "\n";
cout << "The align.seqs command should be in the following format: " << "\n";
- cout << "align.seqs(fasta=yourFastaFile, template=yourTemplateFile, align=yourAlignmentMethod, search=yourSearchmethod, ksize=yourKmerSize, match=yourMatchBonus, mismatch=yourMismatchpenalty, gapopen=yourGapopenPenalty, gapextend=yourGapExtendPenalty) " << "\n";
- cout << "Example align.seqs(fasta=candidate.fasta, template=core.filtered, align=kmer, search=gotoh, ksize=8, match=2.0, mismatch=3.0, gapopen=-2.0, gapextend=-1.0)" << "\n";
+ cout << "align.seqs(fasta=yourTemplateFile, candidate=yourCandidateFile, align=yourAlignmentMethod, search=yourSearchmethod, ksize=yourKmerSize, match=yourMatchBonus, mismatch=yourMismatchpenalty, gapopen=yourGapopenPenalty, gapextend=yourGapExtendPenalty) " << "\n";
+ cout << "Example align.seqs(candidate=candidate.fasta, fasta=core.filtered, align=kmer, search=gotoh, ksize=8, match=2.0, mismatch=3.0, gapopen=-2.0, gapextend=-1.0)" << "\n";
cout << "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile)." << "\n" << "\n";
}else if (globaldata->helpRequest == "collect.single") {
cout << "The collect.single command can only be executed after a successful read.otu command. WITH ONE EXECEPTION. " << "\n";
holdLabel = label;
//add new vector to lookup
- lookup.push_back(new SharedRAbundVector());
+ SharedRAbundVector* temp = new SharedRAbundVector();
+ lookup.push_back(temp);
lookup[0]->setLabel(label);
lookup[0]->setGroup(groupN);
}
//add new vector to lookup
- lookup.push_back(new SharedRAbundVector());
+ temp = new SharedRAbundVector();
+ lookup.push_back(temp);
lookup[count]->setLabel(label);
lookup[count]->setGroup(groupN);
string distanceArray[] = {"fasta","phylip","clustal","nexus", "calc", "ends", "cutoff", "processors"};
commandParameters["dist.seqs"] = addParameters(distanceArray, sizeof(distanceArray)/sizeof(string));
- string AlignArray[] = {"fasta","phylip","clustal","nexus", "template", "search", "ksize", "align", "match", "mismatch", "gapopen", "gapextend"};
+ string AlignArray[] = {"fasta", "candidate", "search", "ksize", "align", "match", "mismatch", "gapopen", "gapextend"};
commandParameters["align.seqs"] = addParameters(AlignArray, sizeof(AlignArray)/sizeof(string));
string quitArray[] = {};
delete singleCalc;
}
- delete sabund;
/******************* 2 Groups **************************/
}else if (lookup.size() == 2) {
outsvg.close();
delete singleCalc;
}
- delete sabundA;
- delete sabundB;
/******************* 3 Groups **************************/
}else if (lookup.size() == 3) {
sA = lookup[0]->getSAbundVector(); sabundA = &sA;
sB = lookup[1]->getSAbundVector(); sabundB = &sB;
sC = lookup[2]->getSAbundVector(); sabundC = &sC;
-
+
//make a file for each calculator
for(int i=0;i<vCalcs.size();i++){
sharedABC3 = sharedAC[0] + sharedBC[0] - sharedCwithAB[0];
//if any of the possible m's are - throw them out
- if (sharedABC1 < 0.0) { sharedABC1 = 0; }
- if (sharedABC2 < 0.0) { sharedABC2 = 0; }
- if (sharedABC3 < 0.0) { sharedABC3 = 0; }
+ if (sharedABC1 < 0.00001) { sharedABC1 = 0; }
+ if (sharedABC2 < 0.00001) { sharedABC2 = 0; }
+ if (sharedABC3 < 0.00001) { sharedABC3 = 0; }
//sharedABC is the minimum of the 3 possibilities
if ((sharedABC1 < sharedABC2) && (sharedABC1 < sharedABC3)) { sharedABC = sharedABC1; }
sharedBwithAC.push_back(sharedAB[0] + sharedBC[0] - sharedABC);
sharedCwithAB.push_back(sharedAC[0] + sharedBC[0] - sharedABC);
}
-
+
//image window
outsvg << "<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 800 800\" >\n";
outsvg << "<g>\n";
outsvg << "</g>\n</svg>\n";
outsvg.close();
delete singleCalc;
+
}
- delete sabundA;
- delete sabundB;
- delete sabundC;
+
/******************* 4 Groups **************************/
}else if (lookup.size() == 4) {
delete singleCalc;
}
}
- delete sabundA;
- delete sabundB;
- delete sabundC;
- delete sabundD;
}
}
cout << "Error: Too many groups chosen. You may use up to 4 groups with the venn command. I will use the first four groups in your groupfile." << endl;
for (int i = lookup.size(); i > 3; i--) { delete lookup[i]; lookup.pop_back(); }
}
-
+
//util->getSharedVectors(globaldata->Groups, lookup, order); //fills group vectors from order vector.
venn->getPic(lookup, vennCalculators);
}