modified: myjupyterlab.sh
[GalaxyCodeBases.git] / BGI / SOAPdenovo2 / standardPregraph / inc / sam_view.h
blob06637656342fccdd60fda284e65953d213f535bc
1 #ifndef SAM_VIEW_H
2 #define SAM_VIEW_H
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 )
11 int l;
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 )
26 int q = qual[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 ) )
37 { return 1; }
39 if ( g_rg )
41 uint8_t * s = bam_aux_get ( b, "RG" );
43 if ( s && strcmp ( g_rg, ( char * ) ( s + 1 ) ) == 0 ) { return 0; }
46 if ( g_library )
48 const char * p = bam_get_library ( ( bam_header_t * ) h, b );
49 return ( p && strcmp ( p, g_library ) == 0 ) ? 0 : 1;
52 return 0;
56 #endif