annotate spp/src/maqmap.h @ 13:87a0c5397b55 draft

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