include/bytepackGappedScoring.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int4 bytepackGappedScoring_score (struct ungappedExtension *ungappedExtension, struct PSSMatrix PSSMatrix, int4 subjectSize, unsigned char *packedSubject, int4 dropoff)
void bytepackGappedScoring_free ()


Function Documentation

void bytepackGappedScoring_free (  ) 

Definition at line 736 of file bytepackGappedScoring.c.

References bytepackGappedScoring_bestRows, and bytepackGappedScoring_insertQrow.

Referenced by main().

00737 {
00738     free(bytepackGappedScoring_bestRows[0]);
00739     free(bytepackGappedScoring_bestRows[1]);
00740     free(bytepackGappedScoring_insertQrow);
00741 }

Here is the caller graph for this function:

int4 bytepackGappedScoring_score ( struct ungappedExtension ungappedExtension,
struct PSSMatrix  PSSMatrix,
int4  subjectSize,
unsigned char *  packedSubject,
int4  dropoff 
)

Definition at line 23 of file bytepackGappedScoring.c.

References dpResults::best, dpResults::bestScore, blast_dloc, blast_numSemiGapped, PSSMatrix::bytePackedCodes, bytepackGappedScoring_dpAfterSeed(), bytepackGappedScoring_dpBeforeSeed(), ungappedExtension::end, fasterBytepackGappedScoring_dpAfterSeed(), fasterBytepackGappedScoring_dpBeforeSeed(), int4, PSSMatrix::length, ungappedExtension::nominalScore, parameters_bytepackDropoffDecrease, parameters_bytepackStartGap, parameters_verboseDloc, PSSMatrix_chop(), PSSMatrix_packedScore, coordinate::queryOffset, ungappedExtension::seed, ungappedExtension::start, PSSMatrix::strandLength, and coordinate::subjectOffset.

Referenced by alignments_findGoodAlignments().

00025 {
00026     struct coordinate seed;
00027     unsigned char *choppedSubject;
00028     struct PSSMatrix choppedPSSMatrix;
00029     int4 choppedSubjectSize, score, packedSubjectSize;
00030     struct dpResults beforeDpResults, afterDpResults;
00031     int4 strandOffset = 0;
00032 
00033     // Increment counter number of HSP's semi-gapped
00034         blast_numSemiGapped++;
00035 
00036     dropoff -= parameters_bytepackDropoffDecrease;
00037 
00038     // Calculate packed subject size
00039     packedSubjectSize = (subjectSize + 3) / 4;
00040 
00041     seed = ungappedExtension->seed;
00042     if (seed.queryOffset > PSSMatrix.strandLength)
00043     {
00044             // If query position is in the second strand, remove first strand from PSSM
00045         strandOffset = PSSMatrix.strandLength;
00046                 seed.queryOffset -= PSSMatrix.strandLength;
00047                 PSSMatrix = PSSMatrix_chop(PSSMatrix, PSSMatrix.strandLength);
00048 
00049         #ifdef VERBOSE
00050         if (parameters_verboseDloc == blast_dloc)
00051                         printf("Second stand qLength=%d seed=%d,%d\n", PSSMatrix.length,
00052                    seed.queryOffset, seed.subjectOffset);
00053         #endif
00054     }
00055     else
00056     {
00057         // Otherwise remove second strand
00058         PSSMatrix.length = PSSMatrix.strandLength;
00059     }
00060 
00061     // Adjust to point to start of byte
00062     seed.queryOffset -= 2;
00063     seed.subjectOffset -= 2;
00064 
00065 //    printf("Was %d,%d to %d,%d\n", ungappedExtension->start.queryOffset, ungappedExtension->start.subjectOffset,
00066 //      ungappedExtension->end.queryOffset, ungappedExtension->end.subjectOffset);
00067 //    printf("seed=%d,%d\n", seed.queryOffset, seed.subjectOffset); fflush(stdout);
00068 
00069     // Update the seed to point to byte-packed sequences
00070         seed.subjectOffset /= 4;
00071 
00072     // Perform dynamic programming for points before the seed
00073     if (parameters_bytepackStartGap == 0)
00074     {
00075         beforeDpResults = fasterBytepackGappedScoring_dpBeforeSeed(packedSubject, PSSMatrix,
00076                                                                    seed, dropoff);
00077     }
00078     else
00079     {
00080         beforeDpResults = bytepackGappedScoring_dpBeforeSeed(packedSubject, PSSMatrix,
00081                                                              seed, dropoff);
00082         }
00083 
00084         // Adjust starting position to point to non-bytepacked subject
00085         beforeDpResults.best.subjectOffset *= 4;
00086 
00087     // Chop the start off the query and subject so they begin at the seed
00088     choppedPSSMatrix = PSSMatrix_chop(PSSMatrix, seed.queryOffset);
00089     choppedSubject = packedSubject + seed.subjectOffset;
00090     choppedSubjectSize = packedSubjectSize - seed.subjectOffset;
00091 
00092     // Perform dynamic programming for points after the seed
00093     if (parameters_bytepackStartGap == 0)
00094     {
00095         afterDpResults = fasterBytepackGappedScoring_dpAfterSeed(choppedSubject, choppedPSSMatrix,
00096                                                                  dropoff, choppedSubjectSize);
00097         }
00098     else
00099     {
00100         afterDpResults = bytepackGappedScoring_dpAfterSeed(choppedSubject, choppedPSSMatrix,
00101                                                            dropoff, choppedSubjectSize);
00102     }
00103 
00104     // Re-adjust result change due to chopping subject/query and strand adjustment
00105     afterDpResults.best.queryOffset += seed.queryOffset + strandOffset;
00106     afterDpResults.best.subjectOffset = (afterDpResults.best.subjectOffset + seed.subjectOffset) * 4;
00107     beforeDpResults.best.queryOffset += strandOffset;
00108 
00109     // Extend out ends slightly
00110         beforeDpResults.best.queryOffset -= 2;
00111         beforeDpResults.best.subjectOffset -= 2;
00112         afterDpResults.best.queryOffset += 6;
00113         afterDpResults.best.subjectOffset += 6;
00114 
00115     #ifdef VERBOSE
00116     if (parameters_verboseDloc == blast_dloc)
00117         printf("bytepacked[%d,%d,%d] (seed=%d,%d)\n", beforeDpResults.bestScore, afterDpResults.bestScore,
00118         PSSMatrix_packedScore[choppedPSSMatrix.bytePackedCodes[0] ^ choppedSubject[0]], seed.queryOffset,
00119         seed.subjectOffset * 4);
00120         #endif
00121 
00122     // Determine score by combining score from the two traces, and the match score at
00123     // the seed position
00124     score = beforeDpResults.bestScore + afterDpResults.bestScore +
00125             PSSMatrix_packedScore[choppedPSSMatrix.bytePackedCodes[0] ^ choppedSubject[0]];
00126 
00127         // Use ungapped alignment score and endpoints if better
00128     if (ungappedExtension->nominalScore > score)
00129     {
00130         score = ungappedExtension->nominalScore;
00131         }
00132     else
00133     {
00134         // Associate best scoring start and end points with the ungapped extension
00135         ungappedExtension->start = beforeDpResults.best;
00136         ungappedExtension->end = afterDpResults.best;
00137     }
00138 
00139     return score;
00140 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Wed Dec 19 20:48:55 2007 for fsa-blast by  doxygen 1.5.2