X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sam%2Fbam_tview.h;fp=sam%2Fbam_tview.h;h=80f046483be3c7822da697825d9725604840d6a7;hb=dbcf1cfb8ad1086c21d64e249f012809403e7ddc;hp=0000000000000000000000000000000000000000;hpb=58d504aaf36ae486b1dba6d03e0e9f1c25855037;p=rsem.git diff --git a/sam/bam_tview.h b/sam/bam_tview.h new file mode 100644 index 0000000..80f0464 --- /dev/null +++ b/sam/bam_tview.h @@ -0,0 +1,75 @@ +#ifndef BAM_TVIEW_H +#define BAM_TVIEW_H + +#include +#include +#include +#include +#include +#include +#include "bam.h" +#include "faidx.h" +#include "bam2bcf.h" +#include "sam_header.h" +#include "khash.h" + +KHASH_MAP_INIT_STR(kh_rg, const char *) + +typedef struct AbstractTview { + int mrow, mcol; + + bam_index_t *idx; + bam_lplbuf_t *lplbuf; + bam_header_t *header; + bamFile fp; + int curr_tid, left_pos; + faidx_t *fai; + bcf_callaux_t *bca; + + int ccol, last_pos, row_shift, base_for, color_for, is_dot, l_ref, ins, no_skip, show_name; + char *ref; + khash_t(kh_rg) *rg_hash; + /* callbacks */ + void (*my_destroy)(struct AbstractTview* ); + void (*my_mvprintw)(struct AbstractTview* ,int,int,const char*,...); + void (*my_mvaddch)(struct AbstractTview*,int,int,int); + void (*my_attron)(struct AbstractTview*,int); + void (*my_attroff)(struct AbstractTview*,int); + void (*my_clear)(struct AbstractTview*); + int (*my_colorpair)(struct AbstractTview*,int); + int (*my_drawaln)(struct AbstractTview*,int,int); + int (*my_loop)(struct AbstractTview*); + int (*my_underline)(struct AbstractTview*); +} tview_t; + + +char bam_aux_getCEi(bam1_t *b, int i); +char bam_aux_getCSi(bam1_t *b, int i); +char bam_aux_getCQi(bam1_t *b, int i); + +#define TV_MIN_ALNROW 2 +#define TV_MAX_GOTO 40 +#define TV_LOW_MAPQ 10 + +#define TV_COLOR_MAPQ 0 +#define TV_COLOR_BASEQ 1 +#define TV_COLOR_NUCL 2 +#define TV_COLOR_COL 3 +#define TV_COLOR_COLQ 4 + +#define TV_BASE_NUCL 0 +#define TV_BASE_COLOR_SPACE 1 + +int tv_pl_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void *data); +int base_tv_init(tview_t*,const char *fn, const char *fn_fa, const char *samples); +void base_tv_destroy(tview_t*); +int base_draw_aln(tview_t *tv, int tid, int pos); + +typedef struct Tixel + { + int ch; + int attributes; + }tixel_t; + +#endif +