#include "distancecommand.h"
#include "aligncommand.h"
#include "getrepseqscommand.h"
+#include "matrixoutputcommand.h"
/***********************************************************/
else if(commandName == "get.repseqs") { command = new GetRepSeqsCommand(); }
else if(commandName == "get.oturep") { command = new GetOTURepCommand(); }
else if(commandName == "tree.shared") { command = new TreeGroupCommand(); }
+ else if(commandName == "dist.shared") { command = new MatrixOutputCommand(); }
else if(commandName == "bootstrap.shared") { command = new BootSharedCommand(); }
else if(commandName == "concensus") { command = new ConcensusCommand(); }
else if(commandName == "dist.seqs") { command = new DistanceCommand(); }
if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { cout << "You must read a list, sabund or rabund before you can use the collect.single, rarefaction.single or summary.single commands." << endl; return false; }
}
- if ((commandName == "collect.shared") || (commandName == "rarefaction.shared") || (commandName == "summary.shared") || (commandName == "tree.shared") || (commandName == "bootstrap.shared")){
+ if ((commandName == "collect.shared") || (commandName == "rarefaction.shared") || (commandName == "summary.shared") || (commandName == "tree.shared") || (commandName == "bootstrap.shared") || (commandName == "dist.shared")){
if (globaldata->getSharedFile() == "") {
- if (globaldata->getListFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared, summary.shared, tree.shared or bootstrap.shared commands." << endl; return false; }
- else if (globaldata->getGroupFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared, summary.shared, tree.shared or bootstrap.shared commands." << endl; return false; }
+ if (globaldata->getListFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared, summary.shared, tree.shared, bootstrap.shared or dist.shared commands." << endl; return false; }
+ else if (globaldata->getGroupFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared, summary.shared, tree.shared, bootstrap.shared or dist.shared commands." << endl; return false; }
}
}
}
if ((commandName == "bin.seqs")) {
- if ((globaldata->getListFile() == "")) { cout << "You must read a list file before you can use the bin.seqs command." << endl; return false; }
+ if ((globaldata->getListFile() == "")) { cout << "You must read a list file before you can use the bin.seqs commands." << endl; return false; }
validateBinFiles();
}
Estimators.clear();
splitAtDash(calc, Estimators);
}
- if ((commandName == "tree.shared") || (commandName == "bootstrap.shared")) {
+ if ((commandName == "tree.shared") || (commandName == "bootstrap.shared") || (commandName == "dist.shared")) {
if (calc != "") {
Estimators.clear();
splitAtDash(calc, Estimators);
validCalcs->printCalc("treegroup", cout);
cout << "The tree.shared command outputs a .tre file for each calculator you specify at each distance you choose." << "\n";
cout << "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups)." << "\n" << "\n";
+ }else if (globaldata->helpRequest == "dist.shared") {
+ cout << "The dist.shared command can only be executed after a successful read.otu command." << "\n";
+ cout << "The dist.shared command parameters are groups, calc, line and label. The calc parameter is required, and you may not use line and label at the same time." << "\n";
+ cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like included used." << "\n";
+ cout << "The group names are separated by dashes. The line and label allow you to select what distance levels you would like distance matrices created for, and are also separated by dashes." << "\n";
+ cout << "The dist.shared command should be in the following format: dist.shared(groups=yourGroups, calc=yourCalcs, line=yourLines, label=yourLabels)." << "\n";
+ cout << "Example dist.shared(groups=A-B-C, line=1-3-5, calc=jabund-sorabund)." << "\n";
+ cout << "The default value for groups is all the groups in your groupfile." << "\n";
+ cout << "There is no default value for calc." << "\n";
+ validCalcs->printCalc("matrix", cout);
+ cout << "The dist.shared command outputs a .matrix file for each calculator you specify at each distance you choose." << "\n";
+ cout << "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups)." << "\n" << "\n";
}else if (globaldata->helpRequest == "bootstrap.shared") {
cout << "The bootstrap.shared command can only be executed after a successful read.otu command." << "\n";
cout << "The bootstrap.shared command parameters are groups, calc, iters, line and label. The calc parameter is required, and you may not use line and label at the same time." << "\n";
cout << "The get.oturep command outputs a .fastarep file for each distance you specify, selecting one OTU representative for each bin." << "\n";
cout << "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile)." << "\n" << "\n";
}else if (globaldata->helpRequest == "quit") {
- cout << "The quit command will terminate Dotur and should be in the following format: " << "\n";
+ cout << "The quit command will terminate mothur and should be in the following format: " << "\n";
cout << "quit()" << "\n" << "\n";
}else if (globaldata->helpRequest == "") {
validCommands->printCommands(cout);
data = matrixCalculators[i]->getValues(subset); //saves the calculator outputs
//save values in similarity matrix
- simMatrix[k][l] = data[0];
- simMatrix[l][k] = data[0];
+ simMatrix[k][l] = 1.0 - data[0]; //convert similiarity to distance
+ simMatrix[l][k] = 1.0 - data[0]; //convert similiarity to distance
}
}
}
for (it = treegroup.begin(); it != treegroup.end(); it++) {
out << it->first << ", ";
}
+ }else if (parameter == "matrix") {
+ for (it = matrix.begin(); it != matrix.end(); it++) {
+ out << it->first << ", ";
+ }
}else if (parameter == "boot") {
for (it = boot.begin(); it != boot.end(); it++) {
out << it->first << ", ";
commands["get.oturep"] = "get.oturep";
commands["cluster"] = "cluster";
commands["deconvolute"] = "deconvolute";
- commands["dist.seqs"] = "dist.seqs";
+ commands["dist.seqs"] = "dist.seqs";
+ commands["dist.shared"] = "dist.shared"; //matrix output
commands["collect.single"] = "collect.single";
commands["collect.shared"] = "collect.shared";
commands["rarefaction.single"] = "rarefaction.single";
string binseqsArray[] = {"fasta","line","label","name"};
commandParameters["bin.seqs"] = addParameters(binseqsArray, sizeof(binseqsArray)/sizeof(string));
+ string distsharedArray[] = {"line","label","calc","groups"};
+ commandParameters["dist.shared"] = addParameters(distsharedArray, sizeof(distsharedArray)/sizeof(string));
+
string getrepseqsArray[] = {"fasta","line","label","name", "group"};
commandParameters["get.repseqs"] = addParameters(getrepseqsArray, sizeof(getrepseqsArray)/sizeof(string));