Imported Upstream version 0.5
[pysam.git] / pysam / pysam_util.h
1 #ifndef PYSAM_UTIL_H
2 #define PYSAM_UTIL_H
3
4 //////////////////////////////////////////////////////////////////
5 // set pysam standard error to point to stream
6 FILE * pysam_set_stderr( FILE * f );
7
8 //////////////////////////////////////////////////////////////////
9 //////////////////////////////////////////////////////////////////
10 //////////////////////////////////////////////////////////////////
11 // various helper functions
12 //
13 // fill pileup buffer for next position.
14
15 int pysam_pileup_next(const bam1_t *b,
16                       bam_plbuf_t *buf,
17                       bam_pileup1_t ** plp,
18                       int * tid,
19                       int * pos,
20                       int * n_plp);
21
22 int pysam_dispatch(int argc, char *argv[] );
23
24 /*!
25   @abstract Update the variable length data within a bam1_t entry
26
27   Old data is deleted and the data within b are re-arranged to 
28   make place for new data.
29   
30   @discussion Returns b
31
32   @param  b           bam1_t data
33   @param  nbytes_old  size of old data
34   @param  nbytes_new  size of new data
35   @param  pos         position of data
36 */
37 bam1_t * pysam_bam_update( bam1_t * b,
38                            const size_t nbytes_old,
39                            const size_t nbytes_new,
40                            uint8_t * pos );
41
42 // translate a nucleotide character to binary code
43 unsigned char pysam_translate_sequence( const unsigned char s );
44
45 // defined in bam_import.c
46 extern unsigned char bam_nt16_table[256];
47
48 // translate a reference string *s* to a tid
49 int pysam_reference2tid( bam_header_t *header, const char * s );
50
51 // debugging functions
52 #include "glf.h"
53 uint32_t pysam_glf_depth( glf1_t * g);
54
55 #include "bam_maqcns.h"
56 void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c );
57
58
59 #endif