percent_identity)
112num_cells *
sizeof(
double));
114num_cells *
sizeof(
double));
139memset(matrix, 0, matrix_dim * matrix_dim *
sizeof(
double));
141 for(
i= 0,
row= matrix;
i< matrix_dim - 1;
142 i++,
row+= matrix_dim) {
143 row[0] = 1.0 - identity;
144 row[
i+1] = identity;
164 double*prod,
Int4dim)
169 doublecomp_identity = 1.0 - identity;
174 for(
i= 0;
i< dim;
i++) {
177 for(j = 0; j < dim - 1; j++)
180prod_row[0] = comp_identity * accum;
188 for(
i= 0;
i< dim;
i++) {
189 for(j = 1; j < dim; j++) {
190prod_row[j] = identity * a_row[j-1];
198prod_row = prod + dim - 1;
199 for(
i= 0;
i< dim;
i++) {
200prod_row[0] += a_row[0];
214 double*prod_row = prod;
216 Int4full_entries = dim & ~3;
228 for(
i= 0;
i< dim;
i++, prod_row += dim, a_row += dim) {
230 for(j = 0; j < dim; j++) {
232 double*a_col =
a+ j;
234 for(k = 0; k < full_entries; k += 4, a_col += 4 * dim) {
235accum += a_row[k] * a_col[0] +
236a_row[k+1] * a_col[dim] +
237a_row[k+2] * a_col[2*dim] +
238a_row[k+3] * a_col[3*dim];
240 for(; k < dim; k++, a_col += dim) {
241accum += a_row[k] * a_col[0];
250 #define SWAP_MATRIX(a,b) { \ 272 doublemin_percent_identity,
273 Int4min_align_length)
276 Int4num_squares = 0;
278 if(min_align_length == 0)
286min_percent_identity);
295 while(!(min_align_length &
mask))
301 if(num_squares == 0)
308 if(min_align_length &
mask) {
331 doublemin_percent_identity,
332 Int4min_align_length)
334 const doublek_min_w = 4;
335 const doublek_max_w = 110;
352min_percent_identity,
353min_align_length) != 0) {
360min_percent_identity,
361min_align_length) != 0) {
374 while(p1 > 0 && w1 < k_max_w) {
376w1 =
MIN(2 * w1, k_max_w);
378min_percent_identity,
379min_align_length) != 0) {
389 return(
Int4)(w1 + 0.5);
399min_percent_identity,
400min_align_length) != 0) {
407 return(
Int4)(w0 + 0.5);
412 while(
fabs(w1 - w0) > 1) {
413 doublep2, w2 = (w0 + w1) / 2;
416min_percent_identity,
417min_align_length) != 0) {
432 return(
Int4)(w0 + 0.5);
437 Int4min_align_length)
444 if(min_percent_identity >= 1.0 || min_percent_identity < 0.6)
447 if(min_align_length > 10000)
448min_align_length = 10000;
449 else if(min_align_length < 0)
451 else if(min_align_length < 8)
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
static Int2 s_FindHitProbability(MatrixData *m, Int4 word_size, double min_percent_identity, Int4 min_align_length)
For fixed word size and alignment properties, compute the probability that blastn with that word size...
static void s_MatrixMultiply(double *a, double identity, double *prod, Int4 dim)
Multiply the current exponentiated matrix by the original state transition matrix.
static void s_SetInitialMatrix(double *matrix, Int4 matrix_dim, double identity)
Loads the initial value for matrix exponentiation.
static void s_MatrixDataFree(MatrixData *m)
Free previously allocated scratch data.
#define SWAP_MATRIX(a, b)
swap two matrices by swapping pointers to them
static Int4 s_FindWordSize(MatrixData *m, double min_percent_identity, Int4 min_align_length)
For specified alignment properties, compute the blastn word size that will cause random alignments wi...
static Int2 s_MatrixDataInit(MatrixData *m)
initialize intermediate state.
#define TARGET_HIT_PROB
the probability that a random alignment will be found.
static void s_MatrixSquare(double *a, double *prod, Int4 dim)
Multiply a square matrix by itself.
struct MatrixData MatrixData
structure containing intermediate data to be processed
static Int2 s_MatrixDataReset(MatrixData *m, Int4 new_word_size, double percent_identity)
Set up for the next calculation of hit probability.
Compute a blastn word size appropriate for finding, with high probability, alignments with specified ...
Various auxiliary BLAST utility functions.
ncbi::TMaskedQueryRegions mask
Int4 BLAST_FindBestNucleotideWordSize(double min_percent_identity, Int4 min_align_length)
Given a minimum amount of identity and the minimum desired length of nucleotide alignments,...
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define MIN(a, b)
returns smaller of a and b.
#define row(bind, expected)
structure containing intermediate data to be processed
Int4 matrix_dim_alloc
max matrix size
Int4 matrix_dim
current matrix size
double hit_probability
for the current Markov chain, the probability that blastn will find a hit of specified length with sp...
double * prod_matrix
scratch space for matrix multiply
double percent_identity
the target percent identity, used to choose the blastn word size
double * power_matrix
space for iterated Markov chain
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4