[med-svn] [swarm-cluster] 01/06: New upstream version 2.1.12+dfsg

Andreas Tille tille at debian.org
Wed Jan 18 08:10:32 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository swarm-cluster.

commit faa09a9bd562ffb56ea5c099bc2c221c28d3da68
Author: Andreas Tille <tille at debian.org>
Date:   Wed Jan 18 09:05:15 2017 +0100

    New upstream version 2.1.12+dfsg
---
 README.md       |  12 ++++++
 man/swarm.1     |  12 +++++-
 src/Makefile    |   2 +-
 src/algo.cc     |  13 ++++++-
 src/algod1.cc   |   2 +-
 src/arch.cc     |   2 +-
 src/bitmap.h    |   2 +-
 src/bloom.h     |   2 +-
 src/db.cc       |   2 +-
 src/derep.cc    |   2 +-
 src/matrix.cc   |   2 +-
 src/nw.cc       |   2 +-
 src/qgram.cc    |   2 +-
 src/scan.cc     |  10 +++--
 src/search16.cc |  87 +++++++++++++++++++++++++++++++------------
 src/search8.cc  | 112 ++++++++++++++++++++++++++++++++++++++------------------
 src/ssse3.cc    |   2 +-
 src/swarm.cc    |   4 +-
 src/swarm.h     |   4 +-
 src/threads.h   |   2 +-
 src/util.cc     |   2 +-
 21 files changed, 197 insertions(+), 83 deletions(-)

diff --git a/README.md b/README.md
index 3e90da0..d0e05fd 100644
--- a/README.md
+++ b/README.md
@@ -404,6 +404,18 @@ methods, here are some links:
 <a name="history"/>
 ## Version history##
 
+<a name="version2112"/>
+### version 2.1.12 ###
+
+**swarm** 2.1.12 removes a debugging message.
+
+<a name="version2111"/>
+### version 2.1.11 ###
+
+**swarm** 2.1.11 fixes two bugs related to the SIMD implementation
+of alignment that might result in incorrect alignments and scores.
+The bug only applies when d>1.
+
 <a name="version2110"/>
 ### version 2.1.10 ###
 
diff --git a/man/swarm.1 b/man/swarm.1
index 2372d4c..301f6cd 100644
--- a/man/swarm.1
+++ b/man/swarm.1
@@ -1,5 +1,5 @@
 .\" ============================================================================
-.TH swarm 1 "December 22, 2016" "version 2.1.10" "USER COMMANDS"
+.TH swarm 1 "January 16, 2017" "version 2.1.12" "USER COMMANDS"
 .\" ============================================================================
 .SH NAME
 swarm \(em find clusters of nearly-identical nucleotide amplicons
@@ -311,7 +311,7 @@ Torbjørn Rognes <torognes at ifi.uio.no>.
 Source code and binaries are available at <https://github.com/torognes/swarm>
 .\" ============================================================================
 .SH COPYRIGHT
-Copyright (C) 2012-2016 Frédéric Mahé & Torbjørn Rognes
+Copyright (C) 2012-2017 Frédéric Mahé & Torbjørn Rognes
 .PP
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Affero General Public License as
@@ -344,6 +344,14 @@ New features and important modifications of \fBswarm\fR (short lived
 or minor bug releases are not mentioned):
 .RS
 .TP
+.BR v2.1.12\~ "released January 16, 2017"
+Version 2.1.12 removes a debugging message.
+.TP
+.BR v2.1.11\~ "released January 16, 2017"
+Version 2.1.11 fixes two bugs related to the SIMD implementation
+of alignment that might result in incorrect alignments and scores.
+The bug only applies when d>1.
+.TP
 .BR v2.1.10\~ "released December 22, 2016"
 Version 2.1.10 fixes two bugs related to gap penalties of alignments.
 The first bug may lead to wrong aligments and similarity percentages
diff --git a/src/Makefile b/src/Makefile
index 407ebe6..824f486 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,6 +1,6 @@
 # SWARM
 #
-# Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+# Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 # 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as
diff --git a/src/algo.cc b/src/algo.cc
index c9ff0fd..0526ca0 100644
--- a/src/algo.cc
+++ b/src/algo.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
@@ -205,6 +205,17 @@ void algo_run()
 
           for(unsigned long t=0; t<targetcount; t++)
             {
+#if 0
+              printf("seed: %lu target: %lu score: %lu "
+                     "diffs: %lu alignlen: %lu bits: %lu\n",
+                     seedampliconid,
+                     targetampliconids[t],
+                     scores[t],
+                     diffs[t],
+                     alignlengths[t],
+                     bits);
+#endif
+
               unsigned diff = diffs[t];
 
               if (diff <= (unsigned long) resolution)
diff --git a/src/algod1.cc b/src/algod1.cc
index 6004b8c..eec12be 100644
--- a/src/algod1.cc
+++ b/src/algod1.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/arch.cc b/src/arch.cc
index e223c92..6a74937 100644
--- a/src/arch.cc
+++ b/src/arch.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/bitmap.h b/src/bitmap.h
index 429afac..7ae8143 100644
--- a/src/bitmap.h
+++ b/src/bitmap.h
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/bloom.h b/src/bloom.h
index 95c72ce..12a2a36 100644
--- a/src/bloom.h
+++ b/src/bloom.h
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/db.cc b/src/db.cc
index 56df3e5..84c1f42 100644
--- a/src/db.cc
+++ b/src/db.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/derep.cc b/src/derep.cc
index 7bfd69b..daf38bc 100644
--- a/src/derep.cc
+++ b/src/derep.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/matrix.cc b/src/matrix.cc
index 820e90e..8c81576 100644
--- a/src/matrix.cc
+++ b/src/matrix.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/nw.cc b/src/nw.cc
index 585e64b..fadeecf 100644
--- a/src/nw.cc
+++ b/src/nw.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/qgram.cc b/src/qgram.cc
index 496b7f4..ae42318 100644
--- a/src/qgram.cc
+++ b/src/qgram.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/scan.cc b/src/scan.cc
index db15e54..d5527d4 100644
--- a/src/scan.cc
+++ b/src/scan.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
@@ -126,8 +126,8 @@ void search_chunk(struct search_data * sdp, long bits)
     unsigned long seqno = master_targets[sdp->target_index + i];
     db_getsequenceandlength(seqno, & dseq, & dlen);
 
-    nw(query.seq, query.seq + query.len,
-       dseq, dseq + dlen,
+    nw(dseq, dseq + dlen,
+       query.seq, query.seq + query.len,
        score_matrix_63,
        penalty_gapopen, penalty_gapextend,
        master_scores + sdp->target_index + i,
@@ -138,6 +138,10 @@ void search_chunk(struct search_data * sdp, long bits)
        (unsigned long int *) sdp->hearray,
        query.qno, seqno);
 
+#if 0
+    printf("\nAlignment: %s\n", nwalignment);
+#endif
+
     free(nwalignment);
   }
 
diff --git a/src/search16.cc b/src/search16.cc
index fffb411..ed9bd2a 100644
--- a/src/search16.cc
+++ b/src/search16.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
@@ -128,8 +128,8 @@ inline void dprofile_fill16(WORD * dprofile_word,
    the vsearch codebase.
 */
 
-// Due to the use of pminsw instead of pminuw below, the code works
-// only with 15-bit values
+// Due to the use of pminsw instead of pminuw (which is sse4) below,
+// the code works only with 15-bit values
 
 #define INITIALIZE                                      \
   "        movq      %3, %%rax               \n"        \
@@ -139,14 +139,17 @@ inline void dprofile_fill16(WORD * dprofile_word,
   "        movq      %9, %%rax               \n"        \
   "        movdqa    (%%rax), %%xmm0         \n"        \
   "        movdqa    (%7), %%xmm7            \n"        \
+  "        movdqa    %%xmm7, %%xmm3          \n"        \
+  "        psubusw   %%xmm14, %%xmm3         \n"        \
+  "        movdqa    %%xmm3, %%xmm1          \n"        \
+  "        paddusw   %%xmm15, %%xmm3         \n"        \
+  "        movdqa    %%xmm3, %%xmm2          \n"        \
+  "        paddusw   %%xmm15, %%xmm3         \n"        \
   "        movdqa    %%xmm7, %%xmm4          \n"        \
-  "        movdqa    %%xmm7, %%xmm1          \n"        \
   "        paddusw   %%xmm15, %%xmm7         \n"        \
   "        movdqa    %%xmm7, %%xmm5          \n"        \
-  "        movdqa    %%xmm7, %%xmm2          \n"        \
   "        paddusw   %%xmm15, %%xmm7         \n"        \
   "        movdqa    %%xmm7, %%xmm6          \n"        \
-  "        movdqa    %%xmm7, %%xmm3          \n"        \
   "        paddusw   %%xmm15, %%xmm7         \n"        \
   "        movq      %5, %%r12               \n"        \
   "        shlq      $3, %%r12               \n"        \
@@ -280,7 +283,8 @@ inline void domasked16(__m128i * Sm,
                        __m128i * H0,
                        __m128i * Mm,
                        __m128i * MQ,
-                       __m128i * MR)
+                       __m128i * MR,
+                       __m128i * MQ0)
 {
   
   __asm__
@@ -298,6 +302,7 @@ inline void domasked16(__m128i * Sm,
      "        psubusw   (%10), %%xmm12           \n" // mask E
      "        paddusw   %%xmm13, %%xmm8          \n" // init N0
      "        paddusw   %%xmm13, %%xmm12         \n" // init E
+     "        paddusw   (%13), %%xmm12           \n" // fix E
      "        paddusw   (%12), %%xmm13           \n" // update
      "        movdqa    %%xmm13, (%11)           \n"
      
@@ -316,6 +321,7 @@ inline void domasked16(__m128i * Sm,
      "        psubusw   (%10), %%xmm12           \n" // mask E
      "        paddusw   %%xmm13, %%xmm0          \n"
      "        paddusw   %%xmm13, %%xmm12         \n"
+     "        paddusw   (%13), %%xmm12           \n" // fix E
      "        paddusw   (%12), %%xmm13           \n"
      "        movdqa    %%xmm13, (%11)           \n"
      
@@ -336,6 +342,7 @@ inline void domasked16(__m128i * Sm,
      "        movdqa    (%11), %%xmm13           \n"
      "        psubusw   (%10), %%xmm12           \n" // mask E
      "        paddusw   %%xmm13, %%xmm12         \n"
+     "        paddusw   (%13), %%xmm12           \n" // fix E
      "        paddusw   (%12), %%xmm13           \n"
      "        movdqa    %%xmm13, (%11)           \n"
      
@@ -368,7 +375,8 @@ inline void domasked16(__m128i * Sm,
      : "m"(Sm), "r"(hep),"r"(qp), "m"(Qm), 
        "m"(Rm), "r"(ql), "m"(Zm), "r"(F0),
        "r"(dir),
-       "m"(H0), "r"(Mm), "r"(MQ), "r"(MR)
+       "m"(H0), "r"(Mm), "r"(MQ), "r"(MR),
+       "r"(MQ0)
        
      : "xmm0",  "xmm1",  "xmm2",  "xmm3",
        "xmm4",  "xmm5",  "xmm6",  "xmm7",
@@ -402,18 +410,15 @@ unsigned long backtrack16(char * qseq,
   {
     for(unsigned long j=0; j<dlen; j++)
     {
-      unsigned long d = dirbuffer[(offset + longestdbsequence*4*(j/4) + 4*i + (j&3)) % dir
-                                  buffersize];
-      if (d & maskup)
+      unsigned long d = dirbuffer[(offset + longestdbsequence*4*(j/4)
+                                   + 4*i + (j&3)) % dirbuffersize];
+      if (d & maskleft)
       {
-        if (d & maskleft)
-          printf("+");
-        else
-          printf("^");
+        printf("<");
       }
-      else if (d & maskleft)
+      else if (d & maskup)
       {
-        printf("<");
+        printf("^");
       }
       else
       {
@@ -429,8 +434,8 @@ unsigned long backtrack16(char * qseq,
   {
     for(unsigned long j=0; j<dlen; j++)
     {
-      unsigned long d = dirbuffer[(offset + longestdbsequence*4*(j/4) + 4*i + (j&3)) % dir
-                                  buffersize];
+      unsigned long d = dirbuffer[(offset + longestdbsequence*4*(j/4)
+                                   + 4*i + (j&3)) % dirbuffersize];
       if (d & maskextup)
       {
         if (d & maskextleft)
@@ -458,6 +463,11 @@ unsigned long backtrack16(char * qseq,
   unsigned long matches = 0;
   char op = 0;
 
+#undef SHOWALIGNMENT
+#ifdef SHOWALIGNMENT
+  printf("alignment, reversed: ");
+#endif
+
   while ((i>=0) && (j>=0))
   {
     aligned++;
@@ -491,8 +501,34 @@ unsigned long backtrack16(char * qseq,
       j--;
       op = 'M';
     }
+
+#ifdef SHOWALIGNMENT
+    printf("%c", op);
+#endif
   }
-  aligned += i + j + 2;
+
+  while (i>=0)
+    {
+      aligned++;
+      i--;
+#ifdef SHOWALIGNMENT
+      printf("D");
+#endif
+    }
+
+  while (j>=0)
+    {
+      aligned++;
+      j--;
+#ifdef SHOWALIGNMENT
+      printf("I");
+#endif
+    }
+
+#ifdef SHOWALIGNMENT
+  printf("\n");
+#endif
+
   * alignmentlengthp = aligned;
   return aligned - matches;
 }
@@ -512,7 +548,7 @@ void search16(WORD * * q_start,
               unsigned long dirbuffersize,
               unsigned long * dirbuffer)
 {
-  __m128i Q, R, T, M, T0, MQ, MR;
+  __m128i Q, R, T, M, T0, MQ, MR, MQ0;
   __m128i *hep, **qp;
 
   BYTE * d_begin[CHANNELS];
@@ -672,7 +708,7 @@ void search16(WORD * * q_start,
             next_id++;
             
             ((WORD*)&H0)[c] = 0;
-            ((WORD*)&F0)[c] = gap_open_penalty + gap_extend_penalty;
+            ((WORD*)&F0)[c] = 2 * gap_open_penalty + 2 * gap_extend_penalty;
             
             
             // fill channel
@@ -712,16 +748,19 @@ void search16(WORD * * q_start,
           
       MQ = _mm_and_si128(M, Q);
       MR = _mm_and_si128(M, R);
+      MQ0 = MQ;
       
-      domasked16(S, hep, qp, &Q, &R, qlen, 0, &F0, dir, &H0, &M, &MQ, &MR);
+      domasked16(S, hep, qp, &Q, &R, qlen, 0, &F0, dir, &H0, &M, &MQ, &MR,
+                 &MQ0);
     }
     
     F0 = _mm_adds_epu16(F0, R);
     F0 = _mm_adds_epu16(F0, R);
     F0 = _mm_adds_epu16(F0, R);
-    H0 = F0;
+    H0 = _mm_subs_epu16(F0, Q);
     F0 = _mm_adds_epu16(F0, R);
 
+
     dir += 4*longestdbsequence;
     
     if (dir >= dirbuffer + dirbuffersize)
diff --git a/src/search8.cc b/src/search8.cc
index 25a52b5..423f521 100644
--- a/src/search8.cc
+++ b/src/search8.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
@@ -381,7 +381,7 @@ inline void dprofile_fill8(BYTE * dprofile,
     _mm_store_si128((__m128i*)(dprofile+16*j+1536+448), xmm15);
   }
 
-  //  dprofile_dump7(dprofile);
+  //  dprofile_dump8(dprofile);
 }
 
 
@@ -426,14 +426,17 @@ inline void dprofile_fill8(BYTE * dprofile,
   "        movq      %9, %%rax               \n"        \
   "        movdqa    (%%rax), %%xmm0         \n"        \
   "        movdqa    (%7), %%xmm7            \n"        \
+  "        movdqa    %%xmm7, %%xmm3          \n"        \
+  "        psubusb   %%xmm14, %%xmm3         \n"        \
+  "        movdqa    %%xmm3, %%xmm1          \n"        \
+  "        paddusb   %%xmm15, %%xmm3         \n"        \
+  "        movdqa    %%xmm3, %%xmm2          \n"        \
+  "        paddusb   %%xmm15, %%xmm3         \n"        \
   "        movdqa    %%xmm7, %%xmm4          \n"        \
-  "        movdqa    %%xmm7, %%xmm1          \n"        \
   "        paddusb   %%xmm15, %%xmm7         \n"        \
   "        movdqa    %%xmm7, %%xmm5          \n"        \
-  "        movdqa    %%xmm7, %%xmm2          \n"        \
   "        paddusb   %%xmm15, %%xmm7         \n"        \
   "        movdqa    %%xmm7, %%xmm6          \n"        \
-  "        movdqa    %%xmm7, %%xmm3          \n"        \
   "        paddusb   %%xmm15, %%xmm7         \n"        \
   "        movq      %5, %%r12               \n"        \
   "        shlq      $3, %%r12               \n"        \
@@ -441,14 +444,13 @@ inline void dprofile_fill8(BYTE * dprofile,
   "        andq      $-16, %%r10             \n"        \
   "        xorq      %%r11, %%r11            \n" 
 
-
 #define ONESTEP(H, N, F, V, DIR)                \
   "        paddusb   " V ", " H "          \n"  \
   "        movdqa    " H ", %%xmm13        \n"  \
-  "        pcmpgtb   " F ", %%xmm13        \n"  \
+  "        pminub    " F ", " H "          \n"  \
+  "        pcmpeqb   " H ", %%xmm13        \n"  \
   "        pmovmskb  %%xmm13, %%edx        \n"  \
   "        movw      %%dx, 0+" DIR "       \n"  \
-  "        pminub    " F ", " H "          \n"  \
   "        pminub    %%xmm12, " H "        \n"  \
   "        movdqa    " H ", %%xmm13        \n"  \
   "        pcmpeqb   %%xmm12, %%xmm13      \n"  \
@@ -459,15 +461,16 @@ inline void dprofile_fill8(BYTE * dprofile,
   "        paddusb   %%xmm15, " F "        \n"  \
   "        paddusb   %%xmm15, %%xmm12      \n"  \
   "        movdqa    " H ", %%xmm13        \n"  \
-  "        pcmpgtb   " F ", %%xmm13        \n"  \
+  "        pminub    " H ", " F "          \n"  \
+  "        pcmpeqb   " F ", %%xmm13        \n"  \
   "        pmovmskb  %%xmm13, %%edx        \n"  \
   "        movw      %%dx, 4+" DIR "       \n"  \
   "        movdqa    " H ", %%xmm13        \n"  \
-  "        pcmpgtb   %%xmm12, %%xmm13      \n"  \
-  "        pmovmskb  %%xmm13, %%edx        \n"  \
-  "        movw      %%dx, 6+" DIR "       \n"  \
   "        pminub    " H ", %%xmm12        \n"  \
-  "        pminub    " H ", " F "          \n"
+  "        pcmpeqb   %%xmm12, %%xmm13      \n"  \
+  "        pmovmskb  %%xmm13, %%edx        \n"  \
+  "        movw      %%dx, 6+" DIR "       \n"
+
 
 inline void donormal8(__m128i * Sm,
                       __m128i * hep,
@@ -567,7 +570,8 @@ inline void domasked8(__m128i * Sm,
                       __m128i * H0,
                       __m128i * Mm,
                       __m128i * MQ,
-                      __m128i * MR)
+                      __m128i * MR,
+                      __m128i * MQ0)
 {
   __asm__
     __volatile__
@@ -584,6 +588,7 @@ inline void domasked8(__m128i * Sm,
      "        psubusb   (%10), %%xmm12           \n" // mask E
      "        paddusb   %%xmm13, %%xmm8          \n" // init N0
      "        paddusb   %%xmm13, %%xmm12         \n" // init E
+     "        paddusb   (%13), %%xmm12           \n" // fix E
      "        paddusb   (%12), %%xmm13           \n" // update
      "        movdqa    %%xmm13, (%11)           \n"
      
@@ -602,6 +607,7 @@ inline void domasked8(__m128i * Sm,
      "        psubusb   (%10), %%xmm12           \n" // mask E
      "        paddusb   %%xmm13, %%xmm0          \n"
      "        paddusb   %%xmm13, %%xmm12         \n"
+     "        paddusb   (%13), %%xmm12           \n" // fix E
      "        paddusb   (%12), %%xmm13           \n"
      "        movdqa    %%xmm13, (%11)           \n"
      
@@ -622,6 +628,7 @@ inline void domasked8(__m128i * Sm,
      "        movdqa    (%11), %%xmm13           \n"
      "        psubusb   (%10), %%xmm12           \n" // mask E
      "        paddusb   %%xmm13, %%xmm12         \n"
+     "        paddusb   (%13), %%xmm12           \n" // fix E
      "        paddusb   (%12), %%xmm13           \n"
      "        movdqa    %%xmm13, (%11)           \n"
      
@@ -654,7 +661,7 @@ inline void domasked8(__m128i * Sm,
      : "m"(Sm), "r"(hep),"r"(qp), "m"(Qm), 
        "m"(Rm), "r"(ql), "m"(Zm), "r"(F0),
        "r"(dir),"m"(H0),
-       "r"(Mm), "r"(MQ), "r"(MR)
+       "r"(Mm), "r"(MQ), "r"(MR), "r"(MQ0)
        
      : "xmm0",  "xmm1",  "xmm2",  "xmm3",
        "xmm4",  "xmm5",  "xmm6",  "xmm7",
@@ -689,16 +696,13 @@ unsigned long backtrack(char * qseq,
     for(unsigned long j=0; j<dlen; j++)
     {
       unsigned long d = dirbuffer[(offset + longestdbsequence*4*(j/4) + 4*i + (j&3)) % dirbuffersize];
-      if (d & maskup)
+      if (d & maskleft)
       {
-        if (d & maskleft)
-          printf("+");
-        else
-          printf("^");
+        printf("<");
       }
-      else if (d & maskleft)
+      else if (!(d & maskup))
       {
-        printf("<");
+          printf("^");
       }
       else
       {
@@ -714,15 +718,16 @@ unsigned long backtrack(char * qseq,
   {
     for(unsigned long j=0; j<dlen; j++)
     {
-      unsigned long d = dirbuffer[(offset + longestdbsequence*4*(j/4) + 4*i + (j&3)) % dirbuffersize];
-      if (d & maskextup)
+      unsigned long d = dirbuffer[(offset + longestdbsequence*4*(j/4)
+                                   + 4*i + (j&3)) % dirbuffersize];
+      if (!(d & maskextup))
       {
-        if (d & maskextleft)
+        if (!(d & maskextleft))
           printf("+");
         else
           printf("^");
       }
-      else if (d & maskextleft)
+      else if (!(d & maskextleft))
       {
         printf("<");
       }
@@ -742,18 +747,23 @@ unsigned long backtrack(char * qseq,
   unsigned long matches = 0;
   char op = 0;
 
+#undef SHOWALIGNMENT
+#ifdef SHOWALIGNMENT
+  printf("alignment, reversed: ");
+#endif
+
   while ((i>=0) && (j>=0))
   {
     aligned++;
 
-    unsigned long d = 
-      dirbuffer[(offset + longestdbsequence*4*(j/4) + 4*i + (j&3)) % dirbuffersize];
+    unsigned long d = dirbuffer[(offset + longestdbsequence*4*(j/4)
+                                 + 4*i + (j&3)) % dirbuffersize];
 
-    if ((op == 'I') && (d & maskextleft))
+    if ((op == 'I') && (!(d & maskextleft)))
     {
       j--;
     }
-    else if ((op == 'D') && (d & maskextup))
+    else if ((op == 'D') && (!(d & maskextup)))
     {
       i--;
     }
@@ -762,7 +772,7 @@ unsigned long backtrack(char * qseq,
       j--;
       op = 'I';
     }
-    else if (d & maskup)
+    else if (!(d & maskup))
     {
       i--;
       op = 'D';
@@ -775,8 +785,35 @@ unsigned long backtrack(char * qseq,
       j--;
       op = 'M';
     }
+
+#ifdef SHOWALIGNMENT
+    printf("%c", op);
+#endif
+
   }
-  aligned += i + j + 2;
+
+  while (i>=0)
+    {
+      aligned++;
+      i--;
+#ifdef SHOWALIGNMENT
+      printf("D");
+#endif
+    }
+
+  while (j>=0)
+    {
+      aligned++;
+      j--;
+#ifdef SHOWALIGNMENT
+      printf("I");
+#endif
+    }
+
+#ifdef SHOWALIGNMENT
+  printf("\n");
+#endif
+
   * alignmentlengthp = aligned;
   return aligned - matches;
 }
@@ -796,7 +833,7 @@ void search8(BYTE * * q_start,
              unsigned long dirbuffersize,
              unsigned long * dirbuffer)
 {
-  __m128i Q, R, T, M, T0, MQ, MR;
+  __m128i Q, R, T, M, T0, MQ, MR, MQ0;
   __m128i *hep, **qp;
 
   BYTE * d_begin[CHANNELS];
@@ -954,7 +991,7 @@ void search8(BYTE * * q_start,
             next_id++;
             
             ((BYTE*)&H0)[c] = 0;
-            ((BYTE*)&F0)[c] = gap_open_penalty + gap_extend_penalty;
+            ((BYTE*)&F0)[c] = 2 * gap_open_penalty + 2 * gap_extend_penalty;
             
             // fill channel
             for(int j=0; j<CDEPTH; j++)
@@ -993,16 +1030,19 @@ void search8(BYTE * * q_start,
 
       MQ = _mm_and_si128(M, Q);
       MR = _mm_and_si128(M, R);
+      MQ0 = MQ;
       
-      domasked8(S, hep, qp, &Q, &R, qlen, 0, &F0, dir, &H0, &M, &MQ, &MR);
+      domasked8(S, hep, qp, &Q, &R, qlen, 0, &F0, dir, &H0, &M, &MQ, &MR,
+                &MQ0);
     }
     
     F0 = _mm_adds_epu8(F0, R);
     F0 = _mm_adds_epu8(F0, R);
     F0 = _mm_adds_epu8(F0, R);
-    H0 = F0;
+    H0 = _mm_subs_epu8(F0, Q);
     F0 = _mm_adds_epu8(F0, R);
 
+
     dir += 4*longestdbsequence;
     if (dir >= dirbuffer + dirbuffersize)
       dir -= dirbuffersize;
diff --git a/src/ssse3.cc b/src/ssse3.cc
index 03fb0df..503f91b 100644
--- a/src/ssse3.cc
+++ b/src/ssse3.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/swarm.cc b/src/swarm.cc
index 54af068..7abd2bc 100644
--- a/src/swarm.cc
+++ b/src/swarm.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
@@ -230,7 +230,7 @@ void args_usage()
 void show_header()
 {
   char title[] = "Swarm " SWARM_VERSION;
-  char ref[] = "Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe";
+  char ref[] = "Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe";
   char url[] = "https://github.com/torognes/swarm";
   fprintf(logfile, "%s [%s %s]\n%s\n%s\n\n",
           title, __DATE__, __TIME__, ref, url);
diff --git a/src/swarm.h b/src/swarm.h
index bcc84cd..866a877 100644
--- a/src/swarm.h
+++ b/src/swarm.h
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
@@ -52,7 +52,7 @@
 #define LINE_MAX 2048
 #endif
 
-#define SWARM_VERSION "2.1.10"
+#define SWARM_VERSION "2.1.12"
 #define WIDTH 32
 #define WIDTH_SHIFT 5
 #define BLOCKWIDTH 32
diff --git a/src/threads.h b/src/threads.h
index a7d475f..e6b017a 100644
--- a/src/threads.h
+++ b/src/threads.h
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as
diff --git a/src/util.cc b/src/util.cc
index c68667c..141cc76 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -1,7 +1,7 @@
 /*
     SWARM
 
-    Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
+    Copyright (C) 2012-2017 Torbjorn Rognes and Frederic Mahe
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/swarm-cluster.git



More information about the debian-med-commit mailing list