[med-svn] [Git][med-team/tantan][upstream] New upstream version 23

Steffen Möller gitlab at salsa.debian.org
Sat May 9 15:24:51 BST 2020



Steffen Möller pushed to branch upstream at Debian Med / tantan


Commits:
5d55a974 by Steffen Moeller at 2020-05-09T16:22:25+02:00
New upstream version 23
- - - - -


3 changed files:

- ChangeLog.txt
- src/tantan.cc
- src/version.hh


Changes:

=====================================
ChangeLog.txt
=====================================
@@ -1,8 +1,14 @@
+2020-05-07  Martin C. Frith  <Martin C. Frith>
+
+	* src/tantan.cc:
+	Make it faster
+	[6b7981c6d602] [tip]
+
 2018-12-19  Martin C. Frith  <Martin C. Frith>
 
 	* src/tantan.cc:
 	Make it faster
-	[3523060bcfb9] [tip]
+	[3523060bcfb9]
 
 	* src/tantan_repeat_finder.cc, src/tantan_repeat_finder.hh:
 	Make -f4 a bit faster


=====================================
src/tantan.cc
=====================================
@@ -274,6 +274,10 @@ struct Tantan {
     return seqPtr - seqBeg < maxRepeatOffset;
   }
 
+  int maxOffsetInTheSequence() {
+    return isNearSeqBeg() ? (seqPtr - seqBeg) : maxRepeatOffset;
+  }
+
   const uchar *seqFurthestBack() {
     return isNearSeqBeg() ? seqBeg : seqPtr - maxRepeatOffset;
   }
@@ -296,6 +300,50 @@ struct Tantan {
     }
   }
 
+  void calcForwardTransitionAndEmissionProbs() {
+    if (endGapProb > 0) {
+      calcForwardTransitionProbsWithGaps();
+      calcEmissionProbs();
+      return;
+    }
+
+    double b = backgroundProb;
+    double fromForeground = 0;
+    double *foregroundBeg = BEG(foregroundProbs);
+    const double *lrRow = likelihoodRatioMatrix[*seqPtr];
+    int maxOffset = maxOffsetInTheSequence();
+
+    for (int i = 0; i < maxOffset; ++i) {
+      double f = foregroundBeg[i];
+      fromForeground += f;
+      foregroundBeg[i] = (b * b2fProbs[i] + f * f2f0) * lrRow[seqPtr[-i-1]];
+    }
+
+    backgroundProb = b * b2b + fromForeground * f2b;
+  }
+
+  void calcEmissionAndBackwardTransitionProbs() {
+    if (endGapProb > 0) {
+      calcEmissionProbs();
+      calcBackwardTransitionProbsWithGaps();
+      return;
+    }
+
+    double toBackground = f2b * backgroundProb;
+    double toForeground = 0;
+    double *foregroundBeg = BEG(foregroundProbs);
+    const double *lrRow = likelihoodRatioMatrix[*seqPtr];
+    int maxOffset = maxOffsetInTheSequence();
+
+    for (int i = 0; i < maxOffset; ++i) {
+      double f = foregroundBeg[i] * lrRow[seqPtr[-i-1]];
+      toForeground += b2fProbs[i] * f;
+      foregroundBeg[i] = toBackground + f2f0 * f;
+    }
+
+    backgroundProb = b2b * backgroundProb + toForeground;
+  }
+
   void rescale(double scale) {
     backgroundProb *= scale;
     multiplyAll(foregroundProbs, scale);
@@ -322,8 +370,7 @@ struct Tantan {
     initializeForwardAlgorithm();
 
     while (seqPtr < seqEnd) {
-      calcForwardTransitionProbs();
-      calcEmissionProbs();
+      calcForwardTransitionAndEmissionProbs();
       rescaleForward();
       *letterProbs = static_cast<float>(backgroundProb);
       ++letterProbs;
@@ -343,8 +390,7 @@ struct Tantan {
       // a sequence:
       *letterProbs = 1 - static_cast<float>(nonRepeatProb);
       rescaleBackward();
-      calcEmissionProbs();
-      calcBackwardTransitionProbs();
+      calcEmissionAndBackwardTransitionProbs();
     }
 
     double z2 = backwardTotal();


=====================================
src/version.hh
=====================================
@@ -1 +1 @@
-"22"
+"23"



View it on GitLab: https://salsa.debian.org/med-team/tantan/-/commit/5d55a974f9a3627ec40788196f936a5e47ca24c0

-- 
View it on GitLab: https://salsa.debian.org/med-team/tantan/-/commit/5d55a974f9a3627ec40788196f936a5e47ca24c0
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200509/f339ede5/attachment-0001.html>


More information about the debian-med-commit mailing list