372E12700F26365B0095CF7E /* readotucommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E126F0F26365B0095CF7E /* readotucommand.cpp */; };
372E12960F263D5A0095CF7E /* readdistcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12950F263D5A0095CF7E /* readdistcommand.cpp */; };
372E12ED0F264D320095CF7E /* commandfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12EC0F264D320095CF7E /* commandfactory.cpp */; };
+ 379293C30F2DE73400B9034A /* treemap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379293C20F2DE73400B9034A /* treemap.cpp */; };
37AD4CE40F28AEA300AA2D49 /* sharedlistvector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4CE30F28AEA300AA2D49 /* sharedlistvector.cpp */; };
37AD4DBB0F28E2FE00AA2D49 /* tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */; };
37AD4DCA0F28F3DD00AA2D49 /* readtree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */; };
37D9289D0F21331F001D4494 /* validcalculator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9284F0F21331F001D4494 /* validcalculator.cpp */; };
37D9289E0F21331F001D4494 /* validcommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928510F21331F001D4494 /* validcommands.cpp */; };
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 */; };
8DD76F6A0486A84900D96B5E /* Mothur.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* Mothur.1 */; };
/* End PBXBuildFile section */
372E12940F263D5A0095CF7E /* readdistcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readdistcommand.h; sourceTree = "<group>"; };
372E12950F263D5A0095CF7E /* readdistcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readdistcommand.cpp; sourceTree = "<group>"; };
372E12EC0F264D320095CF7E /* commandfactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commandfactory.cpp; sourceTree = "<group>"; };
+ 379293C10F2DE73400B9034A /* treemap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = treemap.h; sourceTree = "<group>"; };
+ 379293C20F2DE73400B9034A /* treemap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = treemap.cpp; sourceTree = "<group>"; };
37AD4CE20F28AEA300AA2D49 /* sharedlistvector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedlistvector.h; sourceTree = "<group>"; };
37AD4CE30F28AEA300AA2D49 /* sharedlistvector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedlistvector.cpp; sourceTree = "<group>"; };
37AD4DB90F28E2FE00AA2D49 /* tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tree.h; sourceTree = "<group>"; };
37D928520F21331F001D4494 /* validcommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = validcommands.h; sourceTree = "<group>"; };
37D928530F21331F001D4494 /* validparameter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = validparameter.cpp; sourceTree = "<group>"; };
37D928540F21331F001D4494 /* validparameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = validparameter.h; sourceTree = "<group>"; };
+ 37E5F3E10F29FD4200F8D827 /* treenode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = treenode.h; sourceTree = "<group>"; };
+ 37E5F3E20F29FD4200F8D827 /* treenode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = treenode.cpp; sourceTree = "<group>"; };
+ 37E5F4900F2A3DA800F8D827 /* readtreecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readtreecommand.h; sourceTree = "<group>"; };
+ 37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readtreecommand.cpp; sourceTree = "<group>"; };
8DD76F6C0486A84900D96B5E /* mothur */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mothur; sourceTree = BUILT_PRODUCTS_DIR; };
C6859E8B029090EE04C91782 /* Mothur.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Mothur.1; sourceTree = "<group>"; };
/* End PBXFileReference section */
372E12950F263D5A0095CF7E /* readdistcommand.cpp */,
372E126E0F26365B0095CF7E /* readotucommand.h */,
372E126F0F26365B0095CF7E /* readotucommand.cpp */,
+ 37E5F4900F2A3DA800F8D827 /* readtreecommand.h */,
+ 37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */,
37D928270F21331F001D4494 /* sharedcommand.h */,
37D928260F21331F001D4494 /* sharedcommand.cpp */,
37D928470F21331F001D4494 /* summarycommand.h */,
37D928320F21331F001D4494 /* sharedsabundvector.cpp */,
37AD4DB90F28E2FE00AA2D49 /* tree.h */,
37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */,
+ 379293C10F2DE73400B9034A /* treemap.h */,
+ 379293C20F2DE73400B9034A /* treemap.cpp */,
+ 37E5F3E10F29FD4200F8D827 /* treenode.h */,
+ 37E5F3E20F29FD4200F8D827 /* treenode.cpp */,
);
name = containers;
sourceTree = "<group>";
37AD4CE40F28AEA300AA2D49 /* sharedlistvector.cpp in Sources */,
37AD4DBB0F28E2FE00AA2D49 /* tree.cpp in Sources */,
37AD4DCA0F28F3DD00AA2D49 /* readtree.cpp in Sources */,
+ 37E5F3E30F29FD4200F8D827 /* treenode.cpp in Sources */,
+ 37E5F4920F2A3DA800F8D827 /* readtreecommand.cpp in Sources */,
+ 379293C30F2DE73400B9034A /* treemap.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
#include "command.hpp"
#include "readdistcommand.h"
+#include "readtreecommand.h"
#include "readotucommand.h"
#include "clustercommand.h"
#include "parselistcommand.h"
if(commandName == "read.dist") { command = new ReadDistCommand(); }
else if(commandName == "read.otu") { command = new ReadOtuCommand(); }
+ else if(commandName == "read.tree") { command = new ReadTreeCommand(); }
else if(commandName == "cluster") { command = new ClusterCommand(); }
else if(commandName == "deconvolute") { command = new DeconvoluteCommand(); }
else if(commandName == "help") { command = new HelpCommand(); }
groupfile = globaldata->getGroupFile();
orderfile = globaldata->getOrderFile();
fastafile = globaldata->getFastaFile();
+ treefile = globaldata->getTreeFile();
cutoff = globaldata->getCutOff();
format = globaldata->getFormat();
method = globaldata->getMethod();
if (parameter == "namefile" ) { namefile = value; }
if (parameter == "orderfile" ) { orderfile = value; }
if (parameter == "fastafile" ) { fastafile = value; }
+ if (parameter == "treefile" ) { treefile = value; }
if (parameter == "groupfile" ) { groupfile = value; }
if (parameter == "cutoff" ) { cutoff = value; }
if (parameter == "precision" ) { precision = value; }
if (parameter == "orderfile" ) { orderfile = value; }
if (parameter == "groupfile" ) { groupfile = value; }
if (parameter == "fastafile" ) { fastafile = value; }
+ if (parameter == "treefile" ) { treefile = value; }
if (parameter == "cutoff" ) { cutoff = value; }
if (parameter == "precision" ) { precision = value; }
if (parameter == "iters" ) { iters = value; }
validateReadFiles();
validateReadPhil();
}
+ }else if (commandName == "read.tree") {
+ validateTreeFiles(); //checks the treefile and groupfile parameters
}else if (commandName == "deconvolute") {
validateReadFiles();
}
exit(1);
}
}
+/*******************************************************/
+
+/******************************************************/
+//This function checks to make sure the user entered appropriate
+// format parameters on a parselistcommand
+void ErrorCheck::validateTreeFiles() {
+ try {
+ ifstream filehandle;
+ int ableToOpen;
+
+ //checks for valid files
+
+ if (treefile == "") { cout << "When executing a read.tree you must enter a treefile and a groupfile." << endl; errorFree = false; }
+ else if (groupfile == "") { cout << "When executing a read.tree you must enter a treefile and a groupfile." << endl; errorFree = false; }
+
+ //checks parameters on the read command
+ if (treefile != "") {
+ ableToOpen = openInputFile(treefile, filehandle);
+ filehandle.close();
+ if (ableToOpen == 1) { //unable to open
+ errorFree = false;
+ }
+ if (groupfile != "") {
+ ableToOpen = openInputFile(groupfile, filehandle);
+ filehandle.close();
+ if (ableToOpen == 1) { //unable to open
+ errorFree = false;;
+ }
+ }
+ }
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ErrorCheck class Function validateTreeFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ErrorCheck class function validateTreeFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
/*******************************************************/
void validateReadDist();
void validateReadPhil();
void validateParseFiles();
+ void validateTreeFiles();
void clear();
- string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, cutoff, format;
+ string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, treefile, cutoff, format;
string precision, method, fileroot, label, line, iters, jumble, freq, single, rarefaction, shared, summary;
string commandName, optionText;
bool errorFree;
#include "globaldata.hpp"
#include "sparsematrix.hpp"
+#include "tree.h"
#include "rabundvector.hpp"
#include "sabundvector.hpp"
#include "listvector.hpp"
commandName = commandString; //save command name to be used by other classes
//clears out data from previous read
- if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.list")) {
+ if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.tree")) {
clear();
}
if (key == "rabundfile" ) { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund"; }
if (key == "sabundfile" ) { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund"; }
if (key == "fastafile" ) { fastafile = value; inputFileName = value; fileroot = value; format = "fasta"; }
+ if (key == "treefile" ) { treefile = value; inputFileName = value; fileroot = value; format = "tree"; }
if (key == "namefile" ) { namefile = value; }
if (key == "orderfile" ) { orderfile = value; }
if (key == "groupfile" ) { groupfile = value; }
if (key == "listfile" ) { listfile = value; inputFileName = value; fileroot = value; format = "list"; }
if (key == "rabundfile" ) { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund"; }
if (key == "sabundfile" ) { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund"; }
- if (key == "fastafile" ) { fastafile = value; inputFileName = value; fileroot = value; format = "fasta"; }
+ if (key == "fastafile" ) { fastafile = value; inputFileName = value; fileroot = value; format = "fasta"; }
+ if (key == "treefile" ) { treefile = value; inputFileName = value; fileroot = value; format = "tree"; }
if (key == "namefile" ) { namefile = value; }
if (key == "orderfile" ) { orderfile = value; }
if (key == "groupfile" ) { groupfile = value; }
if ((listfile != "") && (groupfile != "")) { format = "shared"; }
//input defaults
- if (commandString == "collect.single") {
- if (singleEstimators.size() == 0) { splitAtDash(single, singleEstimators); }
+ if (commandName == "collect.single") {
+ if (singleEstimators.size() == 0) { splitAtDash(single, singleEstimators); }
}
- if (commandString == "rarefaction.single") {
+ if (commandName == "rarefaction.single") {
if (rareEstimators.size() == 0) { splitAtDash(rarefaction, rareEstimators); }
}
- if (commandString == "collect.shared") {
+ if (commandName == "collect.shared") {
if (sharedEstimators.size() == 0) { splitAtDash(shared, sharedEstimators); }
}
- if (commandString == "summary.single") {
+ if (commandName == "summary.single") {
if (summaryEstimators.size() == 0) { splitAtDash(summary, summaryEstimators); }
}
- if (commandString == "summary.shared") {
+ if (commandName == "summary.shared") {
if (sharedSummaryEstimators.size() == 0) { splitAtDash(sharedsummary, sharedSummaryEstimators); }
}
- if (commandString == "rarefaction.shared") {
+ if (commandName == "rarefaction.shared") {
if (sharedRareEstimators.size() == 0) { splitAtDash(sharedrarefaction, sharedRareEstimators); }
}
+
+ //if you have done a read.otu with a groupfile but don't want to use it anymore because you want to do single commands
+ if ((commandName == "collect.single") || (commandName == "rarefaction.single") || (commandName == "summary.single")) {
+ if (listfile != "") { format = "list"; }
+ else if (sabundfile != "") { format = "sabund"; }
+ else if (rabundfile != "") { format = "rabund"; }
+ }
}
catch(exception& e) {
string GlobalData::getNameFile() { return namefile; }
string GlobalData::getGroupFile() { return groupfile; }
string GlobalData::getOrderFile() { return orderfile; }
+string GlobalData::getTreeFile() { return treefile; }
string GlobalData::getFastaFile() { return fastafile; }
string GlobalData::getCutOff() { return cutoff; }
string GlobalData::getFormat() { return format; }
groupfile = "";
orderfile = "";
fastafile = "";
+ treefile = "";
cutoff = "10.00";
format = "";
precision = "100";
iters = "1000";
line = "";
label = "";
- jumble = "0";
+ jumble = "1";
freq = "100";
method = "furthest";
fileroot = "";
#include <vector>
#include <set>
#include "groupmap.h"
+#include "treemap.h"
using namespace std;
class ListVector;
class SharedListVector;
class SparseMatrix;
+class Tree;
class OrderVector;
class InputData;
class GroupMap;
+class TreeMap;
class SAbundVector;
class GlobalData {
InputData* ginput;
OrderVector* gorder;
ListVector* glist;
+ Tree* gTree;
SharedListVector* gSharedList;
SAbundVector* sabund;
GroupMap* gGroupmap;
+ TreeMap* gTreemap;
string inputFileName, helpRequest, commandName;
bool allLines;
vector<string> singleEstimators, summaryEstimators, sharedEstimators, rareEstimators, sharedRareEstimators, sharedSummaryEstimators; //holds estimators to be used
string getGroupFile();
string getOrderFile();
string getFastaFile();
+ string getTreeFile();
string getCutOff();
string getFormat();
string getPrecision();
void splitAtDash(string&, set<string>&);
private:
- string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile,line, label;
+ string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, treefile, line, label;
string cutoff, format, precision, method, fileroot, iters, jumble, freq, single, rarefaction, shared, summary, sharedsummary, sharedrarefaction;
static GlobalData* _uniqueInstance;
GlobalData( const GlobalData& ); // Disable copy constructor
ListVector* gListVector;
SparseMatrix* gSparseMatrix;
+
};
//**********************************************************************************************************************
* Dotur
*
* Created by Sarah Westcott on 12/1/08.
- * Copyright 2008 __MyCompanyName__. All rights reserved.
+ * Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved.
*
*/
namesOfGroups.push_back(seqGroup); //new group
}
}
-/************************************************************/
\ No newline at end of file
* Dotur
*
* Created by Sarah Westcott on 12/1/08.
- * Copyright 2008 __MyCompanyName__. All rights reserved.
+ * Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved.
*
*/
#include <fstream>
#include "utilities.hpp"
+/* This class is a representation of the groupfile. It is used by all the shared commands to determine what group a
+ certain sequence belongs to. */
class GroupMap {
public:
int getNumGroups();
string getGroup(string);
vector<string> namesOfGroups;
-
-
+
private:
ifstream fileHandle;
string groupFileName;
int NoCommand::execute(){
//Could choose to give more help here?fdsah
- cout << "Invalid command - choices are read.phylip(), read.column(), read.list(), read.rabund(), read.sabund(), cluster(), collect(), collect.shared(), parselist(), shared(), rarefaction(), summary(), summary.shared(), quit(), help()." << "\n";
+ cout << "Invalid command - choices are read.dist(), read.otu(), read.tree(), cluster(), deconvolute(), collect.single(), collect.shared(), rarefaction.single(), summary.single(), summary.shared(), quit(), help()." << "\n";
cout << "For more information on command parameters use the help() command." << "\n";
return 0;
}
#include "readtree.h"
+/***********************************************************************/
+//Parent Class
+// The following functions are used by all reading formats.
+/***********************************************************************/
+ReadTree::ReadTree() {
+ try {
+ globaldata = GlobalData::getInstance();
+ T = new Tree();
+ numNodes = T->getNumNodes();
+ numLeaves = T->getNumLeaves();
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ReadTree class Function ReadTree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ReadTree class function ReadTree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/***********************************************************************/
+int ReadTree::readSpecialChar(istream& f, char c, string name) {
+ try {
+ char d;
+
+ while(isspace(d=f.get())) {;}
+ if(d == EOF){
+ cerr << "Error: Input file ends prematurely, expecting a " << name << "\n";
+ exit(1);
+ }
+ if(d != c){
+ cerr << "Error: Expected " << name << " in input file. Found " << d << ".\n";
+ exit(1);
+ }
+ if(d == ')' && f.peek() == '\n'){
+ while(isspace(d=f.get())) {;}
+ f.putback(d);
+ }
+
+ return d;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ReadTree class Function readSpecialChar. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ReadTree class function readSpecialChar. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+
+int ReadTree::readNodeChar(istream& f) {
+ try {
+ char d;
+ while(isspace(d=f.get())) {;}
+ if(d == EOF){
+ cerr << "Error: Input file ends prematurely, expecting a left parenthesis\n";
+ exit(1);
+ }
+ return d;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ReadTree class Function readNodeChar. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ReadTree class function readNodeChar. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/**************************************************************************************************/
+
+float ReadTree::readBranchLength(istream& f) {
+ try {
+ float b;
+
+ if(!(f >> b)){
+ cerr << "Error: Missing branch length in input tree.\n";
+ exit(1);
+ }
+
+ return b;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ReadTree class Function readBranchLength. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ReadTree class function readBranchLength. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+
+/***********************************************************************/
+/***********************************************************************/
+
+
+//Child Classes Below
+
+/***********************************************************************/
+/***********************************************************************/
+//This class reads a file in Newick form and stores it in a tree.
+
+void ReadNewickTree::read() {
+ try {
+ int n = 0;
+ int lc, rc;
+
+ int rooted = 0;
+
+ int ch = filehandle.peek();
+
+ if(ch == '('){
+ n = numLeaves; //number of leaves / sequences, we want node 1 to start where the leaves left off
+ lc = readNewickInt(filehandle, n, T);
+
+ if(filehandle.peek()==','){
+ readSpecialChar(filehandle,',',"comma");
+ }
+ // ';' means end of tree.
+ else if((ch=filehandle.peek())==';' || ch=='['){
+ rooted = 1;
+ }
+ if(rooted != 1){
+ rc = readNewickInt(filehandle, n, T);
+ if(filehandle.peek() == ')'){
+ readSpecialChar(filehandle,')',"right parenthesis");
+ }
+ }
+ }
+ //note: treeclimber had the code below added - not sure why?
+ else{
+ filehandle.putback(ch);
+ char name[MAX_LINE];
+ filehandle.get(name, MAX_LINE,'\n');
+ SKIPLINE(filehandle, ch);
+
+
+ n = T->getIndex(name);
+ if(n!=0){
+ cerr << "Internal error: The only taxon is not taxon 0.\n";
+ exit(1);
+ }
+ lc = rc = -1;
+ }
+
+ while((ch=filehandle.get())!=';'){;}
+ if(rooted != 1){
+ T->tree[n].setChildren(lc,rc);
+ T->tree[n].setBranchLength(0);
+ T->tree[n].setParent(-1);
+ if(lc!=-1){ T->tree[lc].setParent(n); }
+ if(rc!=-1){ T->tree[rc].setParent(n); }
+ }
+
+ //save tree for later commands
+ globaldata->gTree = T;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ReadNewickTree class Function read. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ReadNewickTree class function read. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+
+int ReadNewickTree::readNewickInt(istream& f, int& n, Tree* T) {
+ try {
+ int c = readNodeChar(f);
+
+ if(c == '('){
+ int lc = readNewickInt(f, n, T);
+ readSpecialChar(f,',',"comma");
+
+ int rc = readNewickInt(f, n, T);
+ if(f.peek()==')'){
+ readSpecialChar(f,')',"right parenthesis");
+ }
+
+ if(f.peek() == ':'){
+ readSpecialChar(f,':',"colon");
+ if(n >= numNodes){ cerr << "Error: Too many nodes in input tree\n"; exit(1); }
+ T->tree[n].setBranchLength(readBranchLength(f));
+ }else{T->tree[n].setBranchLength(0.0); }
+
+ T->tree[n].setChildren(lc,rc);
+ T->tree[lc].setParent(n);
+ T->tree[rc].setParent(n);
+
+ return n++;
+ }else{
+ f.putback(c);
+ string name = "";
+ char d=f.get();
+ while(d != ':' && d != ',' && d!=')' && d!='\n'){
+ name += d;
+ d=f.get();
+ }
+
+ int blen = 0;
+ if(d == ':') { blen = 1; }
+
+ f.putback(d);
+
+ //set group info
+ string group = globaldata->gTreemap->getGroup(name);
+
+ //find index in tree of name
+ int n1 = T->getIndex(name);
+
+ if(n1 == -1){cerr << "Name: " << name << " not found\n"; exit(1);}
+
+ else T->tree[n1].setGroup(group);
+
+ T->tree[n1].setChildren(-1,-1);
+
+ if(blen == 1){
+ f.get();
+ T->tree[n1].setBranchLength(readBranchLength(f));
+ }else{
+ T->tree[n1].setBranchLength(0.0);
+ }
+
+ while((c=f.get())!=0 && (c != ':' && c != ',' && c!=')') ) {;}
+ f.putback(c);
+
+ return n1;
+ }
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ReadNewickTree class Function readNewickInt. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ReadNewickTree class function readNewickInt. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+/**************************************************************************************************/
+
\ No newline at end of file
#include <string>
#include <iostream>
+#include "globaldata.hpp"
+#include "tree.h"
+#define MAX_LINE 513
+#define SKIPLINE(f,c) {while((c=f.get())!=EOF && ((c) != '\n')){}}
+
+class Tree;
+
+/****************************************************************************/
class ReadTree {
public:
- ReadTree();
- ~ReadTree();
+ ReadTree();
+ ~ReadTree() {};
+
+ virtual void read() {};
+ int readSpecialChar(istream&, char, string);
+ int readNodeChar(istream& f);
+ float readBranchLength(istream& f);
+
+
+ Tree* getTree() { return T; }
+
+ int numNodes, numLeaves;
+ GlobalData* globaldata;
+ protected:
+ Tree* T;
+};
+
+/****************************************************************************/
+
+class ReadNewickTree : public ReadTree {
- private:
+public:
+ ReadNewickTree(string file) : treeFile(file) { openInputFile(file, filehandle); }
+ ~ReadNewickTree() {};
+ void read();
-
+private:
+ int readNewickInt(istream&, int&, Tree*);
+ ifstream filehandle;
+ string treeFile;
};
+/****************************************************************************/
#endif
\ No newline at end of file
--- /dev/null
+/*
+ * readtreecommand.cpp
+ * Mothur
+ *
+ * Created by Sarah Westcott on 1/23/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "readtreecommand.h"
+
+//**********************************************************************************************************************
+ReadTreeCommand::ReadTreeCommand(){
+ try {
+ globaldata = GlobalData::getInstance();
+ filename = globaldata->inputFileName;
+
+ //read in group map info.
+ treeMap = new TreeMap(globaldata->getGroupFile());
+ treeMap->readMap();
+ globaldata->gTreemap = treeMap;
+
+ read = new ReadNewickTree(filename);
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ReadTreeCommand class Function ReadTreeCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ReadTreeCommand class function ReadTreeCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+
+ReadTreeCommand::~ReadTreeCommand(){
+ delete read;
+}
+
+//**********************************************************************************************************************
+
+int ReadTreeCommand::execute(){
+ try {
+
+ read->read();
+
+ Tree* T = globaldata->gTree;
+// T->createNewickFile();
+
+ return 0;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ReadTreeCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ReadTreeCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
\ No newline at end of file
--- /dev/null
+#ifndef READTREECOMMAND_H
+#define READTREECOMMAND_H
+
+/*
+ * readtreecommand.h
+ * Mothur
+ *
+ * Created by Sarah Westcott on 1/23/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+#include <iostream>
+#include <fstream>
+#include "command.hpp"
+#include "readtree.h"
+#include "treemap.h"
+
+class GlobalData;
+
+class ReadTreeCommand : public Command {
+public:
+ ReadTreeCommand();
+ ~ReadTreeCommand();
+ int execute();
+
+private:
+ GlobalData* globaldata;
+ ReadTree* read;
+ TreeMap* treeMap;
+ string filename;
+};
+
+
+
+
+
+
+
+
+#endif
\ No newline at end of file
newGuy.abundance = 0;
data.push_back(newGuy);
}
- // for(int i=0;i<data.size();i++){
- // if(data[i].abundance != 0){ maxRank = i; }
- // numSeqs += i*data[i].abundance;
- // numBins += data[i].abundance;
- // }
-
};
-/***********************************************************************
-
-SharedSAbundVector::SharedSAbundVector(string id, vector<int> sav) : DataVector(id), data(sav) {
- try {
-
- for(int i=0;i<sav.size();i++){
- if(data[i] != 0){ maxRank = i; }
- numSeqs += i*data[i];
- numBins += data[i];
- }
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the SharedSAbundVector class Function SharedSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the SharedSAbundVector class function SharedSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
-}
-
-/***********************************************************************
-
-SharedSAbundVector::SharedSAbundVector(ifstream& f): DataVector(), maxRank(0), numBins(0), numSeqs(0) {
- try {
- int hold;
- f >> label >> hold;
-
- data.assign(hold+1, 0);
- int inputData;
-
- for(int i=1;i<=hold;i++){
- f >> inputData;
- set(i, inputData);
- }
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the SharedSAbundVector class Function SharedSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the SharedSAbundVector class function SharedSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
-}
-
/***********************************************************************/
void SharedSAbundVector::set(int bin, int abundance, string groupName){
for (i=0; i<globaldata->sharedSummaryEstimators.size(); i++) {
if (globaldata->sharedSummaryEstimators[i] == "sharedSobs") {
sumCalculators.push_back(new SharedSobs());
- }else if (globaldata->sharedEstimators[i] == "sharedChao") {
+ }else if (globaldata->sharedSummaryEstimators[i] == "sharedChao") {
sumCalculators.push_back(new SharedChao1());
}else if (globaldata->sharedSummaryEstimators[i] == "sharedAce") {
sumCalculators.push_back(new SharedAce());
#include "tree.h"
+
+/*****************************************************************/
+Tree::Tree() {
+ try {
+ globaldata = GlobalData::getInstance();
+
+ numLeaves = globaldata->gTreemap->getNumSeqs();
+ numNodes = 2*numLeaves - 1;
+
+ tree.resize(numNodes);
+
+ //initialize tree with correct number of nodes, name and group info.
+ for (int i = 0; i < numNodes; i++) {
+
+ //initialize leaf nodes
+ if (i <= (numLeaves-1)) {
+ tree[i].setName(globaldata->gTreemap->namesOfSeqs[i]);
+ tree[i].setGroup(globaldata->gTreemap->getGroup(globaldata->gTreemap->namesOfSeqs[i]));
+ //the node knows its index
+ tree[i].setIndex(i);
+ //Treemap knows name, group and index to speed up search
+ globaldata->gTreemap->setIndex(globaldata->gTreemap->namesOfSeqs[i], i);
+ //intialize non leaf nodes
+ }else if (i > (numLeaves-1)) {
+ tree[i].setName("");
+ tree[i].setGroup("");
+ //the node knows its index
+ tree[i].setIndex(i);
+ }
+ }
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Tree class Function Tree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Tree class function Tree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/*****************************************************************/
+
+int Tree::getIndex(string searchName) {
+ try {
+ //Treemap knows name, group and index to speed up search
+ // getIndex function will return the vector index or -1 if seq is not found.
+ int index = globaldata->gTreemap->getIndex(searchName);
+ return index;
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Tree class Function getIndex. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Tree class function getIndex. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/*****************************************************************/
+
+void Tree::setIndex(string searchName, int index) {
+ try {
+ //set index in treemap
+ globaldata->gTreemap->setIndex(searchName, index);
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Tree class Function setIndex. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Tree class function setIndex. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+
+/*****************************************************************/
+// This prints out the tree in Newick form.
+void Tree::createNewickFile() {
+ try {
+ int root = findRoot();
+ filename = getRootName(globaldata->getTreeFile()) + "newick";
+ openOutputFile(filename, out);
+
+ printBranch(root);
+
+ // you are at the end of the tree
+ out << ";" << endl;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Tree class Function createNewickFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Tree class function createNewickFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/*****************************************************************/
+//This function finds the index of the root node.
+
+int Tree::findRoot() {
+ try {
+ for (int i = 0; i < numNodes; i++) {
+ //you found the root
+ if (tree[i].getParent() == -1) { return i; }
+ }
+ return -1;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Tree class Function findRoot. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Tree class function findRoot. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/*****************************************************************/
+void Tree::printBranch(int node) {
+ try {
+
+ // you are not a leaf
+ if (tree[node].getLChild() != -1) {
+ out << "(";
+ printBranch(tree[node].getLChild());
+ out << ",";
+ printBranch(tree[node].getRChild());
+ out << ")";
+ }else { //you are a leaf
+ tree[node].printNode(out); //prints out name and branch length
+ }
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Tree class Function printBranch. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Tree class function printBranch. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/*****************************************************************/
+
+
+
#include <string>
#include <iostream>
#include <vector>
+#include "treenode.h"
+#include "globaldata.hpp"
-struct Node {
- string name;
- string group;
- float branchLength;
- Node* parent;
- Node* lchild;
- Node* rchild;
-};
+/* This class represents the treefile. */
class Tree {
public:
- Tree();
- ~Tree();
-
- Node* getParent(Node);
- Node* getLChild(Node);
- Node* getRChild(Node);
-
- void setParent(Node);
- void setLChild(Node);
- void setRChild(Node);
-
+ Tree();
+ ~Tree() {};
Tree generateRandomTree();
-
- vector<Node> leaves; //gives you easy access to the leaves of the tree to generate the parsimony score
+ void createNewickFile();
+ int getIndex(string);
+ void setIndex(string, int);
+ int getNumNodes() { return numNodes; }
+ int getNumLeaves(){ return numLeaves;}
+ vector<Node> tree; //the first n nodes are the leaves, where n is the number of sequences.
private:
+ GlobalData* globaldata;
+ int findRoot(); //return index of root node
+ void printBranch(int); //recursively print out tree
+ int numNodes, numLeaves;
+ ofstream out;
+ string filename;
};
--- /dev/null
+/*
+ * treemap.cpp
+ * Mothur
+ *
+ * Created by Sarah Westcott on 1/26/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "treemap.h"
+
+/************************************************************/
+
+ TreeMap::TreeMap(string filename) {
+ groupFileName = filename;
+ openInputFile(filename, fileHandle);
+}
+
+/************************************************************/
+ TreeMap::~TreeMap(){};
+
+/************************************************************/
+void TreeMap::readMap() {
+ string seqName, seqGroup;
+
+ while(fileHandle){
+ fileHandle >> seqName; //read from first column
+ fileHandle >> seqGroup; //read from second column
+
+ namesOfSeqs.push_back(seqName);
+ setNamesOfGroups(seqGroup);
+
+ treemap[seqName].groupname = seqGroup; //store data in map
+
+ gobble(fileHandle);
+ }
+ fileHandle.close();
+}
+/************************************************************/
+
+int TreeMap::getNumGroups() {
+
+ return namesOfGroups.size();
+
+}
+/************************************************************/
+
+int TreeMap::getNumSeqs() {
+
+ return namesOfSeqs.size();
+
+}
+
+/************************************************************/
+
+string TreeMap::getGroup(string sequenceName) {
+
+ it = treemap.find(sequenceName);
+ if (it != treemap.end()) { //sequence name was in group file
+ return it->second.groupname;
+ }else {
+ return "not found";
+ }
+
+}
+/************************************************************/
+void TreeMap::setIndex(string seq, int index) {
+ treemap[seq].vectorIndex = index;
+}
+/************************************************************/
+int TreeMap::getIndex(string seq) {
+
+ it = treemap.find(seq);
+ // if it is a valid sequence name then return index
+ if (it != treemap.end()) { return treemap[seq].vectorIndex; }
+ // if not return error code
+ else { return -1; }
+
+}
+/************************************************************/
+
+void TreeMap::setNamesOfGroups(string seqGroup) {
+ int i, count;
+ count = 0;
+ for (i=0; i<namesOfGroups.size(); i++) {
+ if (namesOfGroups[i] != seqGroup) {
+ count++; //you have not found this group
+ }else {
+ break; //you already have it
+ }
+ }
+ if (count == namesOfGroups.size()) {
+ namesOfGroups.push_back(seqGroup); //new group
+ }
+}
+
+/***********************************************************************/
+
+void TreeMap::print(ostream& output){
+ try {
+
+ for(it = treemap.begin(); it != treemap.end(); it++){
+ output << it->first << '\t' << it->second.groupname << '\t' << it->second.vectorIndex << endl;
+ }
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the TreeMap class Function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the TreeMap class function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/************************************************************/
\ No newline at end of file
--- /dev/null
+#ifndef TREEMAP_H
+#define TREEMAP_H
+/*
+ * treemap.h
+ * Mothur
+ *
+ * Created by Sarah Westcott on 1/26/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+#include <map>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include "utilities.hpp"
+
+/* This class is used by the read.tree command to build the tree container. */
+
+struct GroupIndex {
+ string groupname;
+ int vectorIndex;
+};
+
+
+
+class TreeMap {
+public:
+ TreeMap(string);
+ ~TreeMap();
+ void readMap();
+ int getNumGroups();
+ int getNumSeqs();
+ void setIndex(string, int); //sequencename, index
+ int getIndex(string); //returns vector index of sequence
+ string getGroup(string);
+ vector<string> namesOfGroups;
+ vector<string> namesOfSeqs;
+ void print(ostream&);
+
+private:
+ ifstream fileHandle;
+ string groupFileName;
+ int numGroups;
+ map<string, GroupIndex>::iterator it;
+ void setNamesOfGroups(string);
+ map<string, GroupIndex> treemap; //sequence name and groupname
+};
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * treenode.cpp
+ * Mothur
+ *
+ * Created by Sarah Westcott on 1/23/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "treenode.h"
+
+
+/****************************************************************/
+Node::Node() {
+ //initialize node
+ name = "";
+ branchLength = -1;
+ parent = -1;
+ lchild = -1;
+ rchild = -1;
+
+}
+/****************************************************************/
+void Node::setName(string Name) { name = Name; }
+/****************************************************************/
+//non leaf nodes will belong to multiple groups, leaf nodes will only belong to one.
+void Node::setGroup(string groups) { group.push_back(groups); }
+/****************************************************************/
+void Node::setBranchLength(float l) { branchLength = l; }
+/****************************************************************/
+void Node::setParent(int p) { parent = p; }
+/****************************************************************/
+void Node::setIndex(int i) { vectorIndex = i; }
+/****************************************************************/
+void Node::setChildren(int lc, int rc) { lchild = lc; rchild = rc; } //leftchild, rightchild
+/****************************************************************/
+string Node::getName() { return name; }
+/****************************************************************/
+vector<string> Node::getGroup() { return group; }
+/****************************************************************/
+float Node::getBranchLength() { return branchLength; }
+/****************************************************************/
+int Node::getParent() { return parent; }
+/****************************************************************/
+int Node::getLChild() { return lchild; }
+/****************************************************************/
+int Node::getRChild() { return rchild; }
+/****************************************************************/
+int Node::getIndex() { return vectorIndex; }
+/****************************************************************/
+//to be used by printTree in the Tree class to print the leaf info
+void Node::printNode(ostream& out) {
+ try{
+ out << name;
+
+ //there is a branch length
+ if (branchLength != -1) {
+ out << ":" << setprecision(4) << branchLength;
+ }
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Node class Function printNode. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Node class function printNode. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/****************************************************************/
\ No newline at end of file
--- /dev/null
+#ifndef TREENODE_H
+#define TREENODE_H
+
+/*
+ * treenode.h
+ * Mothur
+ *
+ * Created by Sarah Westcott on 1/23/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+using namespace std;
+
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include <vector>
+
+/* This class represents a node on a tree. */
+
+
+class Node {
+ public:
+ Node(); //pass it the sequence name
+ ~Node() {};
+
+ void setName(string);
+ void setGroup(string); //non leaf nodes will belong to multiple groups, leaf nodes will only belong to one.
+ void setBranchLength(float);
+ void setParent(int);
+ void setChildren(int, int); //leftchild, rightchild
+ void setIndex(int);
+
+ string getName();
+ vector<string> getGroup(); //leaf nodes will only have 1 group, but branch nodes may have multiple groups.
+ float getBranchLength();
+ int getParent();
+ int getLChild();
+ int getRChild();
+ int getIndex();
+
+ void printNode(ostream&); //prints out the name and the branch length
+
+ private:
+ string name;
+ vector<string> group;
+ float branchLength;
+ int parent;
+ int lchild;
+ int rchild;
+ int vectorIndex;
+};
+
+#endif
\ No newline at end of file
try {
commands["read.dist"] = "read.dist";
- commands["read.otu"] = "read.otu";
+ commands["read.otu"] = "read.otu";
+ // commands["read.tree"] = "read.tree";
commands["cluster"] = "cluster";
commands["deconvolute"] = "deconvolute";
commands["help"] = "help";
parameters["groupfile"] = "groupfile";
parameters["orderfile"] = "orderfile";
parameters["fastafile"] = "fastafile";
+ parameters["treefile"] = "treefile";
parameters["fileroot"] = "fileroot";
parameters["cutoff"] = "cutoff";
parameters["method"] = "method";