1
/* $Id: na_ungapped.c,v 1.39 2010/07/27 18:24:31 kazimird Exp $
1
/* $Id: na_ungapped.c,v 1.43 2011/07/12 17:54:32 kazimird Exp $
2
2
* ===========================================================================
4
4
* PUBLIC DOMAIN NOTICE
31
31
#ifndef SKIP_DOXYGEN_PROCESSING
32
32
static char const rcsid[] =
33
"$Id: na_ungapped.c,v 1.39 2010/07/27 18:24:31 kazimird Exp $";
33
"$Id: na_ungapped.c,v 1.43 2011/07/12 17:54:32 kazimird Exp $";
34
34
#endif /* SKIP_DOXYGEN_PROCESSING */
36
36
#include <algo/blast/core/na_ungapped.h>
710
710
Int4 context = BSearchContextInfo(q_off, query_info);
711
711
cutoffs = word_params->cutoffs + context;
712
712
ungapped_data = &dummy_ungapped_data;
713
s_NuclUngappedExtend(query, subject, matrix, q_off, s_end, s_off,
715
* Skip use of the scoring table and go straight to the matrix
716
* based extension if matrix_only_scoring is set. Used by
720
if ( word_params->options->program_number == eBlastTypeBlastn &&
721
word_params->matrix_only_scoring )
723
s_NuclUngappedExtendExact(query, subject, matrix, q_off,
724
s_off, -(cutoffs->x_dropoff), ungapped_data);
726
s_NuclUngappedExtend(query, subject, matrix, q_off, s_end, s_off,
714
727
-(cutoffs->x_dropoff), ungapped_data,
715
728
word_params->nucl_score_table,
716
729
cutoffs->reduced_nucl_cutoff_score);
718
732
if (off_found || ungapped_data->score >= cutoffs->cutoff_score) {
719
733
BlastUngappedData *final_data =
865
879
Int4 context = BSearchContextInfo(q_off, query_info);
866
880
cutoffs = word_params->cutoffs + context;
867
881
ungapped_data = &dummy_ungapped_data;
868
s_NuclUngappedExtend(query, subject, matrix, q_off, s_end,
884
* Skip use of the scoring table and go straight to the matrix
885
* based extension if matrix_only_scoring is set. Used by
889
if ( word_params->options->program_number == eBlastTypeBlastn && word_params->matrix_only_scoring )
891
s_NuclUngappedExtendExact(query, subject, matrix, q_off,
892
s_off, -(cutoffs->x_dropoff), ungapped_data);
894
s_NuclUngappedExtend(query, subject, matrix, q_off, s_end,
869
895
s_off, -(cutoffs->x_dropoff),
871
897
word_params->nucl_score_table,
872
898
cutoffs->reduced_nucl_cutoff_score);
873
901
if (off_found || ungapped_data->score >= cutoffs->cutoff_score) {
874
902
BlastUngappedData *final_data =
875
903
(BlastUngappedData *) malloc(sizeof(BlastUngappedData));
1350
1378
technically be negative, but the compressed version
1351
1379
of the query has extra pad bytes before q[0] */
1381
if ( (s_offset > 0) && (q_offset > 0) ) {
1354
1382
Uint1 q_byte = q[q_offset - 4];
1355
1383
Uint1 s_byte = s[s_offset / COMPRESSION_RATIO - 1];
1356
1384
ext_left = s_ExactMatchExtendLeft[q_byte ^ s_byte];
1360
1388
/* look for up to 4 exact matches to the right of the seed */
1362
if (ext_left < ext_to) {
1390
if ((ext_left < ext_to) && ((q_offset + lut_word_length) < query->length)) {
1363
1391
Uint1 q_byte = q[q_offset + lut_word_length];
1364
1392
Uint1 s_byte = s[(s_offset + lut_word_length) / COMPRESSION_RATIO];
1365
1393
Int4 ext_right = s_ExactMatchExtendRight[q_byte ^ s_byte];
1583
1611
scan_range[2] = subject->length - lut_word_length; /*end pos (inclusive) of scan*/
1585
1613
/* if sequence is masked, fall back to generic scanner and extender */
1586
if (subject->mask_type) {
1587
scansub = (TNaScanSubjectFunction)
1614
if (subject->mask_type != eNoSubjMasking) {
1615
if (lookup_wrap->lut_type == eMBLookupTable &&
1616
((BlastMBLookupTable *) lookup_wrap->lut)->discontiguous) {
1617
/* discontiguous scan subs assumes any (non-aligned starting offset */
1619
scansub = (TNaScanSubjectFunction)
1588
1620
BlastChooseNucleotideScanSubjectAny(lookup_wrap);
1589
if (extend != (TNaExtendFunction)s_BlastNaExtendDirect) {
1590
extend = (lookup_wrap->lut_type == eSmallNaLookupTable)
1621
if (extend != (TNaExtendFunction)s_BlastNaExtendDirect) {
1622
extend = (lookup_wrap->lut_type == eSmallNaLookupTable)
1591
1623
? (TNaExtendFunction)s_BlastSmallNaExtend
1592
1624
: (TNaExtendFunction)s_BlastNaExtend;
1594
1627
/* generic scanner permits any (non-aligned) starting offset */
1595
1628
scan_range[1] = subject->seq_ranges[0].left + word_length - lut_word_length;