Debian Codegraph @

src/abpoa_graph.h

raw
1 #ifndef ABPOA_GRAPH_H
2 #define ABPOA_GRAPH_H
3
4 #include <stdint.h>
5 #include "abpoa.h"
6 #include "utils.h"
7
8 //#define CIGAR_STR "MIDNSHP=XB"
9 //#define ABPOA_GRAPH_CIGAR_STR "=XIDNSH"
10 //#define ABPOA_GRAPH_CEQUAL 0
11 //#define ABPOA_GRAPH_CMISMATCH 1
12 //#define ABPOA_GRAPH_CINS 2
13 //#define ABPOA_GRAPH_CDEL 3
14 //#define ABPOA_GRAPH_CREF_SKIP 4
15 //#define ABPOA_GRAPH_CCLIP 5
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 int abpoa_get_aligned_id(abpoa_graph_t *abg, int node_id, uint8_t base);
22 int abpoa_get_incre_path_score(abpoa_graph_t *abg, int node_id, int in_id_idx);
23 int abpoa_get_node_weight(abpoa_graph_t *abg, int node_id);
24 void abpoa_add_graph_aligned_node(abpoa_graph_t *abg, int node_id, int aligned_id);
25 void abpoa_set_msa_rank(abpoa_graph_t *abg, int src_id, int sink_id);
26 abpoa_graph_t *abpoa_init_graph(void);
27 void abpoa_free_graph(abpoa_graph_t *graph);
28
29 static inline int abpoa_graph_node_id_to_index(abpoa_graph_t *graph, int node_id) {
30 if (node_id < 0 || node_id >= graph->node_n) err_fatal(__func__, "Wrong node id: %d\n", node_id);
31 return graph->node_id_to_index[node_id];
32 }
33
34 static inline int abpoa_graph_node_id_to_max_pos_right(abpoa_graph_t *graph, int node_id) {
35 if (node_id < 0 || node_id >= graph->node_n) err_fatal(__func__, "Wrong node id: %d\n", node_id);
36 return graph->node_id_to_max_pos_right[node_id];
37 }
38
39 static inline int abpoa_graph_node_id_to_max_pos_left(abpoa_graph_t *graph, int node_id) {
40 if (node_id < 0 || node_id >= graph->node_n) err_fatal(__func__, "Wrong node id: %d\n", node_id);
41 return graph->node_id_to_max_pos_left[node_id];
42 }
43
44 static inline int abpoa_graph_node_id_to_max_remain(abpoa_graph_t *graph, int node_id) {
45 if (node_id < 0 || node_id >= graph->node_n) err_fatal(__func__, "Wrong node id: %d\n", node_id);
46 return graph->node_id_to_max_remain[node_id];
47 }
48
49 static inline int abpoa_graph_index_to_node_id(abpoa_graph_t *graph, int index_i) {
50 if (index_i < 0 || index_i >= graph->node_n) err_fatal(__func__, "Wrong index: %d\n", index_i);
51 return graph->index_to_node_id[index_i];
52 }
53
54 static inline int abpoa_graph_node_id_to_msa_rank(abpoa_graph_t *graph, int node_id) {
55 if (node_id < 0 || node_id >= graph->node_n) err_fatal(__func__, "Wrong node id: %d\n", node_id);
56 return graph->node_id_to_msa_rank[node_id];
57 }
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif