X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=SingleQModel.h;h=ba43d9b608c934dd290ff5a9679b7f7d96e9586a;hp=ffc0639909b2f49a5d501c7ecb85be20f2f19f4f;hb=da57529b92adbb7ae74a89861cb39fb35ac7c62d;hpb=1f6726865dc80d8dd36462c559da46c9e4a8de8a diff --git a/SingleQModel.h b/SingleQModel.h index ffc0639..ba43d9b 100644 --- a/SingleQModel.h +++ b/SingleQModel.h @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include "utils.h" #include "my_assert.h" @@ -237,12 +239,12 @@ public: const LenDist& getGLD() { return *gld; } - void startSimulation(simul*, double*); - bool simulate(int, SingleReadQ&, int&); + void startSimulation(simul*, const std::vector&); + bool simulate(READ_INT_TYPE, SingleReadQ&, int&); void finishSimulation(); //Use it after function 'read' or 'estimateFromReads' - double* getMW() { + const double* getMW() { assert(mw != NULL); return mw; } @@ -254,7 +256,7 @@ private: static const int read_type = 1; int M; - int N[3]; + READ_INT_TYPE N[3]; Refs *refs; double mean, sd; int seedLen; @@ -289,7 +291,7 @@ void SingleQModel::estimateFromReads(const char* readFN) { genReadFileNames(readFN, i, read_type, s, readFs); ReadReader reader(s, readFs, refs->hasPolyA(), seedLen); // allow calculation of calc_lq() function - int cnt = 0; + READ_INT_TYPE cnt = 0; while (reader.next(read)) { if (!read.isLowQuality()) { mld != NULL ? mld->update(read.getReadLength(), 1.0) : gld->update(read.getReadLength(), 1.0); @@ -297,14 +299,14 @@ void SingleQModel::estimateFromReads(const char* readFN) { if (i == 0) { nqpro->updateC(read.getReadSeq(), read.getQScore()); } } else if (verbose && read.getReadLength() < seedLen) { - printf("Warning: Read %s is ignored due to read length %d < seed length %d!\n", read.getName().c_str(), read.getReadLength(), seedLen); + std::cout<< "Warning: Read "<< read.getName()<< " is ignored due to read length "<< read.getReadLength()<< " < seed length "<< seedLen<< "!"<< std::endl; } ++cnt; - if (verbose && cnt % 1000000 == 0) { printf("%d READS PROCESSED\n", cnt); } + if (verbose && cnt % 1000000 == 0) { std::cout<< cnt<< " READS PROCESSED"<< std::endl; } } - if (verbose) { printf("estimateFromReads, N%d finished.\n", i); } + if (verbose) { std::cout<< "estimateFromReads, N"<< i<< " finished."<< std::endl; } } mld != NULL ? mld->finish() : gld->finish(); @@ -404,7 +406,7 @@ void SingleQModel::write(const char* outF) { fclose(fo); } -void SingleQModel::startSimulation(simul* sampler, double* theta) { +void SingleQModel::startSimulation(simul* sampler, const std::vector& theta) { this->sampler = sampler; theta_cdf = new double[M + 1]; @@ -419,7 +421,7 @@ void SingleQModel::startSimulation(simul* sampler, double* theta) { nqpro->startSimulation(); } -bool SingleQModel::simulate(int rid, SingleReadQ& read, int& sid) { +bool SingleQModel::simulate(READ_INT_TYPE rid, SingleReadQ& read, int& sid) { int dir, pos, readLen, fragLen; std::string name; std::string qual, readseq;