]> git.donarmstrong.com Git - samtools.git/blob - bam_tview.h
works with curses
[samtools.git] / bam_tview.h
1 #ifndef BAM_TVIEW_H
2 #define BAM_TVIEW_H
3
4 #include <ctype.h>
5 #include <assert.h>
6 #include <string.h>
7 #include <math.h>
8 #include <unistd.h>
9 #include "bam.h"
10 #include "faidx.h"
11 #include "bam2bcf.h"
12 #include "sam_header.h"
13 #include "khash.h"
14
15 KHASH_MAP_INIT_STR(kh_rg, const char *)
16
17 typedef struct AbstractTview {
18         int mrow, mcol;
19         
20         bam_index_t *idx;
21         bam_lplbuf_t *lplbuf;
22         bam_header_t *header;
23         bamFile fp;
24         int curr_tid, left_pos;
25         faidx_t *fai;
26         bcf_callaux_t *bca;
27
28         int ccol, last_pos, row_shift, base_for, color_for, is_dot, l_ref, ins, no_skip, show_name;
29         char *ref;
30     khash_t(kh_rg) *rg_hash;
31     /* callbacks */
32     void (*my_destroy)(struct AbstractTview* );
33     void (*my_mvprintw)(struct AbstractTview* ,int,int,const char*,...);
34     void (*my_mvaddch)(struct AbstractTview*,int,int,int);
35     void (*my_attron)(struct AbstractTview*,int);
36     void (*my_attroff)(struct AbstractTview*,int);
37     void (*my_clear)(struct AbstractTview*);
38     int (*my_colorpair)(struct AbstractTview*,int);
39 } tview_t;
40
41
42 char bam_aux_getCEi(bam1_t *b, int i);
43 char bam_aux_getCSi(bam1_t *b, int i);
44 char bam_aux_getCQi(bam1_t *b, int i);
45
46 #define TV_MIN_ALNROW 2
47 #define TV_MAX_GOTO  40
48 #define TV_LOW_MAPQ  10
49
50 #define TV_COLOR_MAPQ   0
51 #define TV_COLOR_BASEQ  1
52 #define TV_COLOR_NUCL   2
53 #define TV_COLOR_COL    3
54 #define TV_COLOR_COLQ   4
55
56 #define TV_BASE_NUCL 0
57 #define TV_BASE_COLOR_SPACE 1
58
59 int tv_pl_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void *data);
60 int base_tv_init(tview_t*,const char *fn, const char *fn_fa, const char *samples);
61 void base_tv_destroy(tview_t*);
62
63 int tv_draw_aln(tview_t *tv, int tid, int pos);
64
65
66 enum {
67         BAM_TVIEW_UNDERLINE
68         };
69
70 #endif
71