Alignment: API rework. 'obi align' is now 'obi lcs', and the results are
now written to columns automatically created in the output view, all optimally handled at the C level.
This commit is contained in:
@ -62,7 +62,7 @@ static inline int extract_reg(__m128i r, int p)
|
||||
|
||||
|
||||
// TODO warning on length order
|
||||
void sse_banded_align_lcs_and_ali_len(int16_t* seq1, int16_t* seq2, int l1, int l2, int bandLengthLeft, int bandLengthTotal, int16_t* address, double* lcs_length, int* ali_length)
|
||||
void sse_banded_align_lcs_and_ali_len(int16_t* seq1, int16_t* seq2, int l1, int l2, int bandLengthLeft, int bandLengthTotal, int16_t* address, int* lcs_length, int* ali_length)
|
||||
{
|
||||
register int j;
|
||||
int k1, k2;
|
||||
@ -288,13 +288,12 @@ void sse_banded_align_lcs_and_ali_len(int16_t* seq1, int16_t* seq2, int l1, int
|
||||
|
||||
|
||||
// TODO warning on length order
|
||||
double sse_banded_align_just_lcs(int16_t* seq1, int16_t* seq2, int l1, int l2, int bandLengthLeft, int bandLengthTotal)
|
||||
void sse_banded_align_just_lcs(int16_t* seq1, int16_t* seq2, int l1, int l2, int bandLengthLeft, int bandLengthTotal, int* lcs_length)
|
||||
{
|
||||
register int j;
|
||||
int k1, k2;
|
||||
int diff;
|
||||
int l_reg, l_loc;
|
||||
int16_t l_lcs;
|
||||
int line;
|
||||
int numberOfRegistersPerLine;
|
||||
int numberOfRegistersFor3Lines;
|
||||
@ -330,7 +329,6 @@ double sse_banded_align_just_lcs(int16_t* seq1, int16_t* seq2, int l1, int l2, i
|
||||
{
|
||||
obi_set_errno(OBI_MALLOC_ERROR);
|
||||
obidebug(1, "\nError allocating memory for SSE registers for LCS alignment");
|
||||
return 0; // TODO DOUBLE_MIN?
|
||||
}
|
||||
|
||||
// preparer registres SSE
|
||||
@ -421,12 +419,10 @@ double sse_banded_align_just_lcs(int16_t* seq1, int16_t* seq2, int l1, int l2, i
|
||||
l_loc = l_loc - l_reg*8;
|
||||
|
||||
// extracting LCS from the registers :
|
||||
l_lcs = extract_reg((*(p_gap1+l_reg)).i, l_loc);
|
||||
*lcs_length = extract_reg((*(p_gap1+l_reg)).i, l_loc);
|
||||
|
||||
// freeing the registers
|
||||
free(SSEregisters);
|
||||
|
||||
return((double) l_lcs);
|
||||
}
|
||||
|
||||
|
||||
@ -561,11 +557,10 @@ void initializeAddressWithGaps(int16_t* address, int bandLengthTotal, int bandLe
|
||||
|
||||
|
||||
// TODO warning on length order
|
||||
double sse_banded_lcs_align(int16_t* seq1, int16_t* seq2, int l1, int l2, bool normalize, int reference, bool similarity_mode, int16_t* address, int LCSmin)
|
||||
double sse_banded_lcs_align(int16_t* seq1, int16_t* seq2, int l1, int l2, bool normalize, int reference, bool similarity_mode, int16_t* address, int LCSmin, int* lcs_length, int* ali_length)
|
||||
{
|
||||
double id;
|
||||
int bandLengthRight, bandLengthLeft, bandLengthTotal;
|
||||
int ali_length;
|
||||
|
||||
bandLengthLeft = calculateLeftBandLength(l1, LCSmin);
|
||||
bandLengthRight = calculateRightBandLength(l2, LCSmin);
|
||||
@ -579,10 +574,12 @@ double sse_banded_lcs_align(int16_t* seq1, int16_t* seq2, int l1, int l2, bool n
|
||||
if ((reference == ALILEN) && (normalize || !similarity_mode))
|
||||
{
|
||||
initializeAddressWithGaps(address, bandLengthTotal, bandLengthLeft, l1);
|
||||
sse_banded_align_lcs_and_ali_len(seq1, seq2, l1, l2, bandLengthLeft, bandLengthTotal, address, &id, &ali_length);
|
||||
sse_banded_align_lcs_and_ali_len(seq1, seq2, l1, l2, bandLengthLeft, bandLengthTotal, address, lcs_length, ali_length);
|
||||
}
|
||||
else
|
||||
id = sse_banded_align_just_lcs(seq1, seq2, l1, l2, bandLengthLeft, bandLengthTotal);
|
||||
sse_banded_align_just_lcs(seq1, seq2, l1, l2, bandLengthLeft, bandLengthTotal, lcs_length);
|
||||
|
||||
id = (double) *lcs_length;
|
||||
|
||||
// fprintf(stderr, "\nid before normalizations = %f", id);
|
||||
|
||||
@ -590,7 +587,7 @@ double sse_banded_lcs_align(int16_t* seq1, int16_t* seq2, int l1, int l2, bool n
|
||||
|
||||
if (!similarity_mode && !normalize)
|
||||
switch(reference) {
|
||||
case ALILEN: id = ali_length - id;
|
||||
case ALILEN: id = *ali_length - id;
|
||||
break;
|
||||
case MAXLEN: id = l1 - id;
|
||||
break;
|
||||
@ -600,7 +597,7 @@ double sse_banded_lcs_align(int16_t* seq1, int16_t* seq2, int l1, int l2, bool n
|
||||
// fprintf(stderr, "\n2>>> %f, %d\n", id, ali_length);
|
||||
if (normalize)
|
||||
switch(reference) {
|
||||
case ALILEN: id = id / (double) ali_length;
|
||||
case ALILEN: id = id / (double) *ali_length;
|
||||
break;
|
||||
case MAXLEN: id = id / (double) l1;
|
||||
break;
|
||||
@ -643,7 +640,7 @@ int calculateLCSmin(int l1, int l2, double threshold, bool normalize, int refere
|
||||
}
|
||||
|
||||
|
||||
double generic_sse_banded_lcs_align(char* seq1, char* seq2, double threshold, bool normalize, int reference, bool similarity_mode)
|
||||
double generic_sse_banded_lcs_align(char* seq1, char* seq2, double threshold, bool normalize, int reference, bool similarity_mode, int* lcs_length, int* ali_length)
|
||||
{
|
||||
double id;
|
||||
int l1, l2;
|
||||
@ -718,14 +715,14 @@ double generic_sse_banded_lcs_align(char* seq1, char* seq2, double threshold, bo
|
||||
putSeqInSeq(iseq1, seq2, l2, TRUE);
|
||||
putSeqInSeq(iseq2, seq1, l1, FALSE);
|
||||
// Compute alignment
|
||||
id = sse_banded_lcs_align(iseq1, iseq2, l2, l1, normalize, reference, similarity_mode, address, LCSmin);
|
||||
id = sse_banded_lcs_align(iseq1, iseq2, l2, l1, normalize, reference, similarity_mode, address, LCSmin, lcs_length, ali_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
putSeqInSeq(iseq1, seq1, l1, TRUE);
|
||||
putSeqInSeq(iseq2, seq2, l2, FALSE);
|
||||
// Compute alignment
|
||||
id = sse_banded_lcs_align(iseq1, iseq2, l1, l2, normalize, reference, similarity_mode, address, LCSmin);
|
||||
id = sse_banded_lcs_align(iseq1, iseq2, l1, l2, normalize, reference, similarity_mode, address, LCSmin, lcs_length, ali_length);
|
||||
}
|
||||
|
||||
// Free allocated elements
|
||||
@ -738,7 +735,7 @@ double generic_sse_banded_lcs_align(char* seq1, char* seq2, double threshold, bo
|
||||
}
|
||||
|
||||
|
||||
double obiblob_sse_banded_lcs_align(Obi_blob_p seq1, Obi_blob_p seq2, double threshold, bool normalize, int reference, bool similarity_mode)
|
||||
double obiblob_sse_banded_lcs_align(Obi_blob_p seq1, Obi_blob_p seq2, double threshold, bool normalize, int reference, bool similarity_mode, int* lcs_length, int* ali_length)
|
||||
{
|
||||
double id;
|
||||
int l1, l2;
|
||||
@ -813,14 +810,14 @@ double obiblob_sse_banded_lcs_align(Obi_blob_p seq1, Obi_blob_p seq2, double thr
|
||||
putBlobInSeq(iseq1, seq2, l2, TRUE);
|
||||
putBlobInSeq(iseq2, seq1, l1, FALSE);
|
||||
// Compute alignment
|
||||
id = sse_banded_lcs_align(iseq1, iseq2, l2, l1, normalize, reference, similarity_mode, address, LCSmin);
|
||||
id = sse_banded_lcs_align(iseq1, iseq2, l2, l1, normalize, reference, similarity_mode, address, LCSmin, lcs_length, ali_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
putBlobInSeq(iseq1, seq1, l1, TRUE);
|
||||
putBlobInSeq(iseq2, seq2, l2, FALSE);
|
||||
// Compute alignment
|
||||
id = sse_banded_lcs_align(iseq1, iseq2, l1, l2, normalize, reference, similarity_mode, address, LCSmin);
|
||||
id = sse_banded_lcs_align(iseq1, iseq2, l1, l2, normalize, reference, similarity_mode, address, LCSmin, lcs_length, ali_length);
|
||||
}
|
||||
|
||||
// Free allocated elements
|
||||
|
Reference in New Issue
Block a user