From 37513308b7557ae65899e59df8e43b5dec90da5c Mon Sep 17 00:00:00 2001 From: Bo Li Date: Wed, 10 Aug 2011 21:19:27 -0500 Subject: [PATCH] rsem v1.2.0 --- BamWriter.h | 4 ++-- EM.cpp | 2 +- QProfile.h | 2 +- Refs.h | 2 +- Transcript.h | 2 +- extractRef.cpp | 12 +++++++++--- synthesisRef.cpp | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/BamWriter.h b/BamWriter.h index e33a07f..fd0b8b7 100644 --- a/BamWriter.h +++ b/BamWriter.h @@ -227,7 +227,7 @@ void BamWriter::work(HitWrapper wrapper, Transcripts& transcripts) { uint16_t rstrand = b->core.flag & 0x0010; // read strand b->core.flag -= rstrand; - rstrand = (!rstrand && transcript.getStrand() == '+' || rstrand && transcript.getStrand() == '-' ? 0 : 0x0010); + rstrand = (((!rstrand && transcript.getStrand() == '+') || (rstrand && transcript.getStrand() == '-')) ? 0 : 0x0010); b->core.flag += rstrand; push_qname(qname, b->core.l_qname, data); @@ -356,7 +356,7 @@ void BamWriter::work(HitWrapper wrapper, Transcripts& transcripts) b2->core.flag = b2->core.flag - (b2->core.flag & 0x0010) - (b2->core.flag & 0x0020); uint16_t add, add2; - if (!rstrand && transcript.getStrand() == '+' || rstrand && transcript.getStrand() == '-') { + if ((!rstrand && transcript.getStrand() == '+') || (rstrand && transcript.getStrand() == '-')) { add = 0x0020; add2 = 0x0010; } else { diff --git a/EM.cpp b/EM.cpp index 08fc8c7..15dd117 100644 --- a/EM.cpp +++ b/EM.cpp @@ -506,7 +506,7 @@ void EM() { } if (verbose) printf("ROUND = %d, SUM = %.15g, bChange = %f, totNum = %d\n", ROUND, sum, bChange, totNum); - } while (ROUND < MIN_ROUND || totNum > 0 && ROUND < MAX_ROUND); + } while (ROUND < MIN_ROUND || (totNum > 0 && ROUND < MAX_ROUND)); //while (ROUND < MAX_ROUND); if (totNum > 0) fprintf(stderr, "Warning: RSEM reaches %d iterations before meeting the convergence criteria.\n", MAX_ROUND); diff --git a/QProfile.h b/QProfile.h index 8798562..0a3b74f 100644 --- a/QProfile.h +++ b/QProfile.h @@ -43,7 +43,7 @@ private: }; QProfile::QProfile() { - memset(p, sizeof(p), 0); + memset(p, 0, sizeof(p)); //make initialized parameters //ASSUME order of A, C, G, T, N diff --git a/Refs.h b/Refs.h index f411622..63b67e1 100644 --- a/Refs.h +++ b/Refs.h @@ -52,7 +52,7 @@ class Refs { } bool isValid(int sid, int dir, int pos, const std::string& readseq, int LEN, int C) { - if (sid <= 0 || sid > M || dir != 0 && dir != 1 || pos < 0 || pos + LEN > seqs[sid].getTotLen() || LEN > (int)readseq.length()) return false; + if (sid <= 0 || sid > M || (dir != 0 && dir != 1) || pos < 0 || pos + LEN > seqs[sid].getTotLen() || LEN > (int)readseq.length()) return false; const std::string& seq = seqs[sid].getSeq(dir); return countMismatch(seq, pos, readseq, LEN, C) <= C; } diff --git a/Transcript.h b/Transcript.h index ea621f3..8d7be7a 100644 --- a/Transcript.h +++ b/Transcript.h @@ -49,7 +49,7 @@ public: } bool operator< (const Transcript& o) const { - return gene_id < o.gene_id || gene_id == o.gene_id && transcript_id < o.transcript_id; + return gene_id < o.gene_id || (gene_id == o.gene_id && transcript_id < o.transcript_id); } const std::string& getTranscriptID() const { return transcript_id; } diff --git a/extractRef.cpp b/extractRef.cpp index 12b3222..693af66 100644 --- a/extractRef.cpp +++ b/extractRef.cpp @@ -86,8 +86,14 @@ bool buildTranscript(int sp, int ep) { int start = items[i].getStart(); int end = items[i].getEnd(); - assert(strand == items[i].getStrand()); - assert(seqname == items[i].getSeqName()); + if (strand != items[i].getStrand()) { + fprintf(stderr, "According to the GTF file given, a transcript has exons from different orientations!\n"); + exit(-1); + } + if (seqname != items[i].getSeqName()) { + fprintf(stderr, "According to the GTF file given, a transcript has exons on multiple chromosomes!\n"); + exit(-1); + } if (cur_e + 1 < start) { if (cur_s > 0) vec.push_back(Interval(cur_s, cur_e)); @@ -241,7 +247,7 @@ void writeResults(char* refName) { } int main(int argc, char* argv[]) { - if (argc < 6 || (hasMappingFile = atoi(argv[4])) && argc < 7) { + if (argc < 6 || ((hasMappingFile = atoi(argv[4])) && argc < 7)) { printf("Usage: rsem-extract-reference-transcripts refName quiet gtfF hasMappingFile [mappingFile] chromosome_file_1 [chromosome_file_2 ...]\n"); exit(-1); } diff --git a/synthesisRef.cpp b/synthesisRef.cpp index 3bb2808..0c6695e 100644 --- a/synthesisRef.cpp +++ b/synthesisRef.cpp @@ -104,7 +104,7 @@ void writeResults(char* refName) { } int main(int argc, char* argv[]) { - if (argc < 5 || (hasMappingFile = atoi(argv[3])) && argc < 6) { + if (argc < 5 || ((hasMappingFile = atoi(argv[3])) && argc < 6)) { printf("Usage: synthesisRef refName quiet hasMappingFile [mappingFile] reference_file_1 [reference_file_2 ...]\n"); exit(-1); } -- 2.39.2