[med-svn] [Git][med-team/last-align][upstream] New upstream version 1061

Michael R. Crusoe gitlab at salsa.debian.org
Sun May 10 12:58:38 BST 2020



Michael R. Crusoe pushed to branch upstream at Debian Med / last-align


Commits:
adc5d4bf by Michael R. Crusoe at 2020-05-10T13:54:30+02:00
New upstream version 1061
- - - - -


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 tantan repeat-finding faster
+	[543d36d39ce3] [tip]
+
 2020-03-16  Martin C. Frith  <Martin C. Frith>
 
 	* src/split/cbrc_split_aligner.cc, src/split/cbrc_split_aligner.hh:
 	Reduce last-split memory & time usage a bit
-	[ca3f417edc01] [tip]
+	[ca3f417edc01]
 
 	* src/split/cbrc_int_exponentiator.hh:
 	Make last-split 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 @@
-"1060"
+"1061"



View it on GitLab: https://salsa.debian.org/med-team/last-align/-/commit/adc5d4bf2614f5a88e621d96177739aff4691512

-- 
View it on GitLab: https://salsa.debian.org/med-team/last-align/-/commit/adc5d4bf2614f5a88e621d96177739aff4691512
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/20200510/6312f5e8/attachment-0001.html>


More information about the debian-med-commit mailing list