Uploaded 0.1.15-1 to Sid.
[samtools.git] / bam_maqcns.h
1 #ifndef BAM_MAQCNS_H
2 #define BAM_MAQCNS_H
3
4 #include "glf.h"
5
6 #define BAM_ERRMOD_MAQ2 0
7 #define BAM_ERRMOD_MAQ  1
8 #define BAM_ERRMOD_SOAP 2
9
10 struct __bmc_aux_t;
11
12 typedef struct {
13         float het_rate, theta;
14         int n_hap, cap_mapQ, errmod, min_baseQ;
15
16         float eta, q_r;
17         double *fk, *coef;
18         double *lhet;
19         struct __bmc_aux_t *aux;
20 } bam_maqcns_t;
21
22 typedef struct {
23         int q_indel; // indel sequencing error, phred scaled
24         float r_indel; // indel prior
25         float r_snp; // snp prior
26         // hidden parameters, unchangeable from command line
27         int mm_penalty, indel_err, ambi_thres;
28 } bam_maqindel_opt_t;
29
30 typedef struct {
31         int indel1, indel2;
32         int cnt1, cnt2, cnt_anti;
33         int cnt_ref, cnt_ambi;
34         char *s[2];
35         //
36         int gt, gl[2];
37         int q_cns, q_ref;
38 } bam_maqindel_ret_t;
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44         bam_maqcns_t *bam_maqcns_init();
45         void bam_maqcns_prepare(bam_maqcns_t *bm);
46         void bam_maqcns_destroy(bam_maqcns_t *bm);
47         glf1_t *bam_maqcns_glfgen(int n, const bam_pileup1_t *pl, uint8_t ref_base, bam_maqcns_t *bm);
48         uint32_t bam_maqcns_call(int n, const bam_pileup1_t *pl, bam_maqcns_t *bm);
49         // return: cns<<28 | cns2<<24 | mapQ<<16 | cnsQ<<8 | cnsQ2
50         uint32_t glf2cns(const glf1_t *g, int q_r);
51
52         bam_maqindel_opt_t *bam_maqindel_opt_init();
53         bam_maqindel_ret_t *bam_maqindel(int n, int pos, const bam_maqindel_opt_t *mi, const bam_pileup1_t *pl, const char *ref,
54                                                                          int _n_types, int *_types);
55         void bam_maqindel_ret_destroy(bam_maqindel_ret_t*);
56
57 #ifdef __cplusplus
58 }
59 #endif
60
61 #endif