optionString = "";
commandString = "";
- if(openParen != -1 && closeParen != -1){
- commandString = input.substr(0, openParen); //commandString contains everything before "("
+ if(openParen != -1 && closeParen != -1){
+ //gobble extra spaces
+ int spot = 0;
+ for (int i = 0; i < input.length(); i++) { if (!(isspace(input[i]))) { spot = i; break; } }
+ if (spot > openParen) { spot = 0; }
+ commandString = input.substr(spot, openParen-spot); //commandString contains everything before "("
optionString = input.substr((openParen+1), (closeParen-openParen-1)); //optionString contains everything between "(" and ")".
}
else if (openParen == -1) { m->mothurOut("[ERROR]: You are missing ("); m->mothurOutEndLine(); }
m->mothurOut("[ERROR]: " + metric + " is not a valid metric option for the cooccurrence command. Choices are cscore, checker, combo, vratio."); m->mothurOutEndLine(); abort = true;
}
- matrix = validParameter.validFile(parameters, "matrix", false); if (matrix == "not found") { matrix = "sim2"; }
+ matrix = validParameter.validFile(parameters, "matrixmodel", false); if (matrix == "not found") { matrix = "sim2"; }
if ((matrix != "sim1") && (matrix != "sim2") && (matrix != "sim3") && (matrix != "sim4") && (matrix != "sim5" ) && (matrix != "sim6" ) && (matrix != "sim7" ) && (matrix != "sim8" ) && (matrix != "sim9" )) {
m->mothurOut("[ERROR]: " + matrix + " is not a valid matrix option for the cooccurrence command. Choices are sim1, sim2, sim3, sim4, sim5, sim6, sim7, sim8, sim9."); m->mothurOutEndLine(); abort = true;
//nrows is ncols of inital matrix. All the functions need this value. They assume the transposition has already taken place and nrows and ncols refer to that matrix.
//comatrix and initmatrix are still vectors of vectors of ints as in the original script. The abundancevector is only what was read in ie not a co-occurrence matrix!
- int ncols = numOTUS;//rows of inital matrix
- int nrows = thisLookUp.size();//groups
+ int nrows = numOTUS;//rows of inital matrix
+ int ncols = thisLookUp.size();//groups
double initscore = 0.0;
- //transpose matrix
- int newmatrows = ncols;
- int newmatcols = nrows;
-
- //swap for transposed matrix
- nrows = newmatrows;//ncols;
- ncols = newmatcols;//nrows;
-
+
vector<int> initcolumntotal; initcolumntotal.resize(ncols, 0);
vector<int> initrowtotal; initrowtotal.resize(nrows, 0);
vector<double> stats;
string MakeBiomCommand::getHelpString(){
try {
string helpString = "";
- helpString += "The make.biom command parameters are shared, groups, matrixtype and label. shared is required, unless you have a valid current file.\n";
+ helpString += "The make.biom command parameters are shared, contaxonomy, groups, matrixtype and label. shared is required, unless you have a valid current file.\n";
helpString += "The groups parameter allows you to specify which of the groups in your groupfile you would like included. The group names are separated by dashes.\n";
helpString += "The label parameter allows you to select what distance levels you would like, and are also separated by dashes.\n";
helpString += "The matrixtype parameter allows you to select what type you would like to make. Choices are sparse and dense, default is sparse.\n";
+ helpString += "The contaxonomy file is the taxonomy file outputted by classify.otu(list=yourListfile, taxonomy=yourTaxonomyFile). Be SURE that the you are the constaxonomy file distance matches the shared file distance. ie, for *.0.03.cons.taxonomy set label=0.03. Mothur is smart enough to handle shared files that have been subsampled.\n";
helpString += "The make.biom command should be in the following format: make.biom(shared=yourShared, groups=yourGroups, label=yourLabels).\n";
- helpString += "The contaxonomy file is the taxonomy file outputted by classify.otu(list=yourListfile, taxonomy=yourTaxonomyFile). Be SURE that the you are the constaxonomy file distance matches the shared file distance. ie, for *.0.03.cons.taxonomy set label=0.03. Mothur is smart enough to handle shared files that have been subsampled after the classify.otu command was run on the list and taxonomy file.\n";
helpString += "Example make.biom(shared=abrecovery.an.shared, groups=A-B-C).\n";
helpString += "The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n";
helpString += "The make.biom command outputs a .biom file.\n";
if (control_pressed) { break; }
string firstCol, secondCol;
- in >> firstCol >> secondCol; gobble(in);
+ in >> firstCol; gobble(in);
+ in >> secondCol; gobble(in);
int num = getNumNames(secondCol);
bool getOligos(vector<vector<string> >&, vector<vector<string> >&, vector<vector<string> >&);
bool abort, keepprimer, keepdots;
string fastafile, oligosfile, taxfile, groupfile, namefile, ecolifile, outputDir, nomatch;
- int start, end, pdiffs, processors, length;
+ int start, end, processors, length;
vector<string> revPrimer, outputNames;
vector<string> primers;
CommandParameter pstart("start", "Number", "", "-1", "", "", "",false,false); parameters.push_back(pstart);
CommandParameter pend("end", "Number", "", "-1", "", "", "",false,false); parameters.push_back(pend);
CommandParameter pnomatch("nomatch", "Multiple", "reject-keep", "reject", "", "", "",false,false); parameters.push_back(pnomatch);
- CommandParameter ppdiffs("pdiffs", "Number", "", "0", "", "", "",false,false); parameters.push_back(ppdiffs);
CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
CommandParameter pkeepprimer("keepprimer", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pkeepprimer);
CommandParameter pkeepdots("keepdots", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pkeepdots);
string PcrSeqsCommand::getHelpString(){
try {
string helpString = "";
- helpString += "The pcr.seqs command reads a fasta file ...\n";
-
+ helpString += "The pcr.seqs command reads a fasta file.\n";
+ helpString += "The pcr.seqs command parameters are fasta, oligos, name, group, taxonomy, ecoli, start, end, nomatch, processors, keepprimer and keepdots.\n";
+ helpString += "The ecoli parameter is used to provide a fasta file containing a single reference sequence (e.g. for e. coli) this must be aligned. Mothur will trim to the start and end positions of the reference sequence.\n";
+ helpString += "The start parameter allows you to provide a starting position to trim to.\n";
+ helpString += "The end parameter allows you to provide a ending position to trim from.\n";
+ helpString += "The nomatch parameter allows you to decide what to do with sequences where the primer is not found. Default=reject, meaning remove from fasta file. if nomatch=true, then do nothing to sequence.\n";
+ helpString += "The processors parameter allows you to use multiple processors.\n";
+ helpString += "The keepprimer parameter allows you to keep the primer, default=false.\n";
+ helpString += "The keepdots parameter allows you to keep the leading and trailing .'s, default=true.\n";
helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n";
helpString += "For more details please check out the wiki http://www.mothur.org/wiki/Pcr.seqs .\n";
return helpString;
}
- //if the user changes the output directory command factory will send this info to us in the output parameter
- outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; }
//check for required parameters
fastafile = validParameter.validFile(parameters, "fasta", true);
}else if (fastafile == "not open") { fastafile = ""; abort = true; }
else { m->setFastaFile(fastafile); }
-
+ //if the user changes the output directory command factory will send this info to us in the output parameter
+ outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = m->hasPath(fastafile); }
+
//check for optional parameter and set defaults
// ...at some point should added some additional type checking...
string temp;
if (taxfile == "not found"){ taxfile = ""; }
else if(taxfile == "not open"){ taxfile = ""; abort = true; }
else { m->setTaxonomyFile(taxfile); }
-
- temp = validParameter.validFile(parameters, "pdiffs", false); if (temp == "not found") { temp = "0"; }
- m->mothurConvert(temp, pdiffs);
-
+
temp = validParameter.validFile(parameters, "start", false); if (temp == "not found") { temp = "-1"; }
m->mothurConvert(temp, start);
//make sure this sequence is in the namefile, else error
map<string, int>::iterator it = nameMap.find(current.getName());
- if (it == nameMap.end()) { m->mothurOut("[ERROR]: " + current.getName() + " is not in your namefile, please correct."); m->mothurOutEndLine(); m->control_pressed = true; }
+ if (it == nameMap.end()) { m->mothurOut("[ERROR]: '" + current.getName() + "' is not in your namefile, please correct."); m->mothurOutEndLine(); m->control_pressed = true; }
else { num = it->second; }
}
m = MothurOut::getInstance();
if (m->runParse == true) { parseTreeFile(); m->runParse = false; }
- //for(int i = 0; i < globaldata->Treenames.size(); i++) { cout << i << '\t' << globaldata->Treenames[i] << endl; }
numLeaves = m->Treenames.size();
numNodes = 2*numLeaves - 1;
//build tree from matrix
//initialize indexes
map<int, int> indexes; //maps row in simMatrix to vector index in the tree
- int numGroups = (tmap->getNamesOfGroups()).size();
- for (int g = 0; g < numGroups; g++) { indexes[g] = g; }
+ for (int g = 0; g < numLeaves; g++) { indexes[g] = g; }
//do merges and create tree structure by setting parents and children
//there are numGroups - 1 merges to do
- for (int i = 0; i < (numGroups - 1); i++) {
+ for (int i = 0; i < (numLeaves - 1); i++) {
float largest = -1000.0;
if (m->control_pressed) { break; }
//set non-leaf node info and update leaves to know their parents
//non-leaf
- tree[numGroups + i].setChildren(indexes[row], indexes[column]);
+ tree[numLeaves + i].setChildren(indexes[row], indexes[column]);
//parents
- tree[indexes[row]].setParent(numGroups + i);
- tree[indexes[column]].setParent(numGroups + i);
+ tree[indexes[row]].setParent(numLeaves + i);
+ tree[indexes[column]].setParent(numLeaves + i);
//blength = distance / 2;
float blength = ((1.0 - largest) / 2);
tree[indexes[column]].setBranchLength(blength - tree[indexes[column]].getLengthToLeaves());
//set your length to leaves to your childs length plus branchlength
- tree[numGroups + i].setLengthToLeaves(tree[indexes[row]].getLengthToLeaves() + tree[indexes[row]].getBranchLength());
+ tree[numLeaves + i].setLengthToLeaves(tree[indexes[row]].getLengthToLeaves() + tree[indexes[row]].getBranchLength());
//update index
- indexes[row] = numGroups+i;
- indexes[column] = numGroups+i;
+ indexes[row] = numLeaves+i;
+ indexes[column] = numLeaves+i;
//remove highest value that caused the merge.
sims[row][column] = -1000.0;