7987
Function to check that the highest scoring region in an HSP still gives a positive
7988
score. This value was originally calcualted by GetStartForGappedAlignment but it
7989
may have changed due to the introduction of ambiguity characters. Such a change
7990
can lead to 'strange' results from ALIGN.
7994
Check whether the starting point for gapped alignment lies in
7995
region that has positive score. This routine is called after a
7996
preliminary gapped alignment has been computed, but before the
7997
traceback is computed. The score of the region containing the
7998
starting point may have changed due to the introduction of
7999
ambiguity characters, further filtering of the sequences or the
8000
application of composition based statistics.
8002
Usually, we check an ungapped alignment of length 11 about the
8003
starting point: 5 characters to the left and 5 to the right.
8004
However, the actual region checked is occassionally shorter because
8005
we don't check characters before the start, or after the end, of
8006
the preliminarily aligned regions in the query or subject.
7993
CheckStartForGappedAlignment (BlastSearchBlkPtr search, BLAST_HSPPtr hsp, Uint1Ptr query, Uint1Ptr subject, Int4Ptr PNTR matrix)
8009
CheckStartForGappedAlignment (BlastSearchBlkPtr search, BLAST_HSPPtr hsp,
8010
Uint1Ptr query, Uint1Ptr subject,
8011
Int4Ptr PNTR matrix)
7995
Int4 index1, score, start, end, width;
7996
Uint1Ptr query_var, subject_var;
7997
Boolean positionBased =
7998
(search->positionBased && search->sbp->posMatrix);
8000
width = MIN((hsp->query.gapped_start-hsp->query.offset), HSP_MAX_WINDOW/2);
8001
start = hsp->query.gapped_start - width;
8002
end = MIN(hsp->query.end, hsp->query.gapped_start + width);
8003
/* Assures that the start of subject is above zero. */
8004
if ((hsp->subject.gapped_start + start - hsp->query.gapped_start) < 0)
8005
start -= hsp->subject.gapped_start + (start - hsp->query.gapped_start);
8006
query_var = query + start;
8007
subject_var = subject + hsp->subject.gapped_start + (start - hsp->query.gapped_start);
8009
for (index1=start; index1<end; index1++)
8012
score += matrix[*query_var][*subject_var];
8014
score += search->sbp->posMatrix[index1][*subject_var];
8015
query_var++; subject_var++;
8013
Int4 left, right; /* Number of aligned characters to the
8014
left and right of the starting point */
8015
Int4 score; /* Score of the word alignment */
8016
Uint1Ptr subject_var; /* Current character in the subject sequence */
8017
Uint1Ptr subject_right; /* last character to be considered in the subject
8019
Boolean positionBased =
8020
(search->positionBased && search->sbp->posMatrix);
8022
/* Compute the number of characters to the left of the start
8023
to include in the word */
8024
left = -HSP_MAX_WINDOW/2;
8025
if (left < hsp->query.offset - hsp->query.gapped_start) {
8026
left = hsp->query.offset - hsp->query.gapped_start;
8028
if (left < hsp->subject.offset - hsp->subject.gapped_start) {
8029
left = hsp->subject.offset - hsp->subject.gapped_start;
8032
/* Compute the number of characters to right to include in the word,
8033
including the starting point itself. */
8034
right = HSP_MAX_WINDOW/2 + 1;
8035
if (right > hsp->query.end - hsp->query.gapped_start) {
8036
right = hsp->query.end - hsp->query.gapped_start;
8038
if (right > hsp->subject.end - hsp->subject.gapped_start) {
8039
right = hsp->subject.end - hsp->subject.gapped_start;
8042
/* Calculate the score of the word */
8044
subject_var = subject + hsp->subject.gapped_start + left;
8045
subject_right = subject + hsp->subject.gapped_start + right;
8046
if ( !positionBased ) {
8047
Uint1Ptr query_var; /* Current character in the query */
8048
query_var = query + hsp->query.gapped_start + left;
8049
for ( ; subject_var < subject_right; subject_var++, query_var++) {
8050
score += matrix[*query_var][*subject_var];
8053
Int4 query_index; /* Current position in the query */
8054
query_index = hsp->query.gapped_start + left;
8055
for ( ; subject_var < subject_right; subject_var++, query_index++) {
8056
score += search->sbp->posMatrix[query_index][*subject_var];
8023
8068
Gets the ratio used to change an evalue calculated with the subject
8024
8069
sequence length to one with a db length.