void simulate(char* modelF, char* resultsF) { ModelType model(&refs); ReadType read; int sid; model.read(modelF); //calculate eel calcExpectedEffectiveLengths<ModelType>(M, refs, model, eel); //generate theta vector ifstream fin(resultsF); string line; double tpm; double denom = 0.0; getline(fin, line); // read the first line, which is just column names for (int i = 1; i <= M; i++) { getline(fin, line); size_t pos = 0; for (int j = 0; j < OFFSITE; j++) pos = line.find_first_of('\t', pos) + 1; size_t pos2 = line.find_first_of('\t', pos); if (pos2 == string::npos) pos2 = line.length(); tpm = atof(line.substr(pos, pos2 - pos).c_str()); theta[i] = tpm * eel[i]; // during simulation, there is no check for effL < 0. The reason is for that case, eel[i] here = 0 and therefore no chance to sample from it denom += theta[i]; } assert(denom > EPSILON); fin.close(); for (int i = 1; i <= M; i++) theta[i] = theta[i] / denom * (1.0 - theta[0]); READ_INT_TYPE resimulation_count = 0; //simulating... model.startSimulation(sampler, theta); for (READ_INT_TYPE i = 0; i < N; i++) { while (!model.simulate(i, read, sid)) { ++resimulation_count; } read.write(n_os, os); ++counts[sid]; if ((i + 1) % 1000000 == 0 && verbose) cout<<"GEN "<< i + 1<< endl; } model.finishSimulation(); cout<< "Total number of resimulation is "<< resimulation_count<< endl; }
inline bool ReadRegionData::read_exists(ReadType const& read) const { return _read_regions.count(read.query_name()) > 0; }
inline bool ReadRegionData::read_exists(ReadType const& read) const { return _read_regions.find(read->query_name()) != _read_regions.end(); }