]> git.donarmstrong.com Git - samtools.git/blob - bam2bcf.h
* samtools-0.1.10 (r831)
[samtools.git] / bam2bcf.h
1 #ifndef BAM2BCF_H
2 #define BAM2BCF_H
3
4 #include <stdint.h>
5 #include "errmod.h"
6 #include "bcftools/bcf.h"
7
8 #define B2B_INDEL_NULL 10000
9 #define B2B_MAX_MNP    4 // cannot be larger than 4!!!
10 #define B2B_MNP_WIN    10
11 #define B2B_REF_INDEL  (-1)
12 #define B2B_REF_MNP    (-2)
13
14 typedef struct __bcf_callaux_t {
15         int capQ, min_baseQ;
16         int openQ, extQ, tandemQ;
17         // for internal uses
18         int max_bases;
19         int indel_types[4];
20         int maxins, indelreg, last_mnp_pos;
21         char *inscns;
22         uint16_t *bases;
23         errmod_t *e;
24         void *rghash;
25 } bcf_callaux_t;
26
27 typedef struct {
28         int depth, ori_depth, qsum[4];
29         int anno[16];
30         float p[25];
31 } bcf_callret1_t;
32
33 typedef struct {
34         int a[5]; // alleles: ref, alt, alt2, alt3
35         int n, n_alleles, shift, ori_ref, unseen; // ori_ref can be B2B_REF_INDEL/B2B_REF_MNP
36         int anno[16], depth, ori_depth;
37         uint8_t *PL;
38 } bcf_call_t;
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44         bcf_callaux_t *bcf_call_init(double theta, int min_baseQ);
45         void bcf_call_destroy(bcf_callaux_t *bca);
46         int bcf_call_glfgen(int _n, const bam_pileup1_t *pl, int ref_base, bcf_callaux_t *bca, bcf_callret1_t *r);
47         int bcf_call_combine(int n, const bcf_callret1_t *calls, int ref_base /*4-bit*/, bcf_call_t *call);
48         int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bcr, int is_SP,
49                                          const bcf_callaux_t *bca, const char *ref);
50         int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_callaux_t *bca, const char *ref,
51                                                   const void *rghash);
52         int bcf_call_mnp_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_callaux_t *bca, const char *ref);
53
54 #ifdef __cplusplus
55 }
56 #endif
57
58 #endif