]> git.donarmstrong.com Git - rsem.git/blobdiff - SingleModel.h
rsem v1.1.11, allow spaces appear in field seqname and attributes gene_id, transcript...
[rsem.git] / SingleModel.h
index 49c103b956b9fa389edac2ad4a4cefcce000a2cc..bdf920ff271c133c749214244604fa319eac80c4 100644 (file)
@@ -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);
                }
        }
 
@@ -423,9 +423,8 @@ bool SingleModel::simulate(int rid, SingleRead& read, int& sid) {
                }
        }
 
-       std::ostringstream stdout;
-       stdout<<rid<<"_"<<dir<<"_"<<sid<<"_"<<pos;
-       name = stdout.str();
+       strout<<rid<<"_"<<dir<<"_"<<sid<<"_"<<pos;
+       name = strout.str();
 
        read = SingleRead(name, readseq);