Mercurial > repos > siyuan > prada
comparison pyPRADA_1.2/tools/bwa-0.5.7-mh/bwtaln.h @ 0:acc2ca1a3ba4
Uploaded
author | siyuan |
---|---|
date | Thu, 20 Feb 2014 00:44:58 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:acc2ca1a3ba4 |
---|---|
1 #ifndef BWTALN_H | |
2 #define BWTALN_H | |
3 | |
4 #include <stdint.h> | |
5 #include "bwt.h" | |
6 | |
7 #define BWA_TYPE_NO_MATCH 0 | |
8 #define BWA_TYPE_UNIQUE 1 | |
9 #define BWA_TYPE_REPEAT 2 | |
10 #define BWA_TYPE_MATESW 3 | |
11 | |
12 #define SAM_FPD 1 // paired | |
13 #define SAM_FPP 2 // properly paired | |
14 #define SAM_FSU 4 // self-unmapped | |
15 #define SAM_FMU 8 // mate-unmapped | |
16 #define SAM_FSR 16 // self on the reverse strand | |
17 #define SAM_FMR 32 // mate on the reverse strand | |
18 #define SAM_FR1 64 // this is read one | |
19 #define SAM_FR2 128 // this is read two | |
20 #define SAM_FSC 256 // secondary alignment | |
21 | |
22 #define BWA_AVG_ERR 0.02 | |
23 #define BWA_MIN_RDLEN 35 // for read trimming | |
24 | |
25 #ifndef bns_pac | |
26 #define bns_pac(pac, k) ((pac)[(k)>>2] >> ((~(k)&3)<<1) & 3) | |
27 #endif | |
28 | |
29 typedef struct { | |
30 bwtint_t w; | |
31 int bid; | |
32 } bwt_width_t; | |
33 | |
34 typedef struct { | |
35 uint32_t n_mm:8, n_gapo:8, n_gape:8, a:1; | |
36 bwtint_t k, l; | |
37 int score; | |
38 } bwt_aln1_t; | |
39 | |
40 typedef uint16_t bwa_cigar_t; | |
41 /* rgoya: If changing order of bytes, beware of operations like: | |
42 * s->cigar[0] += s->full_len - s->len; | |
43 */ | |
44 #define CIGAR_OP_SHIFT 14 | |
45 #define CIGAR_LN_MASK 0x3fff | |
46 | |
47 #define __cigar_op(__cigar) ((__cigar)>>CIGAR_OP_SHIFT) | |
48 #define __cigar_len(__cigar) ((__cigar)&CIGAR_LN_MASK) | |
49 #define __cigar_create(__op, __len) ((__op)<<CIGAR_OP_SHIFT | (__len)) | |
50 | |
51 typedef struct { | |
52 uint32_t pos; | |
53 uint32_t n_cigar:15, gap:8, mm:8, strand:1; | |
54 bwa_cigar_t *cigar; | |
55 } bwt_multi1_t; | |
56 | |
57 typedef struct { | |
58 char *name; | |
59 ubyte_t *seq, *rseq, *qual; | |
60 uint32_t len:20, strand:1, type:2, dummy:1, extra_flag:8; | |
61 uint32_t n_mm:8, n_gapo:8, n_gape:8, mapQ:8; | |
62 int score; | |
63 int clip_len; | |
64 // alignments in SA coordinates | |
65 int n_aln; | |
66 bwt_aln1_t *aln; | |
67 // multiple hits | |
68 int n_multi; | |
69 bwt_multi1_t *multi; | |
70 // alignment information | |
71 bwtint_t sa, pos; | |
72 uint64_t c1:28, c2:28, seQ:8; // number of top1 and top2 hits; single-end mapQ | |
73 int n_cigar; | |
74 bwa_cigar_t *cigar; | |
75 // for multi-threading only | |
76 int tid; | |
77 // NM and MD tags | |
78 uint32_t full_len:20, nm:12; | |
79 char *md; | |
80 } bwa_seq_t; | |
81 | |
82 #define BWA_MODE_GAPE 0x01 | |
83 #define BWA_MODE_COMPREAD 0x02 | |
84 #define BWA_MODE_LOGGAP 0x04 | |
85 #define BWA_MODE_NONSTOP 0x10 | |
86 | |
87 typedef struct { | |
88 int s_mm, s_gapo, s_gape; | |
89 int mode; | |
90 int indel_end_skip, max_del_occ, max_entries; | |
91 float fnr; | |
92 int max_diff, max_gapo, max_gape; | |
93 int max_seed_diff, seed_len; | |
94 int n_threads; | |
95 int max_top2; | |
96 int trim_qual; | |
97 } gap_opt_t; | |
98 | |
99 #define BWA_PET_STD 1 | |
100 #define BWA_PET_SOLID 2 | |
101 | |
102 typedef struct { | |
103 int max_isize; | |
104 int max_occ; | |
105 int n_multi, N_multi; | |
106 int type, is_sw, is_preload; | |
107 double ap_prior; | |
108 } pe_opt_t; | |
109 | |
110 struct __bwa_seqio_t; | |
111 typedef struct __bwa_seqio_t bwa_seqio_t; | |
112 | |
113 #ifdef __cplusplus | |
114 extern "C" { | |
115 #endif | |
116 | |
117 gap_opt_t *gap_init_opt(); | |
118 void bwa_aln_core(const char *prefix, const char *fn_fa, const gap_opt_t *opt); | |
119 | |
120 bwa_seqio_t *bwa_seq_open(const char *fn); | |
121 void bwa_seq_close(bwa_seqio_t *bs); | |
122 void seq_reverse(int len, ubyte_t *seq, int is_comp); | |
123 bwa_seq_t *bwa_read_seq(bwa_seqio_t *seq, int n_needed, int *n, int is_comp, int trim_qual); | |
124 void bwa_free_read_seq(int n_seqs, bwa_seq_t *seqs); | |
125 | |
126 int bwa_cal_maxdiff(int l, double err, double thres); | |
127 void bwa_cal_sa_reg_gap(int tid, bwt_t *const bwt[2], int n_seqs, bwa_seq_t *seqs, const gap_opt_t *opt); | |
128 | |
129 void bwa_cs2nt_core(bwa_seq_t *p, bwtint_t l_pac, ubyte_t *pac); | |
130 | |
131 | |
132 /* rgoya: Temporary clone of aln_path2cigar to accomodate for bwa_cigar_t, | |
133 __cigar_op and __cigar_len while keeping stdaln stand alone */ | |
134 #include "stdaln.h" | |
135 | |
136 bwa_cigar_t *bwa_aln_path2cigar(const path_t *path, int path_len, int *n_cigar); | |
137 | |
138 #ifdef __cplusplus | |
139 } | |
140 #endif | |
141 | |
142 #endif |