]> git.donarmstrong.com Git - fastq-tools.git/blob - src/parse.h
d2e2612bea3261dbbf6d3db2537e71e4eecd6f8e
[fastq-tools.git] / src / parse.h
1 /*
2  * This file is part of fastq-tools.
3  *
4  * Copyright (c) 2011 by Daniel C. Jones <dcjones@cs.washington.edu>
5  *
6  * parse :
7  * A parser for FASTQ files.
8  *
9  */
10
11 #ifndef FASTQ_TOOLS_PARSE_H
12 #define FASTQ_TOOLS_PARSE_H
13
14 #include <stdio.h>
15 #include <zlib.h>
16
17
18 typedef struct
19 {
20     char*  s;    /* null-terminated string */
21     size_t n;    /* length of s */
22     size_t size; /* bytes allocated for s */
23 } str_t;
24
25
26
27 typedef struct
28 {
29     str_t id1;
30     str_t seq;
31     str_t id2;
32     str_t qual;
33 } seq_t;
34
35
36 seq_t* fastq_alloc_seq();
37 void fastq_free_seq(seq_t*);
38
39
40 typedef struct
41 {
42     gzFile file;
43     int    state;
44     char*  buf;
45     char*  c;
46 } fastq_t;
47
48
49 fastq_t* fastq_open(FILE*);
50 void fastq_close(fastq_t*);
51 int  fastq_next(fastq_t*, seq_t*);
52
53 void fastq_print(FILE* fout, seq_t* seq);
54
55
56 #endif
57