Skip to content

Commit

Permalink
SWIPE 2.0.11 - Fix for very high scoring alignments
Browse files Browse the repository at this point in the history
  • Loading branch information
torognes committed Jun 27, 2014
1 parent e016424 commit 47390cb
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 8 deletions.
10 changes: 10 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2014-06-27 Torbjorn Rognes <[email protected]>
* Version 2.0.11
* Resolved a bug that resulted in SWIPE terminating with a fatal
internal error in the align function. After recomputing an alignment
score > 32768 with 16-bit magnitude, a subsequent 16-bit score
computation could be wrong.
* Reduced memory usage when a the number of alignments or results
asked for using the -b and -v options was higher than the possible
maximum number.

2014-06-25 Torbjorn Rognes <[email protected]>
* Version 2.0.10
* Resolved an inconsistency in SWIPE with custom non-symmetric
Expand Down
Binary file modified Linux/mpiswipe
Binary file not shown.
Binary file modified Linux/swipe
Binary file not shown.
Binary file modified Mac/mpiswipe
Binary file not shown.
Binary file modified Mac/swipe
Binary file not shown.
30 changes: 29 additions & 1 deletion hits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SWIPE
Smith-Waterman database searches with Inter-sequence Parallel Execution
Copyright (C) 2008-2013 Torbjorn Rognes, University of Oslo,
Copyright (C) 2008-2014 Torbjorn Rognes, University of Oslo,
Oslo University Hospital and Sencel Bioinformatics AS
This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -285,6 +285,34 @@ void hits_init(long descriptions, long alignments, long minscore, long maxscore,
opt_descriptions = descriptions;
opt_alignments = alignments;
keephits = descriptions > alignments ? descriptions : alignments;

long maxhits = db_getseqcount_masked();
if (symtype == 0)
{
if (querystrands == 3)
maxhits *= 2;
}
else if (symtype == 2)
{
if (querystrands == 3)
maxhits *= 6;
else
maxhits *= 3;
}
else if (symtype == 3)
{
maxhits *= 6;
}
else if (symtype == 4)
{
if (querystrands == 3)
maxhits *= 36;
else
maxhits *= 18;
}

if (keephits > maxhits)
keephits = maxhits;

obvious = 0;
hits_count = 0;
Expand Down
16 changes: 13 additions & 3 deletions search16.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SWIPE
Smith-Waterman database searches with Inter-sequence Parallel Execution
Copyright (C) 2008-2013 Torbjorn Rognes, University of Oslo,
Copyright (C) 2008-2014 Torbjorn Rognes, University of Oslo,
Oslo University Hospital and Sencel Bioinformatics AS
This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -187,13 +187,16 @@ inline void domasked16(volatile __m128i * Sm,
"## domasked16 \n"
INITIALIZE
" paddsw (%7), %%xmm13 \n" // add M
" paddsw (%7), %%xmm13 \n" // add M
" jmp 2f \n"

"1: movq 0(%2,%%r11,1), %%rax \n" // load x from qp[qi]
" movdqa 0(%1,%%r11,4), %%xmm8 \n" // load N0
" paddsw (%7), %%xmm8 \n" // add M
" paddsw (%7), %%xmm8 \n" // add M
" movdqa 16(%1,%%r11,4), %%xmm12 \n" // load E
" paddsw (%7), %%xmm12 \n" // add M
" paddsw (%7), %%xmm12 \n" // add M

ONESTEP("%%xmm0", "%%xmm9", "%%xmm4", "0" )
ONESTEP("%%xmm1", "%%xmm10", "%%xmm5", "16")
Expand All @@ -204,8 +207,10 @@ inline void domasked16(volatile __m128i * Sm,
" movq 8(%2,%%r11,1), %%rax \n" // load x from qp[qi+1]
" movdqa 32(%1,%%r11,4), %%xmm0 \n" // load H0
" paddsw (%7), %%xmm0 \n" // add M
" paddsw (%7), %%xmm0 \n" // add M
" movdqa 48(%1,%%r11,4), %%xmm12 \n" // load E
" paddsw (%7), %%xmm12 \n" // add M
" paddsw (%7), %%xmm12 \n" // add M

ONESTEP("%%xmm8", "%%xmm1", "%%xmm4", "0" )
ONESTEP("%%xmm9", "%%xmm2", "%%xmm5", "16")
Expand All @@ -222,6 +227,7 @@ inline void domasked16(volatile __m128i * Sm,
" movq 0(%2,%%r11,1), %%rax \n" // load x from qp[qi]
" movdqa 16(%1,%%r11,4), %%xmm12 \n" // load E
" paddsw (%7), %%xmm12 \n" // add M
" paddsw (%7), %%xmm12 \n" // add M

ONESTEP("%%xmm0", "%%xmm9", "%%xmm4", "0" )
ONESTEP("%%xmm1", "%%xmm10", "%%xmm5", "16")
Expand Down Expand Up @@ -404,7 +410,7 @@ void search16(WORD * * q_start,

int mask = _mm_movemask_epi8(_mm_cmpgt_epi16((__m128i)S, SL));
for(int c=0; c<CHANNELS; c++)
if (mask & (1 << 2*c))
if (mask & (3 << 2*c))
d_best[c] = d_pos[c];

#ifdef DEBUG
Expand Down Expand Up @@ -512,14 +518,18 @@ void search16(WORD * * q_start,

/* save column address if new highscore */

SL = _mm_adds_epi16(SL, M);
SL = _mm_adds_epi16(SL, M);
int mask = _mm_movemask_epi8(_mm_cmpgt_epi16((__m128i)S, SL));
for(int c=0; c<CHANNELS; c++)
if (mask & (1 << 2*c))
if (mask & (3 << 2*c))
d_best[c] = d_pos[c];

#ifdef DEBUG
printf("H mask=%04x\n", mask);
printf("M =");
vector_print_word((WORD*)&M);
printf("\n");
printf("SL=");
vector_print_word((WORD*)&SL);
printf("\nS =");
Expand Down
9 changes: 8 additions & 1 deletion search16s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SWIPE
Smith-Waterman database searches with Inter-sequence Parallel Execution
Copyright (C) 2008-2013 Torbjorn Rognes, University of Oslo,
Copyright (C) 2008-2014 Torbjorn Rognes, University of Oslo,
Oslo University Hospital and Sencel Bioinformatics AS
This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -175,22 +175,27 @@ inline void domasked16s(volatile __m128i * Sm,
"## domasked16 \n"
INITIALIZE
" paddsw (%7), %%xmm13 \n" // add M
" paddsw (%7), %%xmm13 \n" // add M
" jmp 2f \n"

"1: movq 0(%2,%%r11,1), %%rax \n" // load x from qp[qi]
" movdqa 0(%1,%%r11,4), %%xmm8 \n" // load N0
" paddsw (%7), %%xmm8 \n" // add M
" paddsw (%7), %%xmm8 \n" // add M
" movdqa 16(%1,%%r11,4), %%xmm12 \n" // load E
" paddsw (%7), %%xmm12 \n" // add M
" paddsw (%7), %%xmm12 \n" // add M

ONESTEP("%%xmm0", "0(%1,%%r11,4)", "%%xmm4", "0" )

" movdqa %%xmm12, 16(%1,%%r11,4) \n" // save E
" movq 8(%2,%%r11,1), %%rax \n" // load x from qp[qi+1]
" movdqa 32(%1,%%r11,4), %%xmm0 \n" // load H0
" paddsw (%7), %%xmm0 \n" // add M
" paddsw (%7), %%xmm0 \n" // add M
" movdqa 48(%1,%%r11,4), %%xmm12 \n" // load E
" paddsw (%7), %%xmm12 \n" // add M
" paddsw (%7), %%xmm12 \n" // add M

ONESTEP("%%xmm8", "32(%1,%%r11,4)", "%%xmm4", "0" )

Expand All @@ -204,6 +209,7 @@ inline void domasked16s(volatile __m128i * Sm,
" movq 0(%2,%%r11,1), %%rax \n" // load x from qp[qi]
" movdqa 16(%1,%%r11,4), %%xmm12 \n" // load E
" paddsw (%7), %%xmm12 \n" // add M
" paddsw (%7), %%xmm12 \n" // add M

ONESTEP("%%xmm0", "0(%1,%%r11,4)", "%%xmm4", "0" )

Expand Down Expand Up @@ -505,6 +511,7 @@ void search16s(WORD * * q_start,

/* save column address if new highscore */

SL = _mm_adds_epi16(SL, M);
SL = _mm_adds_epi16(SL, M);
int mask = _mm_movemask_epi8(_mm_cmpgt_epi16((__m128i)S, SL));
if (mask)
Expand Down
4 changes: 2 additions & 2 deletions search7.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SWIPE
Smith-Waterman database searches with Inter-sequence Parallel Execution
Copyright (C) 2008-2013 Torbjorn Rognes, University of Oslo,
Copyright (C) 2008-2014 Torbjorn Rognes, University of Oslo,
Oslo University Hospital and Sencel Bioinformatics AS
This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -616,7 +616,7 @@ inline void donormal7(__m128i * Sm,
__asm__
__volatile__
(
"## donomal7 \n"
"## donormal7 \n"
INITIALIZE
" jmp 2f \n"

Expand Down
2 changes: 1 addition & 1 deletion swipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#define LINE_MAX 2048
#endif

#define SWIPE_VERSION "2.0.10"
#define SWIPE_VERSION "2.0.11"

// Should be 32bits integer
typedef unsigned int UINT32;
Expand Down

0 comments on commit 47390cb

Please sign in to comment.