comparison srf2fastq/io_lib-1.12.2/io_lib/sff.h @ 0:d901c9f41a6a default tip

Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
author dawe
date Tue, 07 Jun 2011 17:48:05 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d901c9f41a6a
1 #ifndef _SFF_H_
2 #define _SFF_H_
3
4 #include "io_lib/Read.h"
5 #include "io_lib/os.h"
6 #include "io_lib/mFILE.h"
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 /*
13 * This mirrors the order that the SFF header has on disc. We have one of
14 * these only.
15 *
16 * The flow and key are variable length fields as defined by flow_len
17 * and key_len.
18 * The on-disc structure is then also padded out with zeros to the 8-byte
19 * word boundary.
20 */
21 typedef struct {
22 uint32_t magic;
23 char version[4];
24 uint64_t index_offset;
25 uint32_t index_len;
26 uint32_t nreads;
27 uint16_t header_len;
28 uint16_t key_len;
29 uint16_t flow_len;
30 uint8_t flowgram_format;
31 char *flow;
32 char *key;
33 } sff_common_header;
34
35 #define SFF_MAGIC 0x2e736666 /* ".sff" */
36 #define SFF_VERSION "\0\0\0\1"
37
38 /*
39 * We have one read_header per "reading" in the SFF archive.
40 * It too is padded to an 8-byte boundary.
41 */
42 typedef struct {
43 uint16_t header_len;
44 uint16_t name_len;
45 uint32_t nbases;
46 uint16_t clip_qual_left;
47 uint16_t clip_qual_right;
48 uint16_t clip_adapter_left;
49 uint16_t clip_adapter_right;
50 char *name;
51 } sff_read_header;
52
53 /*
54 * We have one read_data section per reading, following the read_header.
55 * It is padded to an 8-byte boundary.
56 */
57 typedef struct {
58 uint16_t *flowgram; /* x 100.0 */
59 uint8_t *flow_index; /* relative to last */
60 char *bases;
61 uint8_t *quality;
62 } sff_read_data;
63
64
65 /*
66 * Low level functions to decode SFF internals
67 */
68 sff_common_header *decode_sff_common_header(unsigned char *buf);
69 sff_common_header *read_sff_common_header(mFILE *mf);
70 void free_sff_common_header(sff_common_header *h);
71 sff_read_header *decode_sff_read_header(unsigned char *buf);
72 void free_sff_read_header(sff_read_header *h);
73 sff_read_header *read_sff_read_header(mFILE *mf);
74 void free_sff_read_data(sff_read_data *d);
75 sff_read_data *read_sff_read_data(mFILE *mf, int nflows, int nbases);
76
77
78 /*
79 * Loads the first SFF sequence from an SFF container and returns as a Read.
80 */
81 Read *mfread_sff(mFILE *mf);
82
83 #ifdef __cplusplus
84 }
85 #endif
86
87 #endif /* _SFF_H_ */