]> git.donarmstrong.com Git - fastq-tools.git/blob - src/fastq-parse.h
56a074ad66f5cf4a1e4c2ea44261a132a6575ae5
[fastq-tools.git] / src / fastq-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  * fastq-parse :
7  * A parser for FASTQ files.
8  *
9  * This parser is mostly derivative of Heng Li's.
10  * See: http://lh3lh3.users.sourceforge.net/kseq.shtml
11  *
12  */
13
14 #ifndef FASTQ_TOOLS_PARSE_H
15 #define FASTQ_TOOLS_PARSE_H
16
17 #include <stdio.h>
18 #include <zlib.h>
19
20
21 typedef struct
22 {
23     char*  s;    /* null-terminated string */
24     size_t n;    /* length of s */
25     size_t size; /* bytes allocated for s */
26 } str_t;
27
28
29
30 typedef struct
31 {
32     str_t id1;
33     str_t seq;
34     str_t id2;
35     str_t qual;
36 } seq_t;
37
38
39 seq_t* fastq_alloc_seq();
40 void fastq_free_seq(seq_t*);
41
42
43 typedef struct
44 {
45     gzFile file;
46     int    state;
47     char*  buf;
48     char*  c;
49 } fastq_t;
50
51
52 fastq_t* fastq_open(FILE*);
53 void fastq_close(fastq_t*);
54 int  fastq_next(fastq_t*, seq_t*);
55
56 #endif
57