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
);
14 if ( g_sol2sanger_tbl
[30] == 0 )
16 for ( l
= 0; l
!= 128; ++l
)
18 g_sol2sanger_tbl
[l
] = ( int ) ( 10.0 * log ( 1.0 + pow ( 10.0, ( l
- 64 + 33 ) / 10.0 ) ) / log ( 10.0 ) + .499 );
20 if ( g_sol2sanger_tbl
[l
] >= 93 ) { g_sol2sanger_tbl
[l
] = 93; }
24 for ( l
= 0; l
< b
->core
.l_qseq
; ++l
)
28 if ( q
> 127 ) { q
= 127; }
30 qual
[l
] = g_sol2sanger_tbl
[q
];
34 static inline int __g_skip_aln ( const bam_header_t
* h
, const bam1_t
* b
)
36 if ( b
->core
.qual
< g_min_mapQ
|| ( ( b
->core
.flag
& g_flag_on
) != g_flag_on
) || ( b
->core
.flag
& g_flag_off
) )
41 uint8_t * s
= bam_aux_get ( b
, "RG" );
43 if ( s
&& strcmp ( g_rg
, ( char * ) ( s
+ 1 ) ) == 0 ) { return 0; }
48 const char * p
= bam_get_library ( ( bam_header_t
* ) h
, b
);
49 return ( p
&& strcmp ( p
, g_library
) == 0 ) ? 0 : 1;