{1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22};
45 const char* matrix_name,
46 int** posPrivateMatrix,
126retval->
qlength= queryLength;
142 if( !compactSearch ) {
161 sfree(compactSearch);
171 double* queryProbArray,
175 intminScore, maxScore;
182 for(
i= 0;
i< matrixLength;
i++) {
186&& (matrix[
i][k] < minScore))
187minScore = matrix[
i][k];
188 if(matrix[
i][k] > maxScore)
189maxScore = matrix[
i][k];
195return_sfp->
obs_min= minScore;
196return_sfp->
obs_max= maxScore;
201scoreArray[
i] = 0.0;
202return_sfp->
sprob= &(scoreArray[-minScore]);
203onePosFrac = 1.0 / ((double) matrixLength);
204 for(
i= 0;
i< matrixLength;
i++) {
207 if(matrix[
i][k] >= minScore) {
208return_sfp->
sprob[matrix[
i][k]] +=
209(onePosFrac * queryProbArray[k]);
214 for(
i= minScore;
i<= maxScore;
i++)
232 int** posPrivateMatrix,
233 doublescalingFactor,
242 doublefactor, factor_low = 1.0, factor_high = 1.0;
243 double lambda, new_lambda;
245 int** private_matrix;
258private_matrix = posPrivateMatrix;
262dim1 = compactSearch->
qlength;
269 if(doBinarySearch) {
273 for(c = 0; c < dim1; c++) {
274 for(
a= 0;
a< dim2;
a++) {
278matrix[c][
a] = (
int)
279((factor * private_matrix[c][
a]) / divFactor);
286scoreArray, return_sfp);
297 if(new_lambda >
lambda) {
300factor = factor_high;
305 if(too_high ==
FALSE)
307factor_high += (factor_high - 1.0);
308factor = factor_high;
318 if(too_high ==
TRUE)
320factor_low += (factor_low - 1.0);
328factor = 0.5 * (factor_high + factor_low);
329 for(c = 0; c < dim1; c++) {
330 for(
a= 0;
a< dim2;
a++) {
334matrix[c][
a] = (
int)
335((factor * private_matrix[c][
a]) / divFactor);
342scoreArray, return_sfp);
353 if(new_lambda >
lambda) {
356factor_high = factor;
361 for(c = 0; c < dim1; c++) {
362 for(
a= 0;
a< dim2;
a++) {
364matrix[c][
a] = (
int)
BLAST_Nint((
double) private_matrix[c][
a] *
371compactSearch->
query,
377 for(c = 0; c < dim1; c++) {
378 for(
a= 0;
a< dim2;
a++) {
380private_matrix[c][
a] =
395 doublescalingFactor,
412sbp) ==
TRUE)? 0 : 1);
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
int Kappa_impalaScaling(Kappa_posSearchItems *posSearch, Kappa_compactSearchItems *compactSearch, double scalingFactor, Boolean doBinarySearch, BlastScoreBlk *sbp)
Copied from posit2.c.
const Int4 trueCharPositions[20]
positions of true characters in protein alphabet
Kappa_compactSearchItems * Kappa_compactSearchItemsNew(const Uint1 *query, unsigned int queryLength, BlastScoreBlk *sbp)
Creates a new Kappa_compactSearchItems structure.
Kappa_posSearchItems * Kappa_posSearchItemsFree(Kappa_posSearchItems *posSearch)
Deallocates the Kappa_posSearchItems structure.
static Blast_ScoreFreq * fillSfp(int **matrix, int matrixLength, double *queryProbArray, double *scoreArray, Blast_ScoreFreq *return_sfp)
Replace/refactor with either one of the already existing variants of this function: posfillSfp (blast...
Kappa_compactSearchItems * Kappa_compactSearchItemsFree(Kappa_compactSearchItems *compactSearch)
Deallocates the Kappa_compactSearchItems structure.
static Boolean impalaScaleMatrix(Kappa_compactSearchItems *compactSearch, int **posMatrix, int **posPrivateMatrix, double scalingFactor, Boolean doBinarySearch, BlastScoreBlk *sbp)
Copy of posit2.c's impalaScaleMatrix.
Kappa_posSearchItems * Kappa_posSearchItemsNew(unsigned int queryLength, const char *matrix_name, int **posPrivateMatrix, double **posFreqs)
Allocates a new Kappa_posSearchItems structure.
Port of posit.h structures and impalaScaling for implementing composition based statistics for PSI-BL...
#define PRO_TRUE_ALPHABET_SIZE
number of real aminoacids (i.e.
#define kScoreMatrixScoreRange
range of scores in a matrix
void ** _PSIAllocateMatrix(unsigned int ncols, unsigned int nrows, unsigned int data_type_sz)
Generic 2 dimensional matrix allocator.
const int kPSIScaleFactor
Successor to POSIT_SCALE_FACTOR.
const Uint4 kPositScalingNumIterations
Constant used in scaling PSSM routines: Successor to POSIT_NUM_ITERATIONS.
void ** _PSIDeallocateMatrix(void **matrix, unsigned int ncols)
Generic 2 dimensional matrix deallocator.
void _PSIUpdateLambdaK(const int **pssm, const Uint1 *query, Uint4 query_length, const double *std_probs, BlastScoreBlk *sbp)
Updates the Karlin-Altschul parameters based on the query sequence and PSSM's score frequencies.
const double kPositScalingPercent
Constant used in scaling PSSM routines: Successor to POSIT_PERCENT.
Private interface for Position Iterated BLAST API, contains the PSSM generation engine.
#define BLAST_SCORE_MIN
minimum allowed score (for one letter comparison).
double Blast_KarlinLambdaNR(Blast_ScoreFreq *sfp, double initialLambdaGuess)
Calculates the parameter Lambda given an initial guess for its value.
Blast_ScoreFreq * Blast_ScoreFreqFree(Blast_ScoreFreq *sfp)
Deallocates the score frequencies structure.
#define BLAST_SCORE_MAX
maximum allowed score (for one letter comparison).
Various auxiliary BLAST utility functions.
double * BLAST_GetStandardAaProbabilities(void)
Get the standard amino acid probabilities.
#define BLASTAA_SIZE
Size of aminoacid alphabet.
#define BLASTAA_SEQ_CODE
== Seq_code_ncbistdaa
uint8_t Uint1
1-byte (8-bit) unsigned integer
int32_t Int4
4-byte (32-bit) signed integer
unsigned int
A callback function used to compare two keys in a database.
SFreqRatios * _PSIMatrixFrequencyRatiosFree(SFreqRatios *freq_ratios)
Deallocate the frequency ratios structure.
SFreqRatios * _PSIMatrixFrequencyRatiosNew(const char *matrix_name)
Retrive the matrix's frequency ratios.
Prototypes for portable math library (ported from C Toolkit)
long BLAST_Nint(double x)
Nearest integer.
Uint1 Boolean
bool replacment for C
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
#define ASSERT
macro for assert.
double lambda(size_t dimMatrix_, const Int4 *const *scoreMatrix_, const double *q_)
Structure used for scoring calculations.
Boolean protein_alphabet
TRUE if alphabet_code is for a protein alphabet (e.g., ncbistdaa etc.), FALSE for nt.
Blast_KarlinBlk ** kbp_psi
K-A parameters for position-based alignments.
Int2 alphabet_size
size of alphabet.
Uint1 alphabet_code
NCBI alphabet code.
SBlastScoreMatrix * matrix
scoring matrix data
Blast_KarlinBlk * kbp_ideal
Ideal values (for query with average database composition).
Blast_KarlinBlk ** kbp_gap_std
K-A parameters for std (not position-based) alignments.
Blast_KarlinBlk ** kbp_std
K-A parameters for ungapped alignments.
Blast_KarlinBlk ** kbp_gap_psi
K-A parameters for psi alignments.
double K
K value used in statistics.
double Lambda
Lambda value used in statistics.
Holds score frequencies used in calculation of Karlin-Altschul parameters for an ungapped search.
double score_avg
average score, must be negative for local alignment.
Int4 obs_min
lowest observed (actual) scores
double * sprob
arrays for frequency of given score, shifted down by score_min.
Int4 obs_max
highest observed (actual) scores
Structure used to pass data into the scaling routines.
Blast_KarlinBlk ** kbp_gap_std
Gapped Karlin-Altschul parameters [alias].
double lambda_ideal
Lambda calculated using standard residue compositions for the query and database sequences.
double * standardProb
Array of standard residue probabilities, as those returned by BLAST_GetStandardAaProbabilities.
Blast_KarlinBlk ** kbp_gap_psi
Gapped PSI-BLAST Karlin-Altschul parameters [alias].
Blast_KarlinBlk ** kbp_psi
Ungapped PSI-BLAST Karlin-Altschul parameters [alias].
int ** matrix
Standard substitution scoring matrix [alias].
Blast_KarlinBlk ** kbp_std
Ungapped Karlin-Altschul parameters [alias].
Uint1 * query
Query sequence data in ncbistdaa format without sentinel bytes [alias].
int qlength
Length of the sequence above.
int alphabetSize
Size of the alphabet.
double K_ideal
K calculated using standard residue compositions for the query and database sequences.
Structure used to pass data into the scaling routines.
unsigned int queryLength
Length of the query sequence, specifies the number of columns in the matrices in this structure.
SFreqRatios * stdFreqRatios
Frequecy ratios for underlying scoring matrix.
double ** posFreqs
PSSM's frequency ratios [alias].
int ** posPrivateMatrix
Scaled PSSM [alias].
int ** data
actual scoring matrix data, stored in row-major form
voidp calloc(uInt items, uInt size)
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