#include "blast.h"Include dependency graph for identityAlign.c:

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

Go to the source code of this file.
Defines | |
| #define | maximum(a, b) ((a > b) ? a : b) |
Functions | |
| void | identityAlign_print (int4 bandStart, int4 bandEnd, int4 seqEnd) |
| int4 | identityAlign_score (unsigned char *seq1, int4 length1, unsigned char *seq2, int4 length2, int4 relativeOffset, uint4 targetScore) |
| void | identityAlign_free () |
Variables | |
| int4 * | identityAlign_bestRow = NULL |
| int4 | identityAlign_rowSizes = 0 |
| #define maximum | ( | a, | |||
| b | ) | ((a > b) ? a : b) |
Definition at line 14 of file identityAlign.c.
| void identityAlign_free | ( | ) |
Definition at line 157 of file identityAlign.c.
References identityAlign_bestRow.
Referenced by main().
00158 { 00159 free(identityAlign_bestRow); 00160 }
Here is the caller graph for this function:

| void identityAlign_print | ( | int4 | bandStart, | |
| int4 | bandEnd, | |||
| int4 | seqEnd | |||
| ) |
Definition at line 137 of file identityAlign.c.
References identityAlign_bestRow, and int4.
00138 { 00139 int4 count = 0; 00140 // printf("[%d,%d,%d]", bandStart, bandEnd, seqEnd); fflush(stdout); 00141 00142 while (count < bandStart) 00143 { 00144 printf(" "); 00145 count++; 00146 } 00147 00148 while (count < bandEnd && count < seqEnd) 00149 { 00150 printf("%3d ", identityAlign_bestRow[count]); 00151 count++; 00152 } 00153 00154 printf("\n"); 00155 }
| int4 identityAlign_score | ( | unsigned char * | seq1, | |
| int4 | length1, | |||
| unsigned char * | seq2, | |||
| int4 | length2, | |||
| int4 | relativeOffset, | |||
| uint4 | targetScore | |||
| ) |
Definition at line 22 of file identityAlign.c.
References global_malloc(), identityAlign_bestRow, identityAlign_rowSizes, int4, and maximum.
Referenced by rsdb_score().
00024 { 00025 unsigned char *position1, *bestPosition1, *end1; 00026 unsigned char *position2, *bestPosition2, *end2, *bandStart, *bandEnd; 00027 int4* bestRow; 00028 int4 oldBest, match, previousOldBest; 00029 int4 previousBest; 00030 int4 bestScore = 0, rowsRemaining = length1; 00031 00032 // printf("lengths=%d,%d\n", length1, length2); 00033 00034 bandStart = seq2 - relativeOffset - 10; 00035 bandEnd = seq2 - relativeOffset + 10; 00036 00037 end1 = seq1 + length1; 00038 end2 = seq2 + length2; 00039 00040 // Declare processing rows for storing match, insert-subject and insert-query values 00041 // If current malloced rows aren't big enough 00042 if (length2 >= identityAlign_rowSizes) 00043 { 00044 // Free existing rows 00045 free(identityAlign_bestRow); 00046 // Set size to double current needed length 00047 identityAlign_rowSizes = length2 + 1; 00048 // Malloc new rows 00049 identityAlign_bestRow = (int4*)global_malloc(sizeof(int4) * identityAlign_rowSizes); 00050 } 00051 00052 position1 = seq1 - 1; 00053 position2 = seq2 - 1; 00054 00055 // Initialize rows 00056 bestRow = identityAlign_bestRow; 00057 00058 // -----FIRST ROW----- 00059 // For each cell in the top row, scanning from left-to-right 00060 while (position2 < end2) 00061 { 00062 // All values are zero 00063 *bestRow = 0; 00064 00065 bestRow++; position2++; 00066 } 00067 00068 position1++; 00069 00070 // -----REMAINING ROWS----- 00071 while (position1 < end1) 00072 { 00073 bandStart++; 00074 bandEnd++; 00075 00076 position2 = maximum(seq2 - 1, bandStart); 00077 bestRow = identityAlign_bestRow + (position2 - seq2) + 1; 00078 00079 if (position2 < end2 && position2 < bandEnd) 00080 { 00081 // -----FAR LEFT CELL----- 00082 // Set zero values 00083 *bestRow = 0; 00084 previousOldBest = 0; 00085 previousBest = 0; 00086 } 00087 00088 position2++; bestRow++; 00089 00090 // -----REMAINING CELLS----- 00091 while (position2 < end2 && position2 < bandEnd) 00092 { 00093 // Remember old Best value (for cell below this one) 00094 oldBest = *bestRow; 00095 00096 // Calculate new M value 00097 if (*position1 == *position2) 00098 match = previousOldBest + 1; 00099 else 00100 match = previousOldBest; 00101 00102 previousOldBest = oldBest; 00103 00104 // Determine the best of M and Ix 00105 *bestRow = maximum(maximum(match, oldBest), previousBest); 00106 00107 previousBest = *bestRow; 00108 00109 // If this is the best-yet scoring cell 00110 if (match > bestScore) 00111 { 00112 // Update best start cell data 00113 bestScore = match; 00114 } 00115 00116 position2++; bestRow++; 00117 } 00118 00119 position1++; 00120 rowsRemaining--; 00121 00122 if (rowsRemaining + bestScore < targetScore) 00123 { 00124 // printf("Stopped remaining %d/%d\n", rowsRemaining, length1); 00125 return 0; 00126 } 00127 00128 // identityAlign_print(bandStart - seq2, bandEnd - seq2, end2 - seq2); 00129 // if (dloc==72249) 00130 // smithWatermanTraceback_print(identityAlign_bestRow, subjectLength); 00131 } 00132 00133 // printf("Finished %d\n", bestScore); 00134 return bestScore; 00135 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int4* identityAlign_bestRow = NULL |
Definition at line 11 of file identityAlign.c.
Referenced by identityAlign_free(), identityAlign_print(), and identityAlign_score().
| int4 identityAlign_rowSizes = 0 |
1.5.2