for (it = parameters.begin(); it != parameters.end(); it++) {
if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
}
-
+
//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 = ""; }
+
//if the user changes the input directory command factory will send this info to us in the output parameter
string inputDir = validParameter.validFile(parameters, "inputdir", false);
+
if (inputDir == "not found"){ inputDir = ""; }
else {
string path;
+
it = parameters.find("template");
+
//user has given a template file
if(it != parameters.end()){
path = hasPath(it->second);
if (path == "") { parameters["template"] = inputDir + it->second; }
}
}
-
+
//check for required parameters
templateFileName = validParameter.validFile(parameters, "template", true);
+
if (templateFileName == "not found") {
mothurOut("template is a required parameter for the align.seqs command.");
mothurOutEndLine();
//make sure there is at least one valid file left
if (candidateFileNames.size() == 0) { mothurOut("no valid files."); mothurOutEndLine(); abort = true; }
}
-
//check for optional parameter and set defaults
// ...at some point should added some additional type checking...
mothurOut("\t\tparameters: fasta=required, template=required, filter=F, mask=no mask, processors=1, window=10% of length, numwanted=20\n");
mothurOut("\tchimeracheck: \n");
mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, ksize=7, svg=F, name=none\n\n");
- //mothurOut("\tchimeraslayer: \n");
- //mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, mask=no mask, numwanted=10, match=5, mismatch=-4, divergence=1.0, minsim=90, parents=5, iters=1000, window=100. \n\n");
+ mothurOut("\tchimeraslayer: \n");
+ mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, mask=no mask, numwanted=10, match=5, mismatch=-4, divergence=1.0, minsim=90, parents=5, iters=1000, window=100. \n\n");
mothurOut("The chimera.seqs command should be in the following format: \n");
mothurOut("chimera.seqs(fasta=yourFastaFile, filter=yourFilter, correction=yourCorrection, processors=yourProcessors, method=bellerophon) \n");
mothurOut("Example: chimera.seqs(fasta=AD.align, filter=True, correction=true, method=bellerophon, window=200) \n");
for (int i = 0; i < querySeqs.size(); i++) {
if (chimeraFlags[i] == "yes") {
- cout << i << endl;
+// cout << i << endl;
if ((chimeraResults[i][0].bsa >= 90.0) || (chimeraResults[i][0].bsb >= 90.0)) {
mothurOut(querySeqs[i]->getName() + "\tyes"); mothurOutEndLine();
out << querySeqs[i]->getName() << "\tyes" << endl;
/***********************************************************************/
inline string getFullPathName(string fileName){
-
+ try{
string path = hasPath(fileName);
string newFileName;
int pos;
else { newFileName = fileName.substr(fileName.rfind("./")+2); } //save the complete part of the name
char* cwdpath = new char[1024];
+
size_t size;
cwdpath=getcwd(cwdpath,size);
- cwd = cwdpath;
+ cwd = cwdpath;
+
//rip off first '/'
string simpleCWD;
if (cwd.length() > 0) { simpleCWD = cwd.substr(1); }
}
//get last one // ex. ../../../filename = /user/work/desktop/filename
dirs.push_back(simpleCWD); //ex. dirs[0] = user, dirs[1] = work, dirs[2] = desktop
-
+
+
int index = dirs.size()-1;
-
+
while((pos = path.rfind("./")) != -1) { //while you don't have a complete path
if (path[(pos-1)] == '.') { //you want your parent directory ../
path = path.substr(0, pos-1);
#endif
}
+ }
+ catch(exception& e) {
+ errorOut(e, "getFullPathName", "getFullPathName");
+ exit(1);
+ }
+
}
/***********************************************************************/
inline int openInputFile(string fileName, ifstream& fileHandle){
//get full path name
string completeFileName = getFullPathName(fileName);
-
+
fileHandle.open(completeFileName.c_str());
if(!fileHandle) {
mothurOut("Error: Could not open " + completeFileName); mothurOutEndLine();
exit(1);
}
}
-/**************************************************************************************************
-int PreClusterCommand::readFASTA(){
- try {
-// ifstream inFasta;
-// openInputFile(fastafile, inFasta);
-// length = 0;
-//// map<string, string>::iterator it;
-//
-// while (!inFasta.eof()) {
-// Sequence temp(inFasta); //read seq
-//
-// if (temp.getName() != "") {
-// if (namefile != "") {
-// //make sure fasta and name files match
-// it = names.find(temp.getName());
-// if (it == names.end()) { mothurOut(temp.getName() + " is not in your names file, please correct."); mothurOutEndLine(); exit(1); }
-// }else { sizes[temp.getName()] = 1; }
-//
-// seqPNode tempNode(sizes[temp.getName()], temp);
-// alignSeqs.push_back(tempNode);
-// active[temp.getName()] = true;
-// }
-// gobble(inFasta);
-// }
-// inFasta.close();
-//
-// if (alignSeqs.size() != 0) { length = alignSeqs[0].seq.getAligned().length(); }
-//
- return alignSeqs.size();
- }
- catch(exception& e) {
- errorOut(e, "PreClusterCommand", "readFASTA");
- exit(1);
- }
-}
+
/**************************************************************************************************/
-//this seems to require the names and fasta file to be in the same order???
+
+//this requires the names and fasta file to be in the same order
+
int PreClusterCommand::readFASTA(){
try {
//ifstream inNames;
exit(1);
}
}
+
/**************************************************************************************************/
+
void PreClusterCommand::readNameFile(){
try {
ifstream in;
it = container.find(parameter);
if(it != container.end()){ //no parameter given
+
if(isFile == true) {
+
ableToOpen = openInputFile(it->second, in);
+
if (ableToOpen == 1) { return "not open"; }
in.close();
}