A7DA2174113FECD400BF472F /* validparameter.h */,
A7DA2175113FECD400BF472F /* venn.cpp */,
A7DA2176113FECD400BF472F /* venn.h */,
- 7E84528511EF4BEB00564975 /* seqerrorcommand.h */,
- 7E84528611EF4BEB00564975 /* seqerrorcommand.cpp */,
);
name = mothur;
sourceTree = "<group>";
A7DA20FA113FECD400BF472F /* secondarystructurecommand.cpp */,
7EA299BA11E384940022D8D3 /* sensspeccommand.h */,
7EA299BB11E384940022D8D3 /* sensspeccommand.cpp */,
+ 7E84528511EF4BEB00564975 /* seqerrorcommand.h */,
+ 7E84528611EF4BEB00564975 /* seqerrorcommand.cpp */,
A7DA20FD113FECD400BF472F /* seqsummarycommand.h */,
A7DA20FC113FECD400BF472F /* seqsummarycommand.cpp */,
A7DA2103113FECD400BF472F /* setdircommand.h */,
string GlobalData::getNameFile() { return namefile; }
string GlobalData::getGroupFile() { return groupfile; }
string GlobalData::getOrderFile() { return orderfile; }
+string GlobalData::getOrderGroupFile() { return ordergroup; }
string GlobalData::getTreeFile() { return treefile; }
string GlobalData::getSharedFile() { return sharedfile; }
string GlobalData::getFormat() { return format; }
void GlobalData::setSharedFile(string file) { sharedfile = file; inputFileName = file; }
void GlobalData::setNameFile(string file) { namefile = file; }
void GlobalData::setOrderFile(string file) { orderfile = file; }
+void GlobalData::setOrderGroupFile(string file) { ordergroup = file; }
void GlobalData::setFormat(string Format) { format = Format; }
namefile = ""; //do we need this?
groupfile = ""; //do we need this?
orderfile = "";
+ ordergroup = "";
// fastafile = ""; //do we need this?
treefile = "";
sharedfile = "";
string getNameFile(); //do we need this?
string getGroupFile(); //do we need this?
string getOrderFile();
+ string getOrderGroupFile();
string getTreeFile();
string getSharedFile();
string getFormat(); //do we need this?
void setSabundFile(string);
void setSharedFile(string);
void setOrderFile(string file);
+ void setOrderGroupFile(string file);
void setFormat(string); //do we need this?
NameAssignment* nameMap;
private:
MothurOut* m;
- string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, treefile, sharedfile, format, distfile;
+ string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, treefile, sharedfile, format, distfile, ordergroup;
static GlobalData* _uniqueInstance;
GlobalData( const GlobalData& ); // Disable copy constructor
CXXFLAGS += -O3
-MOTHUR_FILES = "\"Enter_your_default_path_here\""
+MOTHUR_FILES = "\"/Users/SarahsWork/desktop//Release\""
ifeq ($(strip $(MOTHUR_FILES)),"\"Enter_your_default_path_here\"")
else
CXXFLAGS += -DMOTHUR_FILES=${MOTHUR_FILES}
else {
//valid paramters for this command
- string Array[] = {"list","order","shared", "label","group","sabund", "rabund","groups","outputdir","inputdir"};
+ string Array[] = {"list","order","shared", "label","group","sabund", "rabund","groups","ordergroup","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
//if the user has not given a path then, add inputdir. else leave path alone.
if (path == "") { parameters["rabund"] = inputDir + it->second; }
}
+
+ it = parameters.find("ordergroup");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["ordergroup"] = inputDir + it->second; }
+ }
}
else if (rabundfile == "not found") { rabundfile = ""; }
else { globaldata->setRabundFile(rabundfile); globaldata->setFormat("rabund");}
+ ordergroupfile = validParameter.validFile(parameters, "ordergroup", true);
+ if (ordergroupfile == "not open") { abort = true; }
+ else if (ordergroupfile == "not found") { ordergroupfile = ""; }
+ else { globaldata->setOrderGroupFile(ordergroupfile); }
+
sharedfile = validParameter.validFile(parameters, "shared", true);
if (sharedfile == "not open") { abort = true; }
else if (sharedfile == "not found") { sharedfile = ""; }
void ReadOtuCommand::help(){
try {
m->mothurOut("The read.otu command must be run before you execute a collect.single, rarefaction.single, summary.single, \n");
- m->mothurOut("collect.shared, rarefaction.shared or summary.shared command. Mothur will generate a .list, .rabund and .sabund upon completion of the cluster command \n");
- m->mothurOut("or you may use your own. The read.otu command parameter options are list, rabund, sabund, shared, group, order, label and groups.\n");
+ m->mothurOut("collect.shared, rarefaction.shared, summary.shared heatmap.bin, heatmap.sim or venn command. Mothur will generate a .list, .rabund and .sabund upon completion of the cluster command \n");
+ m->mothurOut("or you may use your own. The read.otu command parameter options are list, rabund, sabund, shared, group, order, ordergroup, label and groups.\n");
m->mothurOut("The read.otu command can be used in two ways. The first is to read a list, rabund or sabund and run the collect.single, rarefaction.single or summary.single.\n");
m->mothurOut("For this use the read.otu command should be in the following format: read.otu(list=yourListFile, order=yourOrderFile, label=yourLabels).\n");
m->mothurOut("The list, rabund or sabund parameter is required, but you may only use one of them.\n");
m->mothurOut("The list parameter and group paramaters or the shared paremeter is required. When using the command the second way with a list and group file read.otu command parses the .list file\n");
m->mothurOut("and separates it into groups. It outputs a .shared file containing the OTU information for each group. The read.otu command also outputs a .rabund file for each group. \n");
m->mothurOut("You can use the groups parameter to choose only specific groups to be used in the .shared and .rabund files. \n");
+ m->mothurOut("You can use the ordergroup parameter to provide a file containing a list of group names in the order you would like them to appear in your shared file. \n");
m->mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
}
InputData* input;
Command* shared;
GroupMap* groupMap;
- string filename, listfile, orderfile, sharedfile, label, groupfile, sabundfile, rabundfile, format, groups, outputDir;
+ string filename, listfile, orderfile, sharedfile, label, groupfile, sabundfile, rabundfile, format, groups, outputDir, ordergroupfile;
vector<string> Groups;
bool abort, allLines;
void SffInfoCommand::help(){
try {
- m->mothurOut("The sffinfo command reads a sff file and outputs a .sff.txt file.\n");
-
- m->mothurOut("Example sffinfo(sff=...).\n");
+ m->mothurOut("The sffinfo command reads a sff file and extracts the sequence data.\n");
+ m->mothurOut("The sffinfo command parameters are sff, fasta, qfile, accnos, flow, sfftxt, and trim. sff is required. \n");
+ m->mothurOut("The sff parameter allows you to enter the sff file you would like to extract data from. You may enter multiple files by separating them by -'s.\n");
+ m->mothurOut("The fasta parameter allows you to indicate if you would like a fasta formatted file generated. Default=True. \n");
+ m->mothurOut("The qfile parameter allows you to indicate if you would like a quality file generated. Default=True. \n");
+ m->mothurOut("The flow parameter allows you to indicate if you would like a flowgram file generated. Default=False. \n");
+ m->mothurOut("The sfftxt parameter allows you to indicate if you would like a sff.txt file generated. Default=False. \n");
+ m->mothurOut("The trim parameter allows you to indicate if you would like a sequences and quality scores trimmed to the clipQualLeft and clipQualRight values. Default=True. \n");
+ m->mothurOut("The accnos parameter allows you to provide a accnos file containing the names of the sequences you would like extracted. You may enter multiple files by separating them by -'s. \n");
+ m->mothurOut("Example sffinfo(sff=mySffFile.sff, trim=F).\n");
m->mothurOut("Note: No spaces between parameter labels (i.e. sff), '=' and parameters (i.e.yourSffFileName).\n\n");
}
catch(exception& e) {
string errorOff = "no error";
//errorOff = "";
+ //if user provided an order file containing the order the shared file should be in read it
+ if (globaldata->getOrderGroupFile() != "") { readOrderFile(); }
+
//read in listfile
read = new ReadOTUFile(globaldata->inputFileName);
read->read(&*globaldata);
void SharedCommand::printSharedData(vector<SharedRAbundVector*> thislookup) {
try {
- sort(thislookup.begin(), thislookup.end(), compareSharedRabunds);
-
- //initialize bin values
- for (int i = 0; i < thislookup.size(); i++) {
-//cout << "in printData " << thislookup[i]->getLabel() << '\t' << thislookup[i]->getGroup() << endl;
- out << thislookup[i]->getLabel() << '\t' << thislookup[i]->getGroup() << '\t';
- thislookup[i]->print(out);
+ if (order.size() == 0) { //user has not specified an order so do aplabetically
+ sort(thislookup.begin(), thislookup.end(), compareSharedRabunds);
+
+ //initialize bin values
+ for (int i = 0; i < thislookup.size(); i++) {
+ out << thislookup[i]->getLabel() << '\t' << thislookup[i]->getGroup() << '\t';
+ thislookup[i]->print(out);
+
+ RAbundVector rav = thislookup[i]->getRAbundVector();
+ openOutputFileAppend(fileroot + thislookup[i]->getGroup() + ".rabund", *(filehandles[thislookup[i]->getGroup()]));
+ rav.print(*(filehandles[thislookup[i]->getGroup()]));
+ (*(filehandles[thislookup[i]->getGroup()])).close();
+ }
+ }else{
+ //create a map from groupName to each sharedrabund
+ map<string, SharedRAbundVector*> myMap;
+ map<string, SharedRAbundVector*>::iterator myIt;
+
+ for (int i = 0; i < thislookup.size(); i++) {
+ myMap[thislookup[i]->getGroup()] = thislookup[i];
+ }
+
- RAbundVector rav = thislookup[i]->getRAbundVector();
- openOutputFileAppend(fileroot + thislookup[i]->getGroup() + ".rabund", *(filehandles[thislookup[i]->getGroup()]));
- rav.print(*(filehandles[thislookup[i]->getGroup()]));
- (*(filehandles[thislookup[i]->getGroup()])).close();
+ //loop through ordered list and print the rabund
+ for (int i = 0; i < order.size(); i++) {
+ myIt = myMap.find(order[i]);
+
+ if(myIt != myMap.end()) { //we found it
+ out << (myIt->second)->getLabel() << '\t' << (myIt->second)->getGroup() << '\t';
+ (myIt->second)->print(out);
+
+ RAbundVector rav = (myIt->second)->getRAbundVector();
+ openOutputFileAppend(fileroot + (myIt->second)->getGroup() + ".rabund", *(filehandles[(myIt->second)->getGroup()]));
+ rav.print(*(filehandles[(myIt->second)->getGroup()]));
+ (*(filehandles[(myIt->second)->getGroup()])).close();
+ }else{
+ m->mothurOut("Can't find shared info for " + order[i] + ", skipping."); m->mothurOutEndLine();
+ }
+ }
+
}
}
}
-
+//**********************************************************************************************************************
+int SharedCommand::readOrderFile() {
+ try {
+ //remove old names
+ order.clear();
+
+ ifstream in;
+ openInputFile(globaldata->getOrderGroupFile(), in);
+ string thisGroup;
+
+ while(!in.eof()){
+ in >> thisGroup; gobble(in);
+
+ order.push_back(thisGroup);
+
+ if (m->control_pressed) { order.clear(); break; }
+ }
+ in.close();
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SharedCommand", "readOrderFile");
+ exit(1);
+ }
+}
//**********************************************************************************************************************
bool SharedCommand::isValidGroup(string groupname, vector<string> groups) {
private:
void printSharedData(vector<SharedRAbundVector*>);
int createMisMatchFile();
+ int readOrderFile();
bool isValidGroup(string, vector<string>);
int eliminateZeroOTUS(vector<SharedRAbundVector*>&);
SharedListVector* SharedList;
InputData* input;
GroupMap* groupMap;
- vector<string> groups, outputNames;
+ vector<string> groups, outputNames, order;
ofstream out;
string filename, fileroot, outputDir;
bool firsttime, pickedGroups;