]> git.donarmstrong.com Git - rsem.git/blob - sam/bam2bcf.h
Updated samtools to 0.1.19
[rsem.git] / sam / 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
10 #define B2B_FMT_DP 0x1
11 #define B2B_FMT_SP 0x2
12 #define B2B_FMT_DV 0x4
13
14 typedef struct __bcf_callaux_t {
15         int capQ, min_baseQ;
16         int openQ, extQ, tandemQ; // for indels
17         int min_support, max_support; // for collecting indel candidates
18         double min_frac, max_frac; // for collecting indel candidates
19     int per_sample_flt; // indel filtering strategy
20     int *ref_pos, *alt_pos, npos; // for ReadPosBias
21         // for internal uses
22         int max_bases;
23         int indel_types[4];
24         int maxins, indelreg;
25     int read_len;
26         char *inscns;
27         uint16_t *bases;
28         errmod_t *e;
29         void *rghash;
30 } bcf_callaux_t;
31
32 typedef struct {
33         int depth, n_supp, ori_depth, qsum[4];
34         unsigned int anno[16];
35         float p[25];
36 } bcf_callret1_t;
37
38 typedef struct {
39         int a[5]; // alleles: ref, alt, alt2, alt3
40     float qsum[4];
41         int n, n_alleles, shift, ori_ref, unseen;
42         int n_supp; // number of supporting non-reference reads
43         unsigned int anno[16], depth, ori_depth;
44         uint8_t *PL;
45     float vdb; // variant distance bias
46     float read_pos_bias;
47     struct { float avg, var; int dp; } read_pos;
48 } bcf_call_t;
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54         bcf_callaux_t *bcf_call_init(double theta, int min_baseQ);
55         void bcf_call_destroy(bcf_callaux_t *bca);
56         int bcf_call_glfgen(int _n, const bam_pileup1_t *pl, int ref_base, bcf_callaux_t *bca, bcf_callret1_t *r);
57         int bcf_call_combine(int n, const bcf_callret1_t *calls, bcf_callaux_t *bca, int ref_base /*4-bit*/, bcf_call_t *call);
58         int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bcr, int fmt_flag,
59                                          const bcf_callaux_t *bca, const char *ref);
60         int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_callaux_t *bca, const char *ref,
61                                                   const void *rghash);
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif