From: Bo Li Date: Thu, 25 Aug 2011 12:49:30 +0000 (-0500) Subject: rsem v1.1.11 X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=commitdiff_plain;h=7b8405a9fe481d041d7e50d1d8abb4b589bdc0d3 rsem v1.1.11 --- diff --git a/LenDist.h b/LenDist.h index d7b2ba3..f19baba 100644 --- a/LenDist.h +++ b/LenDist.h @@ -217,12 +217,12 @@ void LenDist::read(FILE *fi) { delete[] pdf; delete[] cdf; - fscanf(fi, "%d %d %d", &lb, &ub, &span); + assert(fscanf(fi, "%d %d %d", &lb, &ub, &span) == 3); pdf = new double[span + 1]; cdf = new double[span + 1]; pdf[0] = cdf[0] = 0.0; for (int i = 1; i <= span; i++) { - fscanf(fi, "%lf", &pdf[i]); + assert(fscanf(fi, "%lf", &pdf[i]) == 1); cdf[i] = cdf[i - 1] + pdf[i]; } diff --git a/NoiseProfile.h b/NoiseProfile.h index 9c3dd22..c8d2107 100644 --- a/NoiseProfile.h +++ b/NoiseProfile.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "utils.h" #include "RefSeq.h" @@ -119,10 +120,10 @@ void NoiseProfile::read(FILE *fi) { int tmp_ncodes; memset(c, 0, sizeof(c)); - fscanf(fi, "%d", &tmp_ncodes); + assert(fscanf(fi, "%d", &tmp_ncodes) == 1); assert(tmp_ncodes == NCODES); for (int i = 0; i < NCODES; i++) - fscanf(fi, "%lf", &p[i]); + assert(fscanf(fi, "%lf", &p[i]) == 1); } void NoiseProfile::write(FILE *fo) { diff --git a/NoiseQProfile.h b/NoiseQProfile.h index 4c22cbf..6de12b1 100644 --- a/NoiseQProfile.h +++ b/NoiseQProfile.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "utils.h" #include "RefSeq.h" @@ -131,20 +132,13 @@ void NoiseQProfile::collect(const NoiseQProfile& o) { void NoiseQProfile::read(FILE *fi) { int tmp_size, tmp_ncodes; - /* DEBUG */ memset(c, 0, sizeof(c)); - //logp = 0.0; - /* END */ - fscanf(fi, "%d %d", &tmp_size, &tmp_ncodes); + assert(fscanf(fi, "%d %d", &tmp_size, &tmp_ncodes) == 2); assert(tmp_size == SIZE && tmp_ncodes == NCODES); for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < NCODES; j++) { - fscanf(fi, "%lf", &p[i][j]); - /* DEBUG */ - //if (c[i][j] > 0) logp += c[i][j] * log(p[i][j]); - /* END */ - } + for (int j = 0; j < NCODES; j++) + assert(fscanf(fi, "%lf", &p[i][j]) == 1); } } diff --git a/Orientation.h b/Orientation.h index 7ff8e87..6f31dac 100644 --- a/Orientation.h +++ b/Orientation.h @@ -3,6 +3,7 @@ #include #include +#include #include "simul.h" @@ -23,7 +24,7 @@ public: double getProb(int dir) { return prob[dir]; } void read(FILE* fi) { - fscanf(fi, "%lf", &prob[0]); + assert(fscanf(fi, "%lf", &prob[0]) == 1); prob[1] = 1.0 - prob[0]; } diff --git a/PairedEndModel.h b/PairedEndModel.h index 7c87374..c9f7a81 100644 --- a/PairedEndModel.h +++ b/PairedEndModel.h @@ -288,7 +288,7 @@ void PairedEndModel::read(const char* inpF) { FILE *fi = fopen(inpF, "r"); if (fi == NULL) { fprintf(stderr, "Cannot open %s! It may not exist.\n", inpF); exit(-1); } - fscanf(fi, "%d", &val); + assert(fscanf(fi, "%d", &val) == 1); assert(val == model_type); ori->read(fi); @@ -302,7 +302,7 @@ void PairedEndModel::read(const char* inpF) { if (M == 0) M = val; if (M == val) { mw = new double[M + 1]; - for (int i = 0; i <= M; i++) fscanf(fi, "%lf", &mw[i]); + for (int i = 0; i <= M; i++) assert(fscanf(fi, "%lf", &mw[i]) == 1); } } diff --git a/PairedEndQModel.h b/PairedEndQModel.h index dee535d..64e486b 100644 --- a/PairedEndQModel.h +++ b/PairedEndQModel.h @@ -298,7 +298,7 @@ void PairedEndQModel::read(const char* inpF) { FILE *fi = fopen(inpF, "r"); if (fi == NULL) { fprintf(stderr, "Cannot open %s! It may not exist.\n", inpF); exit(-1); } - fscanf(fi, "%d", &val); + assert(fscanf(fi, "%d", &val) == 1); assert(val == model_type); ori->read(fi); @@ -313,7 +313,7 @@ void PairedEndQModel::read(const char* inpF) { if (M == 0) M = val; if (M == val) { mw = new double[M + 1]; - for (int i = 0; i <= M; i++) fscanf(fi, "%lf", &mw[i]); + for (int i = 0; i <= M; i++) assert(fscanf(fi, "%lf", &mw[i]) == 1); } } diff --git a/Profile.h b/Profile.h index 899f0d0..ecf059c 100644 --- a/Profile.h +++ b/Profile.h @@ -132,7 +132,7 @@ void Profile::collect(const Profile& o) { void Profile::read(FILE *fi) { int tmp_prolen, tmp_ncodes; - fscanf(fi, "%d %d", &tmp_prolen, &tmp_ncodes); + assert(fscanf(fi, "%d %d", &tmp_prolen, &tmp_ncodes) == 2); assert(tmp_ncodes == NCODES); if (tmp_prolen != proLen) { delete[] p; @@ -145,7 +145,7 @@ void Profile::read(FILE *fi) { for (int i = 0; i < proLen; i++) for (int j = 0; j < NCODES; j++) for (int k = 0; k < NCODES; k++) - fscanf(fi, "%lf", &p[i][j][k]); + assert(fscanf(fi, "%lf", &p[i][j][k]) == 1); } void Profile::write(FILE* fo) { diff --git a/QProfile.h b/QProfile.h index 0a3b74f..6646342 100644 --- a/QProfile.h +++ b/QProfile.h @@ -128,12 +128,12 @@ void QProfile::collect(const QProfile& o) { void QProfile::read(FILE *fi) { int tmp_size, tmp_ncodes; - fscanf(fi, "%d %d", &tmp_size, &tmp_ncodes); + assert(fscanf(fi, "%d %d", &tmp_size, &tmp_ncodes) == 2); assert(tmp_size == SIZE && tmp_ncodes == NCODES); for (int i = 0; i < SIZE; i++) for (int j = 0; j < NCODES; j++) for (int k = 0; k < NCODES; k++) - fscanf(fi, "%lf", &p[i][j][k]); + assert(fscanf(fi, "%lf", &p[i][j][k]) == 1); } void QProfile::write(FILE *fo) { diff --git a/QualDist.h b/QualDist.h index fb12e46..5607124 100644 --- a/QualDist.h +++ b/QualDist.h @@ -94,12 +94,12 @@ double QualDist::getProb(const std::string& qual) { void QualDist::read(FILE *fi) { int tmp_size; - fscanf(fi, "%d", &tmp_size); + assert(fscanf(fi, "%d", &tmp_size) == 1); assert(tmp_size == SIZE); - for (int i = 0; i < SIZE; i++) { fscanf(fi, "%lf", &p_init[i]); } + for (int i = 0; i < SIZE; i++) { assert(fscanf(fi, "%lf", &p_init[i]) == 1); } for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { fscanf(fi, "%lf", &p_tran[i][j]); } + for (int j = 0; j < SIZE; j++) { assert(fscanf(fi, "%lf", &p_tran[i][j]) == 1); } } } diff --git a/RSPD.h b/RSPD.h index 4b8e25f..8c484a5 100644 --- a/RSPD.h +++ b/RSPD.h @@ -1,6 +1,10 @@ #ifndef RSPD_H_ #define RSPD_H_ +#include +#include +#include + #include "utils.h" #include "RefSeq.h" #include "Refs.h" @@ -137,17 +141,17 @@ void RSPD::read(FILE *fi) { delete[] cdf; int val; - fscanf(fi, "%d", &val); + assert(fscanf(fi, "%d", &val) == 1); estRSPD = (val != 0); if (estRSPD) { - fscanf(fi, "%d", &B); + assert(fscanf(fi, "%d", &B) == 1); pdf = new double[B + 2]; cdf = new double[B + 2]; memset(pdf, 0, sizeof(double) * (B + 2)); memset(cdf, 0, sizeof(double) * (B + 2)); for (int i = 1; i <= B; i++) { - fscanf(fi, "%lf", &pdf[i]); + assert(fscanf(fi, "%lf", &pdf[i]) == 1); cdf[i] = cdf[i - 1] + pdf[i]; } } diff --git a/SingleModel.h b/SingleModel.h index 756e3d5..bdf920f 100644 --- a/SingleModel.h +++ b/SingleModel.h @@ -321,12 +321,12 @@ void SingleModel::read(const char* inpF) { FILE *fi = fopen(inpF, "r"); if (fi == NULL) { fprintf(stderr, "Cannot open %s! It may not exist.\n", inpF); exit(-1); } - fscanf(fi, "%d", &val); + assert(fscanf(fi, "%d", &val) == 1); assert(val == model_type); ori->read(fi); gld->read(fi); - fscanf(fi, "%d", &val); + assert(fscanf(fi, "%d", &val) == 1); if (val > 0) { if (mld == NULL) mld = new LenDist(); mld->read(fi); @@ -339,7 +339,7 @@ void SingleModel::read(const char* inpF) { if (M == 0) M = val; if (M == val) { mw = new double[M + 1]; - for (int i = 0; i <= M; i++) fscanf(fi, "%lf", &mw[i]); + for (int i = 0; i <= M; i++) assert(fscanf(fi, "%lf", &mw[i]) == 1); } } diff --git a/SingleQModel.h b/SingleQModel.h index f01920f..f32b747 100644 --- a/SingleQModel.h +++ b/SingleQModel.h @@ -334,7 +334,7 @@ void SingleQModel::read(const char* inpF) { FILE *fi = fopen(inpF, "r"); if (fi == NULL) { fprintf(stderr, "Cannot open %s! It may not exist.\n", inpF); exit(-1); } - fscanf(fi, "%d", &val); + assert(fscanf(fi, "%d", &val) == 1); assert(val == model_type); ori->read(fi); @@ -353,7 +353,7 @@ void SingleQModel::read(const char* inpF) { if (M == 0) M = val; if (M == val) { mw = new double[M + 1]; - for (int i = 0; i <= M; i++) fscanf(fi, "%lf", &mw[i]); + for (int i = 0; i <= M; i++) assert(fscanf(fi, "%lf", &mw[i]) == 1); } } diff --git a/rsem-prepare-reference b/rsem-prepare-reference index ecea8d7..47d7d9c 100755 --- a/rsem-prepare-reference +++ b/rsem-prepare-reference @@ -109,7 +109,7 @@ if (!$no_bowtie) { print "$command\n"; $status = system($command); if ($status != 0) { - print "bowtie-build failed! Please check if you provide correct parameters/options for the pipeline!\n"; + print "bowtie-build failed! Please check if you have a copy of bowtie-build in the path you specified!\n"; exit(-1); } print "\n";