-
Notifications
You must be signed in to change notification settings - Fork 1
/
bm2ex.h
82 lines (75 loc) · 3.08 KB
/
bm2ex.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef BM2EX_H
#define BM2EX_H
#include <string>
#include <unistd.h>
#include <assert.h>
#include <libgen.h>
#include <htslib/hts.h>
#include <htslib/sam.h>
#include <htslib/faidx.h>
const unsigned char nt2int[256] = {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
};
const uint8_t opc2opi[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0 /* */, 0 /* ! */, 0 /* " */, 0 /* # */,
0 /* $ */, 0 /* % */, 0 /* & */, 0 /* ' */,
0 /* ( */, 0 /* ) */, 0 /* * */, 0 /* + */,
0 /* , */, 0 /* - */, 0 /* . */, 0 /* / */,
0 /* 0 */, 0 /* 1 */, 0 /* 2 */, 0 /* 3 */,
0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */,
0 /* 8 */, 0 /* 9 */, 0 /* : */, 0 /* ; */,
0 /* < */, 7 /* = */, 0 /* > */, 0 /* ? */,
0 /* @ */, 0 /* A */, 0 /* B */, 0 /* C */,
2 /* D */, 0 /* E */, 0 /* F */, 0 /* G */,
5 /* H */, 1 /* I */, 0 /* J */, 0 /* K */,
0 /* L */, 0 /* M */, 3 /* N */, 0 /* O */,
6 /* P */, 0 /* Q */, 0 /* R */, 4 /* S */,
0 /* T */, 0 /* U */, 0 /* V */, 0 /* W */,
8 /* X */, 0 /* Y */, 0 /* Z */, 0 /* [ */,
0 /* \ */, 0 /* ] */, 0 /* ^ */, 0 /* _ */,
0 /* ` */, 0 /* a */, 0 /* b */, 0 /* c */,
0 /* d */, 0 /* e */, 0 /* f */, 0 /* g */,
0 /* h */, 0 /* i */, 0 /* j */, 0 /* k */,
0 /* l */, 0 /* m */, 0 /* n */, 0 /* o */,
0 /* p */, 0 /* q */, 0 /* r */, 0 /* s */,
0 /* t */, 0 /* u */, 0 /* v */, 0 /* w */,
0 /* x */, 0 /* y */, 0 /* z */, 0 /* { */,
0 /* | */, 0 /* } */, 0 /* ~ */, 0 /* */
};
struct opt_t{
std::string ibam; // input BAM
std::string obam = "out.bam"; // output BAM
std::string iref; // input indexed ref
bool bs = false; // bam sorted by coordinates
void m2ex();
void do1(bam1_t* b, uint8_t* r);
uint32_t gen_cigar(uint32_t length, char op_letter);
uint8_t* seq2ints(const char* seq, const int len);
uint32_t* add_cigar(uint32_t* new_cigar, int32_t* p, int32_t* s, uint32_t length, char op);
};
void bm2ex_usage(opt_t* opt, char* arg0);
int bm2ex_main(int argc, char** argv);
#endif