Debian Codegraph @

hmmer/src/p7_hmmwindow.c

raw symbols SCIP
1 /* The Plan7 HMMWINDOW data structure, which holds a compact representation
2 * of substitution scores and maximal extensions, used by nhmmer.
3 *
4 * Contents:
5 * 1. The P7_HMMWINDOW object: allocation, initialization, destruction.
6 */
7 #include <p7_config.h>
8 #include "hmmer.h"
9
10
11 /*********************************************************************
12 *# 1. The P7_MSVDATA object: allocation, initialization, destruction.
13 *********************************************************************/
14
15
16 /* Function: p7_hmmwindow_init()
17 *
18 * Synopsis: initialize the object used to store a list of sequence windows
19 *
20 * Returns: eslEMEM in event of allocation failure, otherwise eslOK
21 */
22 int
23 p7_hmmwindow_init (P7_HMM_WINDOWLIST *list) {
24 int status;
25 list->size = 10000;
26 list->count = 0;
27 ESL_ALLOC(list->windows, list->size * sizeof(P7_HMM_WINDOW));
28
29 return eslOK;
30
31 ERROR:
32 return eslEMEM;
33
34 }
35
36 /* Function: p7_hmmwindow_new()
37 *
38 * Synopsis: Return a pointer to the next window element on the list
39 *
40 * Purpose: Accepts <id>, <pos>, <fm_pos>, <k>, <length>, <score>,
41 * and <complementarity>, assigns those to the next window
42 * element, then returns it, increasing the size of the
43 * list, if necessary.
44 *
45 * Returns: NULL in event of allocation failure, otherwise pointer to
46 * the next seed diagonal
47 */
48
49 P7_HMM_WINDOW *
50 p7_hmmwindow_new (P7_HMM_WINDOWLIST *list, uint32_t id, uint32_t pos, uint32_t fm_pos, uint16_t k, uint32_t length, float score, uint8_t complementarity, uint32_t target_len) {
51 int status;
52 P7_HMM_WINDOW *window;
53
54 if (list->count == list->size) {
55 list->size *= 4;
56 ESL_REALLOC(list->windows, list->size * sizeof(P7_HMM_WINDOW));
57 }
58 window = list->windows + list->count;
59
60 window->id = id;
61 window->n = pos;
62 window->fm_n = fm_pos;
63 window->k = k;
64 window->length = length;
65 window->score = score;
66 window->complementarity = complementarity;
67 window->target_len = target_len;
68
69 list->count++;
70
71 return window;
72
73 ERROR:
74 return NULL;
75 }
76
77