MCPcopy Create free account
hub / github.com/BirolLab/abyss / newDefaultDiagProbDist

Function newDefaultDiagProbDist

Align/dialign.cpp:54–80  ·  view source on GitHub ↗

Return a probability distribution for diagonal lengths * for a DNA score matrix. */

Source from the content-addressed store, hash-verified

52 * for a DNA score matrix.
53 */
54static prob_dist* newDefaultDiagProbDist()
55{
56 prob_dist *o = (prob_dist*)calloc(1, sizeof *o);
57 o->smatrix = smatrix;
58 unsigned length = 100;
59 o->max_dlen = length;
60 o->data = (long double**)calloc(
61 length + 1, sizeof(long double *));
62 o->log_data = (double**)calloc(length + 1, sizeof(double *));
63
64 long double **dist = o->data;
65 double **log_dist = o->log_data;
66 const double* p = dna_diag_prob_100_exp_550000;
67 for (unsigned i = 1; i <= length; i++) {
68 unsigned mxscr = i * smatrix->max_score;
69 dist[i] = (long double*)calloc(
70 mxscr + 1, sizeof(long double));
71 log_dist[i] = (double*)calloc(mxscr + 1, sizeof(double));
72 for (unsigned scr = 0; scr <= mxscr; scr++) {
73 double weight = *p++;
74 assert(weight > 0);
75 dist[i][scr] = weight;
76 log_dist[i][scr] = -log(weight);
77 }
78 }
79 return o;
80}
81
82/** Initialize dialign. */
83void initDialign()

Callers 1

initDialignFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected