+ MPI_File_close(&inMPI);
+
+ for(int i=2;i<num2;i++){
+ //read next sequence
+ length = positions2[i+1] - positions2[i];
+ char* buf4 = new char[length];
+
+ MPI_File_read_at(inMPI2, positions2[i], buf4, length, MPI_CHAR, &status);
+
+ tempBuf = buf4;
+ if (tempBuf.length() > length) { tempBuf = tempBuf.substr(0, length); }
+ delete buf4;
+
+ istringstream iss (tempBuf,istringstream::in);
+
+ iss >> kmer;
+
+ //set them all to zero value
+ for (int i = 0; i < genusNodes.size(); i++) {
+ wordGenusProb[kmer][i] = log(zeroCountProb[kmer] / (float) (genusTotals[i]+1));
+ }
+
+ //get probs for nonzero values
+ for (int i = 0; i < numbers[kmer]; i++) {
+ iss >> name >> prob;
+ wordGenusProb[kmer][name] = prob;
+ }
+
+ }
+ MPI_File_close(&inMPI2);
+ MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
+ #else
+ //read version
+ string line = m->getline(in); m->gobble(in);
+
+ in >> numKmers; m->gobble(in);
+ //cout << threadID << '\t' << line << '\t' << numKmers << &in << '\t' << &inNum << '\t' << genusNodes.size() << endl;
+ //initialze probabilities
+ wordGenusProb.resize(numKmers);
+
+ for (int j = 0; j < wordGenusProb.size(); j++) { wordGenusProb[j].resize(genusNodes.size()); }
+
+ int kmer, name, count; count = 0;
+ vector<int> num; num.resize(numKmers);
+ float prob;
+ vector<float> zeroCountProb; zeroCountProb.resize(numKmers);
+ WordPairDiffArr.resize(numKmers);
+
+ //read version
+ string line2 = m->getline(inNum); m->gobble(inNum);
+ float probTemp;
+ //cout << threadID << '\t' << line2 << '\t' << this << endl;
+ while (inNum) {
+ inNum >> zeroCountProb[count] >> num[count] >> probTemp;
+ WordPairDiffArr[count].prob = probTemp;
+ count++;
+ m->gobble(inNum);
+ //cout << threadID << '\t' << count << endl;
+ }
+ inNum.close();
+ //cout << threadID << '\t' << "here1 " << &wordGenusProb << '\t' << &num << endl; //
+ //cout << threadID << '\t' << &genusTotals << '\t' << endl;
+ //cout << threadID << '\t' << genusNodes.size() << endl;
+ while(in) {
+ in >> kmer;
+ //cout << threadID << '\t' << kmer << endl;
+ //set them all to zero value
+ for (int i = 0; i < genusNodes.size(); i++) {
+ wordGenusProb[kmer][i] = log(zeroCountProb[kmer] / (float) (genusTotals[i]+1));
+ }
+ //cout << threadID << '\t' << num[kmer] << "here" << endl;
+ //get probs for nonzero values
+ for (int i = 0; i < num[kmer]; i++) {
+ in >> name >> prob;
+ wordGenusProb[kmer][name] = prob;
+ }
+
+ m->gobble(in);
+ }
+ in.close();
+ //cout << threadID << '\t' << "here" << endl;
+ #endif
+ }
+ catch(exception& e) {
+ m->errorOut(e, "Bayesian", "readProbFile");
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+bool Bayesian::checkReleaseDate(ifstream& file1, ifstream& file2, ifstream& file3, ifstream& file4) {
+ try {
+
+ bool good = true;
+
+ vector<string> lines;
+ lines.push_back(m->getline(file1));
+ lines.push_back(m->getline(file2));
+ lines.push_back(m->getline(file3));
+ lines.push_back(m->getline(file4));
+
+ //before we added this check
+ if ((lines[0][0] != '#') || (lines[1][0] != '#') || (lines[2][0] != '#') || (lines[3][0] != '#')) { good = false; }
+ else {
+ //rip off #
+ for (int i = 0; i < lines.size(); i++) { lines[i] = lines[i].substr(1); }
+
+ //get mothurs current version
+ string version = m->getVersion();
+
+ vector<string> versionVector;
+ m->splitAtChar(version, versionVector, '.');
+
+ //check each files version
+ for (int i = 0; i < lines.size(); i++) {
+ vector<string> linesVector;
+ m->splitAtChar(lines[i], linesVector, '.');
+
+ if (versionVector.size() != linesVector.size()) { good = false; break; }
+ else {
+ for (int j = 0; j < versionVector.size(); j++) {
+ int num1, num2;
+ convert(versionVector[j], num1);
+ convert(linesVector[j], num2);
+
+ //if mothurs version is newer than this files version, then we want to remake it
+ if (num1 > num2) { good = false; break; }
+ }
+ }
+
+ if (!good) { break; }
+ }