#ifdef USE_MPI
//do nothing
#else
- #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
//find breakup of templatefile for quantiles
if (processors == 1) { templateLines.push_back(new linePair(0, templateSeqs.size())); }
else {
m->mothurOut("Getting conservation... "); cout.flush();
if (consfile == "") {
m->mothurOut("Calculating probability of conservation for your template sequences. This can take a while... I will output the frequency of the highest base in each position to a .freq file so that you can input them using the conservation parameter next time you run this command. Providing the .freq file will improve speed. "); cout.flush();
- probabilityProfile = decalc->calcFreq(templateSeqs, outputDir + m->getSimpleName(templateFileName));
+ probabilityProfile = decalc->calcFreq(templateSeqs, templateFileName);
if (m->control_pressed) { return 0; }
m->mothurOut("Done."); m->mothurOutEndLine();
}else { probabilityProfile = readFreq(); m->mothurOut("Done."); }
string noOutliers, outliers;
if ((!filter) && (seqMask == "")) {
- noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.quan";
+ noOutliers = m->getRootName(m->getSimpleName(templateFileName)) + "pintail.quan";
}else if ((!filter) && (seqMask != "")) {
- noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.masked.quan";
+ noOutliers =m->getRootName(m->getSimpleName(templateFileName)) + "pintail.masked.quan";
}else if ((filter) && (seqMask != "")) {
- noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "masked.quan";
+ noOutliers = m->getRootName(m->getSimpleName(templateFileName)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "masked.quan";
}else if ((filter) && (seqMask == "")) {
- noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "quan";
+ noOutliers = m->getRootName(m->getSimpleName(templateFileName)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "quan";
}
decalc->removeObviousOutliers(quantilesMembers, templateSeqs.size());
}
}
//***************************************************************************************************************
-int Pintail::print(ostream& out, ostream& outAcc) {
+Sequence Pintail::print(ostream& out, ostream& outAcc) {
try {
+
int index = ceil(deviation);
//is your DE value higher than the 95%
for (int m = 0; m < expectedDistance.size(); m++) { out << expectedDistance[m] << '\t'; }
out << endl;
- return 0;
+ return *querySeq;
}
catch(exception& e) {
}
#ifdef USE_MPI
//***************************************************************************************************************
-int Pintail::print(MPI_File& out, MPI_File& outAcc) {
+Sequence Pintail::print(MPI_File& out, MPI_File& outAcc) {
try {
- bool results = false;
+
string outputString = "";
int index = ceil(deviation);
MPI_File_write_shared(outAcc, buf, length, MPI_CHAR, &statusAcc);
delete buf;
- results = true;
+ return *querySeq;
}
outputString += "Observed\t";
MPI_File_write_shared(out, buf2, length, MPI_CHAR, &status);
delete buf2;
- return results;
+ return *querySeq;
}
catch(exception& e) {
m->errorOut(e, "Pintail", "print");
//**************************************************************************************************
void Pintail::createProcessesQuan() {
try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
- int process = 0;
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
+ int process = 1;
vector<int> processIDS;
//loop through and create all the processes you want
ofstream out;
string s = toString(getpid()) + ".temp";
m->openOutputFile(s, out);
-
//output observed distances
for (int i = 0; i < quantilesMembers.size(); i++) {
out.close();
exit(0);
- }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
+ }else {
+ m->mothurOut("[ERROR]: unable to spawn the necessary processes."); m->mothurOutEndLine();
+ for (int i = 0; i < processIDS.size(); i++) { kill (processIDS[i], SIGINT); }
+ exit(0);
+ }
}
+ //parent does its part
+ quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, templateLines[0]->start, templateLines[0]->end);
+
//force parent to wait until all the processes are done
- for (int i=0;i<processors;i++) {
+ for (int i=0;i<(processors-1);i++) {
int temp = processIDS[i];
wait(&temp);
}
//get data created by processes
- for (int i=0;i<processors;i++) {
+ for (int i=0;i<(processors-1);i++) {
ifstream in;
string s = toString(processIDS[i]) + ".temp";
m->openInputFile(s, in);
}
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
-
+
#else
quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
#endif