CommandParameter preference("reference", "InputTypes", "", "", "none", "none", "none","",false,true,true); parameters.push_back(preference);
CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "none", "QualReport","",false,false); parameters.push_back(pqfile);
CommandParameter preport("report", "InputTypes", "", "", "none", "none", "QualReport","",false,false); parameters.push_back(preport);
- CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pname);
+ CommandParameter pname("name", "InputTypes", "", "", "namecount", "none", "none","",false,false,true); parameters.push_back(pname);
+ CommandParameter pcount("count", "InputTypes", "", "", "namecount", "none", "none","",false,false,true); parameters.push_back(pcount);
CommandParameter pignorechimeras("ignorechimeras", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(pignorechimeras);
CommandParameter pthreshold("threshold", "Number", "", "1.0", "", "", "","",false,false); parameters.push_back(pthreshold);
CommandParameter paligned("aligned", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(paligned);
helpString += "The reference parameter...\n";
helpString += "The qfile parameter...\n";
helpString += "The report parameter...\n";
- helpString += "The name parameter...\n";
+ helpString += "The name parameter allows you to provide a name file associated with the fasta file.\n";
+ helpString += "The count parameter allows you to provide a count file associated with the fasta file.\n";
helpString += "The ignorechimeras parameter...\n";
helpString += "The threshold parameter...\n";
helpString += "The processors parameter...\n";
//if the user has not given a path then, add inputdir. else leave path alone.
if (path == "") { parameters["name"] = inputDir + it->second; }
}
+
+ it = parameters.find("count");
+ //user has given a names file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["count"] = inputDir + it->second; }
+ }
it = parameters.find("qfile");
//user has given a quality score file
if(namesFileName == "not found"){ namesFileName = ""; }
else if (namesFileName == "not open") { namesFileName = ""; abort = true; }
else { m->setNameFile(namesFileName); }
+
+ //check for optional parameters
+ countfile = validParameter.validFile(parameters, "count", true);
+ if(countfile == "not found"){ countfile = ""; }
+ else if (countfile == "not open") { countfile = ""; abort = true; }
+ else { m->setCountTableFile(countfile); }
qualFileName = validParameter.validFile(parameters, "qfile", true);
if(qualFileName == "not found"){ qualFileName = ""; }
outputDir += m->hasPath(queryFileName); //if user entered a file with a path then preserve it
}
+ if ((countfile != "") && (namesFileName != "")) { m->mothurOut("You must enter ONLY ONE of the following: count or name."); m->mothurOutEndLine(); abort = true; }
+
//check for optional parameter and set defaults
// ...at some point should added some additional type checking...
temp = validParameter.validFile(parameters, "threshold", false); if (temp == "not found") { temp = "1.00"; }
}
else{
if(reportFileName != ""){
- m->mothurOut("we are ignoring the report file if your sequences are not aligned. we will check that the sequences in your fasta and and qual fileare the same length.");
+ m->mothurOut("we are ignoring the report file if your sequences are not aligned. we will check that the sequences in your fasta and and qual file are the same length.");
m->mothurOutEndLine();
}
}
getReferences(); //read in reference sequences - make sure there's no ambiguous bases
- if(namesFileName != ""){ weights = getWeights(); }
+ if(namesFileName != "") { weights = getWeights(); }
+ else if (countfile != "") {
+ CountTable ct;
+ ct.readTable(countfile, false, false);
+ weights = ct.getNameMap();
+ }
vector<unsigned long long> fastaFilePos;
vector<unsigned long long> qFilePos;
m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences.");
m->mothurOutEndLine();
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("errorseq");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
int misMatchSize;
in >> misMatchSize; m->gobble(in);
if (misMatchSize > misMatchCounts.size()) { misMatchCounts.resize(misMatchSize, 0); }
- for (int j = 0; j < misMatchCounts.size(); j++) {
+ for (int j = 0; j < misMatchSize; j++) {
in >> tempNum; misMatchCounts[j] += tempNum;
}
m->gobble(in);
int numSeqs = 0;
map<string, int>::iterator it;
- qScoreErrorMap['m'].assign(41, 0);
- qScoreErrorMap['s'].assign(41, 0);
- qScoreErrorMap['i'].assign(41, 0);
- qScoreErrorMap['a'].assign(41, 0);
+ qScoreErrorMap['m'].assign(101, 0);
+ qScoreErrorMap['s'].assign(101, 0);
+ qScoreErrorMap['i'].assign(101, 0);
+ qScoreErrorMap['a'].assign(101, 0);
errorForward['m'].assign(maxLength,0);
errorForward['s'].assign(maxLength,0);
qualForwardMap.resize(maxLength);
qualReverseMap.resize(maxLength);
for(int i=0;i<maxLength;i++){
- qualForwardMap[i].assign(41,0);
- qualReverseMap[i].assign(41,0);
+ qualForwardMap[i].assign(101,0);
+ qualReverseMap[i].assign(101,0);
}
}
else if(qFileName != "" && !aligned){
qualForwardMap.resize(maxLength);
qualReverseMap.resize(maxLength);
for(int i=0;i<maxLength;i++){
- qualForwardMap[i].assign(41,0);
- qualReverseMap[i].assign(41,0);
+ qualForwardMap[i].assign(101,0);
+ qualReverseMap[i].assign(101,0);
}
}
int numParentSeqs = -1;
int closestRefIndex = -1;
- numParentSeqs = chimeraTest.analyzeQuery(query.getName(), query.getAligned(), outChimeraReport);
+ string querySeq = query.getAligned();
+ if (!aligned) { querySeq = query.getUnaligned(); }
+
+ numParentSeqs = chimeraTest.analyzeQuery(query.getName(), querySeq, outChimeraReport);
closestRefIndex = chimeraTest.getClosestRefIndex();
getErrors(query, reference, minCompare);
- if(namesFileName != ""){
+ if((namesFileName != "") || (countfile != "")){
it = weights.find(query.getName());
minCompare.weight = it->second;
}
if (queryFile.eof()) { break; }
#endif
- if(index % 100 == 0){ m->mothurOut(toString(index)); m->mothurOutEndLine(); }
+ if(index % 100 == 0){ m->mothurOutJustToScreen(toString(index)+"\n"); }
}
queryFile.close();
outChimeraReport.close();
else if(qFileName != "" && aligned == false){ qualFile.close(); }
//report progress
- m->mothurOut(toString(index)); m->mothurOutEndLine();
+ m->mothurOutJustToScreen(toString(index)+"\n");
return index;
}
outputNames.push_back(errorQualityFileName); outputTypes["errorquality"].push_back(errorQualityFileName);
errorQualityFile << "qscore\tmatches\tsubstitutions\tinsertions\tambiguous" << endl;
- for(int i=0;i<41;i++){
+ for(int i=0;i<101;i++){
errorQualityFile << i << '\t' << qScoreErrorMap['m'][i] << '\t' << qScoreErrorMap['s'][i] << '\t' << qScoreErrorMap['i'][i] << '\t'<< qScoreErrorMap['a'][i] << endl;
}
errorQualityFile.close();
string sname = ""; nameStream >> sname;
sname = sname.substr(1);
+
+ m->checkName(sname);
map<string, int>::iterator it = firstSeqNames.find(sname);
istringstream nameStream(input);
string sname = ""; nameStream >> sname;
+ m->checkName(sname);
+
map<string, int>::iterator it = firstSeqNamesReport.find(sname);
if(it != firstSeqNamesReport.end()) { //this is the start of a new chunk