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

Go to the source code of this file.
Functions | |
| PSSMatrix | PSSMatrix_create (struct scoreMatrix scoreMatrix, char *query) |
| PSSMatrix | PSSMatrix_chop (struct PSSMatrix PSSMatrix, int4 amount) |
| PSSMatrix | PSSMatrix_reverse (struct PSSMatrix PSSMatrix) |
| uint4 | PSSMatrix_strandStart (struct PSSMatrix PSSMatrix, uint4 queryOffset) |
| uint4 | PSSMatrix_strandEnd (struct PSSMatrix PSSMatrix, uint4 queryOffset) |
| void | PSSMatrix_print (struct PSSMatrix PSSMatrix) |
| void | PSSMatrix_free (struct PSSMatrix PSSMatrix) |
| void | PSSMatrix_freeCopy (struct PSSMatrix PSSMatrix) |
Variables | |
| unsigned char * | PSSMatrix_packedRightMatches |
| unsigned char * | PSSMatrix_packedLeftMatches |
| int2 * | PSSMatrix_packedRightMatchScores |
| int2 * | PSSMatrix_packedLeftMatchScores |
| char * | PSSMatrix_packedScore |
Definition at line 270 of file PSSMatrix.c.
References PSSMatrix::bytePackedCodes, PSSMatrix::highestValue, PSSMatrix::length, PSSMatrix::lowestValue, PSSMatrix::matrix, PSSMatrix::queryCodes, PSSMatrix::strandLength, and PSSMatrix::xorCodes.
Referenced by bytepackGappedScoring_score(), fasterGappedExtension_build(), gappedExtension_build(), gappedScoring_score(), nuGappedScoring_score(), oldGappedScoring_score(), oldSemiGappedScoring_score(), semiGappedScoring_score(), smithWatermanScoring_score(), smithWatermanScoring_scoreReverse(), smithWatermanTraceback_build(), and tableGappedScoring_score().
00271 { 00272 struct PSSMatrix chopped; 00273 00274 chopped.matrix = PSSMatrix.matrix + amount; 00275 chopped.queryCodes = PSSMatrix.queryCodes + amount; 00276 chopped.bytePackedCodes = PSSMatrix.bytePackedCodes + amount; 00277 chopped.xorCodes = PSSMatrix.xorCodes + amount; 00278 chopped.length = PSSMatrix.length - amount; 00279 chopped.highestValue = PSSMatrix.highestValue; 00280 chopped.lowestValue = PSSMatrix.lowestValue; 00281 chopped.strandLength = PSSMatrix.strandLength - amount; 00282 00283 if (chopped.strandLength < 0) 00284 chopped.strandLength = 0; 00285 00286 return chopped; 00287 }
Here is the caller graph for this function:

| struct PSSMatrix PSSMatrix_create | ( | struct scoreMatrix | scoreMatrix, | |
| char * | query | |||
| ) | [read] |
Definition at line 20 of file PSSMatrix.c.
References encoding_alphabetType, encoding_bytePack(), encoding_bytePackBeginning(), encoding_bytePackRemaining(), encoding_getCode(), encoding_getComplement(), encoding_nucleotide, encoding_numRegularLetters, encoding_randomEncodedLetter(), encoding_sentinalCode, global_malloc(), PSSMatrix::highestValue, int2, int4, PSSMatrix::lowestValue, PSSMatrix::matrix, parameters_matchScore, parameters_mismatchScore, parameters_strands, PSSMatrix_packedLeftMatches, PSSMatrix_packedLeftMatchScores, PSSMatrix_packedRightMatches, PSSMatrix_packedRightMatchScores, and PSSMatrix_packedScore.
Referenced by main().
00021 { 00022 struct PSSMatrix PSSMatrix; 00023 int4 columnCount; 00024 unsigned char code, code2, bestCode; 00025 int4 packedByte, matches; 00026 00027 if (encoding_alphabetType == encoding_nucleotide && parameters_strands == 3) 00028 { 00029 PSSMatrix.length = 2 * strlen(query); 00030 PSSMatrix.strandLength = strlen(query); 00031 } 00032 else if (encoding_alphabetType == encoding_nucleotide && parameters_strands == 2) 00033 { 00034 PSSMatrix.length = strlen(query); 00035 PSSMatrix.strandLength = 0; 00036 } 00037 else 00038 { 00039 PSSMatrix.strandLength = PSSMatrix.length = strlen(query); 00040 } 00041 00042 // For each character in the query sequence 00043 columnCount = 0; 00044 while (columnCount < strlen(query)) 00045 { 00046 // Convert the character to upper case 00047 query[columnCount] = toupper(query[columnCount]); 00048 columnCount++; 00049 } 00050 00051 // Declare memory for use by PSSMatrix 00052 PSSMatrix.matrix = (int2**)global_malloc(sizeof(int2*) * (PSSMatrix.length + 2)); 00053 00054 // Declare memory to store encoded query 00055 PSSMatrix.queryCodes = (unsigned char*)global_malloc(sizeof(unsigned char) * (PSSMatrix.length)); 00056 00057 // Declare memory to store the highest scoring regular letter for each position 00058 PSSMatrix.bestMatchCodes = (unsigned char*)global_malloc(sizeof(unsigned char) * (PSSMatrix.length)); 00059 00060 // The first column will be a sentinal column 00061 PSSMatrix.matrix++; 00062 00063 // Set initial maximum, minimum values 00064 PSSMatrix.highestValue = scoreMatrix.highestValue; 00065 PSSMatrix.lowestValue = scoreMatrix.lowestValue; 00066 00067 // For each character in the query sequence 00068 columnCount = 0; 00069 while (columnCount < PSSMatrix.length) 00070 { 00071 // Get its code 00072 if (columnCount < PSSMatrix.strandLength) 00073 { 00074 // Positive strand 00075 code = encoding_getCode(query[columnCount]); 00076 } 00077 else 00078 { 00079 // Negative strand 00080 code = encoding_getComplement(encoding_getCode(query[PSSMatrix.length - columnCount - 1])); 00081 } 00082 00083 // Use column from scoreMatrix for PSSMatrix 00084 PSSMatrix.matrix[columnCount] = scoreMatrix.matrix[code]; 00085 00086 // Add code to encoded query 00087 PSSMatrix.queryCodes[columnCount] = code; 00088 00089 // For each possible regular letter 00090 bestCode = 0; 00091 code2 = 0; 00092 while (code2 < encoding_numRegularLetters) 00093 { 00094 // Determine which scores highest at this position 00095 // (typically the same as the query letter for this position) 00096 if (PSSMatrix.matrix[columnCount][code2] > PSSMatrix.matrix[columnCount][bestCode]) 00097 { 00098 bestCode = code2; 00099 } 00100 code2++; 00101 } 00102 00103 // Set best code at this position 00104 if (encoding_alphabetType == encoding_nucleotide && code >= encoding_numRegularLetters) 00105 { 00106 PSSMatrix.bestMatchCodes[columnCount] = encoding_randomEncodedLetter(code); 00107 } 00108 else 00109 { 00110 PSSMatrix.bestMatchCodes[columnCount] = bestCode; 00111 } 00112 00113 columnCount++; 00114 } 00115 00116 // If this is a nucleotide sequence store byte-packed code information 00117 if (encoding_alphabetType == encoding_nucleotide) 00118 { 00119 // Declare memory to store xor codes; each 2-bit code copied 4 times in the byte 00120 PSSMatrix.xorCodes = (unsigned char*)global_malloc(sizeof(unsigned char) * (PSSMatrix.length)); 00121 00122 // For each nucleotide character in the query sequence 00123 columnCount = 0; 00124 while (columnCount < PSSMatrix.length) 00125 { 00126 code = PSSMatrix.queryCodes[columnCount]; 00127 00128 // Set xorCode which is the 2-bit code copied 4 times in the byte 00129 PSSMatrix.xorCodes[columnCount] = (code << 6) | code << 4 | code << 2 | code; 00130 00131 columnCount++; 00132 } 00133 00134 // Declare memory to store byte-packed query 00135 PSSMatrix.bytePackedCodes = (unsigned char*)global_malloc(sizeof(unsigned char) * (PSSMatrix.length + 5)) + 4; 00136 00137 // For each position in the sequence 00138 columnCount = 0; 00139 while (columnCount < PSSMatrix.length) 00140 { 00141 // Store packed version of next 4 characters in query 00142 if (columnCount + 3 < PSSMatrix.length) 00143 PSSMatrix.bytePackedCodes[columnCount] 00144 = encoding_bytePack(PSSMatrix.bestMatchCodes + columnCount); 00145 // Of the remaining < 4 characters 00146 else 00147 PSSMatrix.bytePackedCodes[columnCount] = encoding_bytePackRemaining( 00148 PSSMatrix.bestMatchCodes + columnCount, PSSMatrix.length - columnCount); 00149 00150 columnCount++; 00151 } 00152 00153 // Store DUMMY packed value before and after sequence 00154 PSSMatrix.bytePackedCodes[-4] = 0; 00155 PSSMatrix.bytePackedCodes[PSSMatrix.length] = 0; 00156 00157 // Store three before-sequence codes 00158 PSSMatrix.bytePackedCodes[-3] = encoding_bytePackBeginning(PSSMatrix.bestMatchCodes, 1); 00159 PSSMatrix.bytePackedCodes[-2] = encoding_bytePackBeginning(PSSMatrix.bestMatchCodes, 2); 00160 PSSMatrix.bytePackedCodes[-1] = encoding_bytePackBeginning(PSSMatrix.bestMatchCodes, 3); 00161 00162 PSSMatrix_packedRightMatches = (unsigned char*)global_malloc(sizeof(unsigned char) * 256); 00163 PSSMatrix_packedLeftMatches = (unsigned char*)global_malloc(sizeof(unsigned char) * 256); 00164 PSSMatrix_packedRightMatchScores = (int2*)global_malloc(sizeof(int2) * 256); 00165 PSSMatrix_packedLeftMatchScores = (int2*)global_malloc(sizeof(int2) * 256); 00166 PSSMatrix_packedScore = (unsigned char*)global_malloc(sizeof(unsigned char) * 256); 00167 00168 // For each packed byte 00169 packedByte = 0; 00170 while (packedByte < 256) 00171 { 00172 // For each possible XORed value determine number of matches going 00173 // from left to RIGHT 00174 matches = 0; 00175 if (!((packedByte >> 6) & 0x3)) 00176 { 00177 matches++; 00178 if (!((packedByte >> 4) & 0x3)) 00179 { 00180 matches++; 00181 if (!((packedByte >> 2) & 0x3)) 00182 { 00183 matches++; 00184 if (!(packedByte & 0x3)) 00185 { 00186 matches++; 00187 } 00188 } 00189 } 00190 } 00191 PSSMatrix_packedRightMatches[packedByte] = matches; 00192 PSSMatrix_packedRightMatchScores[packedByte] = matches * parameters_matchScore; 00193 00194 // The same going from right to LEFT 00195 matches = 0; 00196 if (!(packedByte & 0x3)) 00197 { 00198 matches++; 00199 if (!((packedByte >> 2) & 0x3)) 00200 { 00201 matches++; 00202 if (!((packedByte >> 4) & 0x3)) 00203 { 00204 matches++; 00205 if (!((packedByte >> 6) & 0x3)) 00206 { 00207 matches++; 00208 } 00209 } 00210 } 00211 } 00212 PSSMatrix_packedLeftMatches[packedByte] = matches; 00213 PSSMatrix_packedLeftMatchScores[packedByte] = matches * parameters_matchScore; 00214 00215 // Determine the score for this XORed pair 00216 matches = 0; 00217 if (!((packedByte >> 6) & 0x3)) 00218 matches += parameters_matchScore; 00219 else 00220 matches += parameters_mismatchScore; 00221 00222 if (!((packedByte >> 4) & 0x3)) 00223 matches += parameters_matchScore; 00224 else 00225 matches += parameters_mismatchScore; 00226 00227 if (!((packedByte >> 2) & 0x3)) 00228 matches += parameters_matchScore; 00229 else 00230 matches += parameters_mismatchScore; 00231 00232 if (!(packedByte & 0x3)) 00233 matches += parameters_matchScore; 00234 else 00235 matches += parameters_mismatchScore; 00236 00237 PSSMatrix_packedScore[packedByte] = matches; 00238 00239 packedByte++; 00240 } 00241 } 00242 00243 // Make columns flanking the query sentinal columns 00244 PSSMatrix.matrix[-1] = scoreMatrix.matrix[encoding_sentinalCode]; 00245 PSSMatrix.matrix[PSSMatrix.length] = scoreMatrix.matrix[encoding_sentinalCode]; 00246 00247 return PSSMatrix; 00248 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void PSSMatrix_free | ( | struct PSSMatrix | PSSMatrix | ) |
Definition at line 346 of file PSSMatrix.c.
References PSSMatrix::bestMatchCodes, PSSMatrix::bytePackedCodes, encoding_alphabetType, encoding_nucleotide, PSSMatrix::matrix, PSSMatrix_packedLeftMatches, PSSMatrix_packedLeftMatchScores, PSSMatrix_packedRightMatches, PSSMatrix_packedRightMatchScores, PSSMatrix_packedScore, PSSMatrix::queryCodes, and PSSMatrix::xorCodes.
Referenced by blast_search().
00347 { 00348 // Do not iterate through each column and free it, since PSSMatrix shares memory 00349 // with scoreMatrix, which will free the columns 00350 PSSMatrix.matrix--; 00351 free(PSSMatrix.matrix); 00352 free(PSSMatrix.queryCodes); 00353 free(PSSMatrix.bestMatchCodes); 00354 00355 if (encoding_alphabetType == encoding_nucleotide) 00356 { 00357 free(PSSMatrix.bytePackedCodes - 4); 00358 free(PSSMatrix.xorCodes); 00359 free(PSSMatrix_packedRightMatches); 00360 free(PSSMatrix_packedLeftMatches); 00361 free(PSSMatrix_packedScore); 00362 free(PSSMatrix_packedRightMatchScores); 00363 free(PSSMatrix_packedLeftMatchScores); 00364 } 00365 }
Here is the caller graph for this function:

| void PSSMatrix_freeCopy | ( | struct PSSMatrix | PSSMatrix | ) |
Definition at line 368 of file PSSMatrix.c.
References PSSMatrix::matrix, and PSSMatrix::queryCodes.
Referenced by smithWatermanScoring_scoreReverse().
Here is the caller graph for this function:

| void PSSMatrix_print | ( | struct PSSMatrix | PSSMatrix | ) |
Definition at line 319 of file PSSMatrix.c.
References constants_sentinalScore, encoding_numCodes, int4, PSSMatrix::length, and PSSMatrix::matrix.
00320 { 00321 int4 x, y; 00322 00323 // Iterate through each row 00324 y = 0; 00325 while (y < encoding_numCodes) 00326 { 00327 // For each cell in the row 00328 x = 0; 00329 while (x < PSSMatrix.length) 00330 { 00331 // Print value 00332 if (PSSMatrix.matrix[x][y] == constants_sentinalScore) 00333 printf(" X "); 00334 else if (PSSMatrix.matrix[x][y] >= 0 && PSSMatrix.matrix[x][y] <= 9) 00335 printf(" %d ", PSSMatrix.matrix[x][y]); 00336 else 00337 printf("%d ", PSSMatrix.matrix[x][y]); 00338 x++; 00339 } 00340 printf("\n"); 00341 y++; 00342 } 00343 }
Definition at line 290 of file PSSMatrix.c.
References PSSMatrix::bestMatchCodes, PSSMatrix::bytePackedCodes, global_malloc(), PSSMatrix::highestValue, int2, PSSMatrix::length, PSSMatrix::lowestValue, PSSMatrix::matrix, PSSMatrix::queryCodes, PSSMatrix::strandLength, uint4, and PSSMatrix::xorCodes.
Referenced by smithWatermanScoring_scoreReverse().
00291 { 00292 struct PSSMatrix reversed; 00293 uint4 queryPosition = 0; 00294 00295 reversed.matrix = (int2**)global_malloc(sizeof(int2*) * (PSSMatrix.length + 2)); 00296 reversed.queryCodes = (unsigned char*)global_malloc(sizeof(unsigned char) * (PSSMatrix.length)); 00297 reversed.length = PSSMatrix.length; 00298 reversed.strandLength = PSSMatrix.strandLength; 00299 reversed.highestValue = PSSMatrix.highestValue; 00300 reversed.lowestValue = PSSMatrix.lowestValue; 00301 reversed.bestMatchCodes = NULL; 00302 reversed.bytePackedCodes = NULL; 00303 reversed.xorCodes = NULL; 00304 00305 // Make and reverse matrix and query codes 00306 while (queryPosition < reversed.length) 00307 { 00308 reversed.matrix[queryPosition] 00309 = PSSMatrix.matrix[reversed.length - queryPosition - 1]; 00310 reversed.queryCodes[queryPosition] 00311 = PSSMatrix.queryCodes[reversed.length - queryPosition - 1]; 00312 queryPosition++; 00313 } 00314 00315 return reversed; 00316 }
Here is the call graph for this function:

Here is the caller graph for this function:

| uint4 PSSMatrix_strandEnd | ( | struct PSSMatrix | PSSMatrix, | |
| uint4 | queryOffset | |||
| ) |
Definition at line 260 of file PSSMatrix.c.
References PSSMatrix::length, and PSSMatrix::strandLength.
Referenced by unpack_getRegions().
00261 { 00262 if (queryOffset > PSSMatrix.strandLength) 00263 return PSSMatrix.length; 00264 else 00265 return PSSMatrix.strandLength; 00266 }
Here is the caller graph for this function:

| uint4 PSSMatrix_strandStart | ( | struct PSSMatrix | PSSMatrix, | |
| uint4 | queryOffset | |||
| ) |
Definition at line 251 of file PSSMatrix.c.
References PSSMatrix::strandLength.
Referenced by unpack_getRegions().
00252 { 00253 if (queryOffset > PSSMatrix.strandLength) 00254 return PSSMatrix.strandLength; 00255 else 00256 return 0; 00257 }
Here is the caller graph for this function:

| unsigned char* PSSMatrix_packedLeftMatches |
Definition at line 13 of file PSSMatrix.c.
Referenced by PSSMatrix_create(), PSSMatrix_free(), search_nucleotide(), search_nucleotide_largeTable(), and search_nucleotide_longWord().
Definition at line 15 of file PSSMatrix.c.
Referenced by PSSMatrix_create(), PSSMatrix_free(), ungappedExtension_checkHit(), and ungappedExtension_nucleotideExtend().
| unsigned char* PSSMatrix_packedRightMatches |
Definition at line 12 of file PSSMatrix.c.
Referenced by PSSMatrix_create(), PSSMatrix_free(), search_nucleotide(), search_nucleotide_largeTable(), and search_nucleotide_longWord().
Definition at line 14 of file PSSMatrix.c.
Referenced by PSSMatrix_create(), PSSMatrix_free(), ungappedExtension_checkHit(), and ungappedExtension_nucleotideExtend().
| char* PSSMatrix_packedScore |
Definition at line 16 of file PSSMatrix.c.
Referenced by bytepackGappedScoring_dpAfterSeed(), bytepackGappedScoring_dpBeforeSeed(), bytepackGappedScoring_score(), fasterBytepackGappedScoring_dpAfterSeed(), fasterBytepackGappedScoring_dpBeforeSeed(), PSSMatrix_create(), PSSMatrix_free(), and ungappedExtension_nucleotideExtend().
1.5.2