5 static int g_min_mapQ
= 0, g_flag_on
= 0, g_flag_off
= 0;
6 static char *g_library
, *g_rg
;
7 static int g_sol2sanger_tbl
[128];
9 static void sol2sanger(bam1_t
*b
)
12 uint8_t *qual
= bam1_qual(b
);
13 if (g_sol2sanger_tbl
[30] == 0) {
14 for (l
= 0; l
!= 128; ++l
) {
15 g_sol2sanger_tbl
[l
] = (int)(10.0 * log(1.0 + pow(10.0, (l
- 64 + 33) / 10.0)) / log(10.0) + .499);
16 if (g_sol2sanger_tbl
[l
] >= 93) g_sol2sanger_tbl
[l
] = 93;
19 for (l
= 0; l
< b
->core
.l_qseq
; ++l
) {
22 qual
[l
] = g_sol2sanger_tbl
[q
];
26 static inline int __g_skip_aln(const bam_header_t
*h
, const bam1_t
*b
)
28 if (b
->core
.qual
< g_min_mapQ
|| ((b
->core
.flag
& g_flag_on
) != g_flag_on
) || (b
->core
.flag
& g_flag_off
))
31 uint8_t *s
= bam_aux_get(b
, "RG");
32 if (s
&& strcmp(g_rg
, (char*)(s
+ 1)) == 0) return 0;
35 const char *p
= bam_get_library((bam_header_t
*)h
, b
);
36 return (p
&& strcmp(p
, g_library
) == 0)? 0 : 1;