//***************************************************************************************************************
-Ccode::Ccode(string filename, string temp) { fastafile = filename; templateFile = temp; }
+Ccode::Ccode(string filename, string temp, string o) { fastafile = filename; templateFile = temp; outputDir = o; }
//***************************************************************************************************************
Ccode::~Ccode() {
mothurOutEndLine();
- string mapInfo = getRootName(fastafile) + "mapinfo";
+ string mapInfo = outputDir + getRootName(getSimpleName(fastafile)) + "mapinfo";
ofstream out2;
openOutputFile(mapInfo, out2);
}
//***************************************************************************************************************
-void Ccode::getChimeras() {
+int Ccode::getChimeras() {
try {
//read in query sequences and subject sequences
int numSeqs = querySeqs.size();
+ if (unaligned) { mothurOut("Your sequences need to be aligned when you use the bellerophon ccode."); mothurOutEndLine(); return 1; }
+
closest.resize(numSeqs);
refCombo.resize(numSeqs, 0);
lines.push_back(new linePair((i*linesPerProcess), numSeqs));
}
- //find breakup of templatefile for quantiles
- if (processors == 1) { templateLines.push_back(new linePair(0, templateSeqs.size())); }
- else {
- for (int i = 0; i < processors; i++) {
- templateLines.push_back(new linePair());
- templateLines[i]->start = int (sqrt(float(i)/float(processors)) * templateSeqs.size());
- templateLines[i]->end = int (sqrt(float(i+1)/float(processors)) * templateSeqs.size());
- }
- }
#else
lines.push_back(new linePair(0, numSeqs));
- templateLines.push_back(new linePair(0, templateSeqs.size()));
#endif
distCalc = new eachGapDist();
//free memory
for (int i = 0; i < lines.size(); i++) { delete lines[i]; }
- for (int i = 0; i < templateLines.size(); i++) { delete templateLines[i]; }
delete distCalc;
delete decalc;
-
+
+ return 0;
}
catch(exception& e) {
errorOut(e, "Ccode", "getChimeras");
it = trim[query].begin();
int length = it->second - it->first;
-
+
//default is wanted = 10% of total length
if (windowSizes[query] > length) {
mothurOut("You have slected a window larger than your sequence length after all filters, masks and trims have been done. I will use the default 10% of sequence length.");
windowSizes[query] = length / 10;
}else if (windowSizes[query] == 0) { windowSizes[query] = length / 10; }
- else if (windowSizes[query] > (length / 20)) {
+ else if (windowSizes[query] > (length * 0.20)) {
mothurOut("You have selected a window that is larger than 20% of your sequence length. This is not recommended, but I will continue anyway."); mothurOutEndLine();
- }else if (windowSizes[query] < (length / 5)) {
+ }else if (windowSizes[query] < (length * 0.05)) {
mothurOut("You have selected a window that is smaller than 5% of your sequence length. This is not recommended, but I will continue anyway."); mothurOutEndLine();
}
//find the averages for the query
for (int i = 0; i < querySeqs.size(); i++) {
- findVarianceQuery(i); //fills varQuery[i] and sdQuery[i] also sets minimum error rate to 0.001 to avoid divide by 0.
+ findVarianceQuery(i); //fills v arQuery[i] and sdQuery[i] also sets minimum error rate to 0.001 to avoid divide by 0.
}
#endif
}