From 59d3f64158e93c6a6aad05fc79152c1fa5c35901 Mon Sep 17 00:00:00 2001 From: Rob Patro Date: Fri, 16 Jan 2015 02:21:00 -0500 Subject: [PATCH] Minor changes and version bump --- include/SalmonConfig.hpp | 4 ++-- include/Sampler.hpp | 19 +++++++++---------- src/SalmonQuantifyAlignments.cpp | 1 + 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/SalmonConfig.hpp b/include/SalmonConfig.hpp index c7348b4..6df38d9 100644 --- a/include/SalmonConfig.hpp +++ b/include/SalmonConfig.hpp @@ -28,8 +28,8 @@ namespace salmon { constexpr char majorVersion[] = "0"; constexpr char minorVersion[] = "2"; - constexpr char patchVersion[] = "3"; - constexpr char version[] = "0.2.3"; + constexpr char patchVersion[] = "5"; + constexpr char version[] = "0.2.5"; } #endif // SALMON_CONFIG_HPP diff --git a/include/Sampler.hpp b/include/Sampler.hpp index 1a4800b..a6894ae 100644 --- a/include/Sampler.hpp +++ b/include/Sampler.hpp @@ -158,16 +158,14 @@ namespace salmon { double logFragProb = sailfish::math::LOG_1; if (!salmonOpts.noFragLengthDist) { - switch (aln->fragType()) { - case ReadType::SINGLE_END: - if (aln->isLeft() and transcript.RefLength - aln->left() < fragLengthDist.maxVal()) { - logFragProb = fragLengthDist.cmf(transcript.RefLength - aln->left()); - } else if (aln->isRight() and aln->right() < fragLengthDist.maxVal()) { - logFragProb = fragLengthDist.cmf(aln->right()); - } - break; - case ReadType::PAIRED_END: - logFragProb = fragLengthDist.pmf(static_cast(aln->fragLen())); + if(aln->fragLen() == 0) { + if (aln->isLeft() and transcript.RefLength - aln->left() < fragLengthDist.maxVal()) { + logFragProb = fragLengthDist.cmf(transcript.RefLength - aln->left()); + } else if (aln->isRight() and aln->right() < fragLengthDist.maxVal()) { + logFragProb = fragLengthDist.cmf(aln->right()); + } + } else { + logFragProb = fragLengthDist.pmf(static_cast(aln->fragLen())); } } @@ -214,6 +212,7 @@ namespace salmon { double massInc{0.0}; bool choseAlignment{false}; for (auto& aln : alnGroup->alignments()) { + if (aln->logProb == LOG_0) { continue; } aln->logProb -= sumOfAlignProbs; massInc = std::exp(aln->logProb); diff --git a/src/SalmonQuantifyAlignments.cpp b/src/SalmonQuantifyAlignments.cpp index e8b6ed8..94ea9cf 100644 --- a/src/SalmonQuantifyAlignments.cpp +++ b/src/SalmonQuantifyAlignments.cpp @@ -236,6 +236,7 @@ void processMiniBatch(AlignmentLibrary& alnLib, // Normalize the scores for (auto& aln : alnGroup->alignments()) { + if (aln->logProb == LOG_0) { continue; } aln->logProb -= sumOfAlignProbs; double r = uni(eng);