|
6
|
1 #ifndef MAQMAP_H_
|
|
|
2 #define MAQMAP_H_
|
|
|
3
|
|
|
4 #ifdef MAQ_LONGREADS
|
|
|
5 # define MAX_READLEN 128
|
|
|
6 #else
|
|
|
7 # define MAX_READLEN 64
|
|
|
8 #endif
|
|
|
9
|
|
|
10 #define MAX_NAMELEN 36
|
|
|
11 #define MAQMAP_FORMAT_OLD 0
|
|
|
12 #define MAQMAP_FORMAT_NEW -1
|
|
|
13
|
|
|
14 #define PAIRFLAG_FF 0x01
|
|
|
15 #define PAIRFLAG_FR 0x02
|
|
|
16 #define PAIRFLAG_RF 0x04
|
|
|
17 #define PAIRFLAG_RR 0x08
|
|
|
18 #define PAIRFLAG_PAIRED 0x10
|
|
|
19 #define PAIRFLAG_DIFFCHR 0x20
|
|
|
20 #define PAIRFLAG_NOMATCH 0x40
|
|
|
21 #define PAIRFLAG_SW 0x80
|
|
|
22
|
|
|
23 #include <string.h>
|
|
|
24 #include <zlib.h>
|
|
|
25 #include "const.h"
|
|
|
26
|
|
|
27 /*
|
|
|
28 name: read name
|
|
|
29 size: the length of the read
|
|
|
30 seq: read sequence (see also below)
|
|
|
31 seq[MAX_READLEN-1]: single end mapping quality (equals to map_qual if not paired)
|
|
|
32 map_qual: the final mapping quality
|
|
|
33 alt_qual: the lower quality of the two ends (equals to map_qual if not paired)
|
|
|
34 flag: status of the pair
|
|
|
35 dist: offset of the mate (zero if not paired)
|
|
|
36 info1: mismatches in the 24bp (higher 4 bits) and mismatches (lower 4 bits)
|
|
|
37 info2: sum of errors of the best hit
|
|
|
38 c[2]: count of all 0- and 1-mismatch hits on the reference
|
|
|
39 */
|
|
|
40 typedef struct
|
|
|
41 {
|
|
|
42 bit8_t seq[MAX_READLEN]; /* the last base is the single-end mapping quality. */
|
|
|
43 bit8_t size, map_qual, info1, info2, c[2], flag, alt_qual;
|
|
|
44 bit32_t seqid, pos;
|
|
|
45 int dist;
|
|
|
46 char name[MAX_NAMELEN];
|
|
|
47 } maqmap1_t;
|
|
|
48
|
|
|
49 typedef struct
|
|
|
50 {
|
|
|
51 int format, n_ref;
|
|
|
52 char **ref_name;
|
|
|
53 bit64_t n_mapped_reads;
|
|
|
54 maqmap1_t *mapped_reads;
|
|
|
55 } maqmap_t;
|
|
|
56
|
|
|
57 #define maqmap_read1(fp, m1) gzread((fp), (m1), sizeof(maqmap1_t))
|
|
|
58
|
|
|
59 #ifdef __cplusplus
|
|
|
60 extern "C" {
|
|
|
61 #endif
|
|
|
62 maqmap_t *maq_new_maqmap();
|
|
|
63 void maq_delete_maqmap(maqmap_t *mm);
|
|
|
64 void maqmap_write_header(gzFile fp, const maqmap_t *mm);
|
|
|
65 maqmap_t *maqmap_read_header(gzFile fp);
|
|
|
66 #ifdef __cplusplus
|
|
|
67 }
|
|
|
68 #endif
|
|
|
69
|
|
|
70 #endif
|