From cee60cca5d914c7e6e880cb8276cdb5b129458c7 Mon Sep 17 00:00:00 2001 From: Bo Li Date: Fri, 31 Jan 2014 18:03:52 -0600 Subject: [PATCH] Fixed a bug which will lead to out-of-memory error when RSEM computes ngvector for EBSeq --- EBSeq/calcClusteringInfo.cpp | 20 +++++++++----------- WHAT_IS_NEW | 6 ++++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/EBSeq/calcClusteringInfo.cpp b/EBSeq/calcClusteringInfo.cpp index c1d64bb..27357b2 100644 --- a/EBSeq/calcClusteringInfo.cpp +++ b/EBSeq/calcClusteringInfo.cpp @@ -10,21 +10,19 @@ #include using namespace std; -typedef unsigned int INTEGER; - const int STRLEN = 1005; -INTEGER M; +int M; int k; // k-mer size vector names; vector seqs; -vector effL; +vector effL; // tid starts from 1 struct ReadType { - INTEGER tid, pos; + int tid, pos; - ReadType(INTEGER tid, INTEGER pos) { + ReadType(int tid, int pos) { this->tid = tid; this->pos = pos; } @@ -104,10 +102,10 @@ int main(int argc, char* argv[]) { cands.clear(); effL.assign(M + 1, 0); - for (INTEGER i = 1; i <= M; i++) { - effL[i] = seqs[i].length() - k + 1; + for (int i = 1; i <= M; i++) { + effL[i] = int(seqs[i].length()) - k + 1; if (effL[i] <= 0) effL[i] = 0; // effL should be non-negative - for (INTEGER j = 0; j < effL[i]; j++) + for (int j = 0; j < effL[i]; j++) cands.push_back(ReadType(i, j)); } printf("All possbile %d mers are generated.\n", k); @@ -133,7 +131,7 @@ int main(int argc, char* argv[]) { p = i; } - for (INTEGER i = 1; i <= M; i++) + for (int i = 1; i <= M; i++) if (effL[i] == 0) clusteringInfo[i] = -1.0; else clusteringInfo[i] /= effL[i]; @@ -141,7 +139,7 @@ int main(int argc, char* argv[]) { ofstream fout(argv[3]); - for (INTEGER i = 1; i <= M; i++) fout<