annotate PsiCLASS-1.0.2/samtools-0.1.19/bam2bcf.h @ 0:903fc43d6227 draft default tip

Uploaded
author lsong10
date Fri, 26 Mar 2021 16:52:45 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
1 #ifndef BAM2BCF_H
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
2 #define BAM2BCF_H
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
3
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
4 #include <stdint.h>
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
5 #include "errmod.h"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
6 #include "bcftools/bcf.h"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
7
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
8 #define B2B_INDEL_NULL 10000
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
9
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
10 #define B2B_FMT_DP 0x1
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
11 #define B2B_FMT_SP 0x2
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
12 #define B2B_FMT_DV 0x4
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
13
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
14 typedef struct __bcf_callaux_t {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
15 int capQ, min_baseQ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
16 int openQ, extQ, tandemQ; // for indels
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
17 int min_support, max_support; // for collecting indel candidates
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
18 double min_frac, max_frac; // for collecting indel candidates
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
19 int per_sample_flt; // indel filtering strategy
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
20 int *ref_pos, *alt_pos, npos; // for ReadPosBias
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
21 // for internal uses
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
22 int max_bases;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
23 int indel_types[4];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
24 int maxins, indelreg;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
25 int read_len;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
26 char *inscns;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
27 uint16_t *bases;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
28 errmod_t *e;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
29 void *rghash;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
30 } bcf_callaux_t;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
31
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
32 typedef struct {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
33 int depth, n_supp, ori_depth, qsum[4];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
34 unsigned int anno[16];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
35 float p[25];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
36 } bcf_callret1_t;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
37
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
38 typedef struct {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
39 int a[5]; // alleles: ref, alt, alt2, alt3
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
40 float qsum[4];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
41 int n, n_alleles, shift, ori_ref, unseen;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
42 int n_supp; // number of supporting non-reference reads
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
43 unsigned int anno[16], depth, ori_depth;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
44 uint8_t *PL;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
45 float vdb; // variant distance bias
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
46 float read_pos_bias;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
47 struct { float avg, var; int dp; } read_pos;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
48 } bcf_call_t;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
49
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
50 #ifdef __cplusplus
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
51 extern "C" {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
52 #endif
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
53
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
54 bcf_callaux_t *bcf_call_init(double theta, int min_baseQ);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
55 void bcf_call_destroy(bcf_callaux_t *bca);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
56 int bcf_call_glfgen(int _n, const bam_pileup1_t *pl, int ref_base, bcf_callaux_t *bca, bcf_callret1_t *r);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
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);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
58 int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bcr, int fmt_flag,
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
59 const bcf_callaux_t *bca, const char *ref);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
60 int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_callaux_t *bca, const char *ref,
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
61 const void *rghash);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
62
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
63 #ifdef __cplusplus
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
64 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
65 #endif
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
66
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
67 #endif