| 1 |
#ifndef BWA_H_ |
| 2 |
#define BWA_H_ |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
#include "bntseq.h" |
| 6 |
#include "bwt.h" |
| 7 |
|
| 8 |
#define BWA_IDX_BWT 0x1 |
| 9 |
#define BWA_IDX_BNS 0x2 |
| 10 |
#define BWA_IDX_PAC 0x4 |
| 11 |
#define BWA_IDX_ALL 0x7 |
| 12 |
|
| 13 |
#define BWA_CTL_SIZE 0x10000 |
| 14 |
|
| 15 |
typedef struct { |
| 16 |
bwt_t *bwt; // FM-index |
| 17 |
bntseq_t *bns; // information on the reference sequences |
| 18 |
uint8_t *pac; // the actual 2-bit encoded reference sequences with 'N' converted to a random base |
| 19 |
|
| 20 |
int is_shm; |
| 21 |
int64_t l_mem; |
| 22 |
uint8_t *mem; |
| 23 |
} bwaidx_t; |
| 24 |
|
| 25 |
typedef struct { |
| 26 |
int l_seq, id; |
| 27 |
char *name, *comment, *seq, *qual, *sam; |
| 28 |
} bseq1_t; |
| 29 |
|
| 30 |
extern int bwa_verbose; |
| 31 |
extern char bwa_rg_id[256]; |
| 32 |
|
| 33 |
#ifdef __cplusplus |
| 34 |
extern "C" { |
| 35 |
#endif |
| 36 |
|
| 37 |
bseq1_t *bseq_read(int chunk_size, int *n_, void *ks1_, void *ks2_); |
| 38 |
void bseq_classify(int n, bseq1_t *seqs, int m[2], bseq1_t *sep[2]); |
| 39 |
|
| 40 |
void bwa_fill_scmat(int a, int b, int8_t mat[25]); |
| 41 |
uint32_t *bwa_gen_cigar(const int8_t mat[25], int q, int r, int w_, int64_t l_pac, const uint8_t *pac, int l_query, uint8_t *query, int64_t rb, int64_t re, int *score, int *n_cigar, int *NM); |
| 42 |
uint32_t *bwa_gen_cigar2(const int8_t mat[25], int o_del, int e_del, int o_ins, int e_ins, int w_, int64_t l_pac, const uint8_t *pac, int l_query, uint8_t *query, int64_t rb, int64_t re, int *score, int *n_cigar, int *NM); |
| 43 |
|
| 44 |
char *bwa_idx_infer_prefix(const char *hint); |
| 45 |
bwt_t *bwa_idx_load_bwt(const char *hint); |
| 46 |
|
| 47 |
bwaidx_t *bwa_idx_load_from_shm(const char *hint); |
| 48 |
bwaidx_t *bwa_idx_load_from_disk(const char *hint, int which); |
| 49 |
bwaidx_t *bwa_idx_load(const char *hint, int which); |
| 50 |
void bwa_idx_destroy(bwaidx_t *idx); |
| 51 |
int bwa_idx2mem(bwaidx_t *idx); |
| 52 |
int bwa_mem2idx(int64_t l_mem, uint8_t *mem, bwaidx_t *idx); |
| 53 |
|
| 54 |
void bwa_print_sam_hdr(const bntseq_t *bns, const char *hdr_line); |
| 55 |
char *bwa_set_rg(const char *s); |
| 56 |
char *bwa_insert_header(const char *s, char *hdr); |
| 57 |
|
| 58 |
#ifdef __cplusplus |
| 59 |
} |
| 60 |
#endif |
| 61 |
|
| 62 |
#endif |