X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=EBSeq%2FcalcClusteringInfo.cpp;h=27357b23f757298bc2e3a3794318ee5a5e432cb4;hb=cee60cca5d914c7e6e880cb8276cdb5b129458c7;hp=2103f6169db7f27f4b636f12c62bdea9d1f054c7;hpb=9c2e46183a19d661f0a618a8eabe8ce1f6a8e2d6;p=rsem.git diff --git a/EBSeq/calcClusteringInfo.cpp b/EBSeq/calcClusteringInfo.cpp index 2103f61..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; } @@ -65,18 +63,17 @@ string convert(const string& rawseq) { void loadRef(char* inpF) { ifstream fin(inpF); string tag, line, rawseq; - void *pt; assert(fin.is_open()); names.clear(); names.push_back(""); seqs.clear(); seqs.push_back(""); - pt = getline(fin, line); - while (pt != 0 && line[0] == '>') { + getline(fin, line); + while ((fin) && (line[0] == '>')) { tag = line.substr(1); rawseq = ""; - while((pt = getline(fin, line)) && line[0] != '>') { + while((getline(fin, line)) && (line[0] != '>')) { rawseq += line; } if (rawseq.size() <= 0) { @@ -105,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); @@ -134,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]; @@ -142,7 +139,7 @@ int main(int argc, char* argv[]) { ofstream fout(argv[3]); - for (INTEGER i = 1; i <= M; i++) fout<