include/smithWatermanScoring.h File Reference

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

Go to the source code of this file.

Functions

dpResults smithWatermanScoring_score (struct PSSMatrix PSSMatrix, int4 subjectSize, unsigned char *subject)
dpResults smithWatermanScoring_scoreReverse (struct PSSMatrix PSSMatrix, int4 subjectSize, unsigned char *subject, struct coordinate end)


Function Documentation

struct dpResults smithWatermanScoring_score ( struct PSSMatrix  PSSMatrix,
int4  subjectSize,
unsigned char *  subject 
) [read]

Definition at line 21 of file smithWatermanScoring.c.

References dpResults::bestScore, PSSMatrix::length, PSSMatrix_chop(), and smithWatermanScoring_dynamicProgramming().

Referenced by search_nucleotideSsearch(), search_proteinSsearch(), and smithWatermanScoring_scoreReverse().

00023 {
00024         struct dpResults dpResults, dpResults2;
00025         struct PSSMatrix choppedPSSMatrix;
00026 
00027     // If there are two strands
00028     if (PSSMatrix.strandLength != PSSMatrix.length)
00029     {
00030         // Perform dynamic programming on first strand
00031         choppedPSSMatrix = PSSMatrix;
00032         choppedPSSMatrix.length = PSSMatrix.strandLength;
00033                 dpResults = smithWatermanScoring_dynamicProgramming(subject, choppedPSSMatrix, subjectSize);
00034 
00035         // Perform dynamic programming on second strand
00036         choppedPSSMatrix = PSSMatrix_chop(PSSMatrix, PSSMatrix.strandLength);
00037                 dpResults2 = smithWatermanScoring_dynamicProgramming(subject, choppedPSSMatrix, subjectSize);
00038                 dpResults2.best.queryOffset += PSSMatrix.strandLength;
00039 
00040         if (dpResults.bestScore > dpResults2.bestScore)
00041                 return dpResults;
00042         else
00043         {
00044 //              printf("[%d:%d,%d]", dpResults2.bestScore, dpResults2.best.queryOffset,
00045 //                                 dpResults2.best.subjectOffset);
00046                 return dpResults2;
00047                 }
00048     }
00049         else
00050     {
00051         // Perform dynamic programming
00052         dpResults = smithWatermanScoring_dynamicProgramming(subject, PSSMatrix, subjectSize);
00053 
00054 //      printf("Best=%d,%d Score=%d dloc=%d\n", dpResults.best.queryOffset, dpResults.best.subjectOffset,
00055 //                                              dpResults.bestScore, blast_dloc); fflush(stdout);
00056 
00057         return dpResults;
00058         }
00059 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct dpResults smithWatermanScoring_scoreReverse ( struct PSSMatrix  PSSMatrix,
int4  subjectSize,
unsigned char *  subject,
struct coordinate  end 
) [read]

Definition at line 63 of file smithWatermanScoring.c.

References dpResults::best, global_malloc(), PSSMatrix_chop(), PSSMatrix_freeCopy(), PSSMatrix_reverse(), coordinate::queryOffset, smithWatermanScoring_score(), coordinate::subjectOffset, and uint4.

Referenced by search_nucleotideSsearch(), and search_proteinSsearch().

00065 {
00066         unsigned char* reversedSubject;
00067         uint4 subjectPosition, strandOffset = 0;
00068     struct PSSMatrix reversedPSSMatrix;
00069         struct dpResults dpResults;
00070 
00071         end.queryOffset++;
00072         end.subjectOffset++;
00073         
00074     // If alignment is in the second strand
00075     if (end.queryOffset > PSSMatrix.strandLength)
00076     {
00077         // Remove first strand
00078         strandOffset = PSSMatrix.strandLength;
00079         end.queryOffset -= PSSMatrix.strandLength;
00080         PSSMatrix = PSSMatrix_chop(PSSMatrix, PSSMatrix.strandLength);
00081         }
00082 
00083     // Remove the end of the PSSM not containing the alignment
00084     PSSMatrix.strandLength = PSSMatrix.length = end.queryOffset;
00085 
00086     // Shorten the subject to region containing the alignment
00087     subjectSize = end.subjectOffset;
00088 
00089     // Make a reversed copy of the subject region containing the alignment
00090     reversedSubject = (unsigned char*)global_malloc(sizeof(char) * subjectSize);
00091         subjectPosition = 0;
00092     while (subjectPosition < subjectSize)
00093     {
00094         reversedSubject[subjectPosition] = subject[subjectSize - subjectPosition - 1];
00095         subjectPosition++;
00096     }
00097 
00098     // Reverse the PSSM
00099     reversedPSSMatrix = PSSMatrix_reverse(PSSMatrix);
00100 
00101     // Perform smith waterman on reversed sequences
00102         dpResults = smithWatermanScoring_score(reversedPSSMatrix, subjectSize, reversedSubject);
00103 
00104     dpResults.best.queryOffset = PSSMatrix.length - dpResults.best.queryOffset - 1;
00105     dpResults.best.subjectOffset = subjectSize - dpResults.best.subjectOffset - 1;
00106         dpResults.best.queryOffset += strandOffset;
00107 
00108     PSSMatrix_freeCopy(reversedPSSMatrix);
00109     free(reversedSubject);
00110 
00111     return dpResults;
00112 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Wed Dec 19 20:52:07 2007 for fsa-blast by  doxygen 1.5.2