+ 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