Mercurial > repos > ashvark > qiime_1_8_0
comparison bwa-0.6.2/bntseq.h @ 2:a294fbfcb1db draft default tip
Uploaded BWA
author | ashvark |
---|---|
date | Fri, 18 Jul 2014 07:55:59 -0400 |
parents | dd1186b11b3b |
children |
comparison
equal
deleted
inserted
replaced
1:a9636dc1e99a | 2:a294fbfcb1db |
---|---|
1 /* The MIT License | |
2 | |
3 Copyright (c) 2008 Genome Research Ltd (GRL). | |
4 | |
5 Permission is hereby granted, free of charge, to any person obtaining | |
6 a copy of this software and associated documentation files (the | |
7 "Software"), to deal in the Software without restriction, including | |
8 without limitation the rights to use, copy, modify, merge, publish, | |
9 distribute, sublicense, and/or sell copies of the Software, and to | |
10 permit persons to whom the Software is furnished to do so, subject to | |
11 the following conditions: | |
12 | |
13 The above copyright notice and this permission notice shall be | |
14 included in all copies or substantial portions of the Software. | |
15 | |
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | |
20 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
21 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
23 SOFTWARE. | |
24 */ | |
25 | |
26 /* Contact: Heng Li <lh3@sanger.ac.uk> */ | |
27 | |
28 #ifndef BWT_BNTSEQ_H | |
29 #define BWT_BNTSEQ_H | |
30 | |
31 #include <stdint.h> | |
32 #include <zlib.h> | |
33 | |
34 #ifndef BWA_UBYTE | |
35 #define BWA_UBYTE | |
36 typedef uint8_t ubyte_t; | |
37 #endif | |
38 | |
39 typedef struct { | |
40 int64_t offset; | |
41 int32_t len; | |
42 int32_t n_ambs; | |
43 uint32_t gi; | |
44 char *name, *anno; | |
45 } bntann1_t; | |
46 | |
47 typedef struct { | |
48 int64_t offset; | |
49 int32_t len; | |
50 char amb; | |
51 } bntamb1_t; | |
52 | |
53 typedef struct { | |
54 int64_t l_pac; | |
55 int32_t n_seqs; | |
56 uint32_t seed; | |
57 bntann1_t *anns; // n_seqs elements | |
58 int32_t n_holes; | |
59 bntamb1_t *ambs; // n_holes elements | |
60 FILE *fp_pac; | |
61 } bntseq_t; | |
62 | |
63 extern unsigned char nst_nt4_table[256]; | |
64 | |
65 #ifdef __cplusplus | |
66 extern "C" { | |
67 #endif | |
68 | |
69 void bns_dump(const bntseq_t *bns, const char *prefix); | |
70 bntseq_t *bns_restore(const char *prefix); | |
71 bntseq_t *bns_restore_core(const char *ann_filename, const char* amb_filename, const char* pac_filename); | |
72 void bns_destroy(bntseq_t *bns); | |
73 int64_t bns_fasta2bntseq(gzFile fp_fa, const char *prefix, int for_only); | |
74 int bns_cnt_ambi(const bntseq_t *bns, int64_t pos_f, int len, int *ref_id); | |
75 | |
76 #ifdef __cplusplus | |
77 } | |
78 #endif | |
79 | |
80 static inline int64_t bns_depos(const bntseq_t *bns, int64_t pos, int *is_rev) | |
81 { | |
82 return (*is_rev = (pos >= bns->l_pac))? (bns->l_pac<<1) - 1 - pos : pos; | |
83 } | |
84 | |
85 #endif |