2 * This file is part of fastq-tools.
4 * Copyright (c) 2011 by Daniel C. Jones <dcjones@cs.washington.edu>
7 * A parser for FASTQ files.
11 #ifndef FASTQ_TOOLS_PARSE_H
12 #define FASTQ_TOOLS_PARSE_H
17 /* A string structure to keep-track of a reserved space. */
20 char* s; /* null-terminated string */
21 size_t n; /* length of s */
22 size_t size; /* bytes allocated for s */
26 /* A single fastq entry. */
36 /* Allocate a new empty seq_t. */
40 /* Free a seq allocated with seq_create. */
41 void seq_free(seq_t* seq);
44 /* Internal data for the fastq parser. */
45 typedef struct fastq_t_ fastq_t;
48 /* Create a new fastq parser object.
51 * file: A file that has been opened for reading.
53 fastq_t* fastq_create(FILE* file);
56 /* Free memory associated with a fastq_t object. */
57 void fastq_free(fastq_t*);
60 /* Read one fastq entry.
63 * f: A fastq_t parser object.
64 * seq: A seq_t object that has been allocated with seq_create.
67 * True if an entry was read, false if end-of-file was reached.
69 bool fastq_read(fastq_t* f, seq_t* seq);
72 /* Print a fastq entry. */
73 void fastq_print(FILE* fout, const seq_t* seq);