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
18 /* A string structure to keep-track of a reserved space. */
21 char* s; /* null-terminated string */
22 size_t n; /* length of s */
23 size_t size; /* bytes allocated for s */
27 /* A single fastq entry. */
37 /* Allocate a new empty seq_t. */
41 /* Free a seq allocated with seq_create. */
42 void seq_free(seq_t* seq);
45 /* Hash a fastq entry. */
46 uint32_t seq_hash(const seq_t* seq);
49 /* Internal data for the fastq parser. */
50 typedef struct fastq_t_ fastq_t;
53 /* Create a new fastq parser object.
56 * file: A file that has been opened for reading.
58 fastq_t* fastq_create(FILE* file);
61 /* Free memory associated with a fastq_t object. */
62 void fastq_free(fastq_t*);
65 /* Read one fastq entry.
68 * f: A fastq_t parser object.
69 * seq: A seq_t object that has been allocated with seq_create.
72 * True if an entry was read, false if end-of-file was reached.
74 bool fastq_read(fastq_t* f, seq_t* seq);
77 /* Rewind the fastq file.
79 * The FILE passed to fastq_create must be seekable for this to work.
81 void fastq_rewind(fastq_t* f);
84 /* Print a fastq entry. */
85 void fastq_print(FILE* fout, const seq_t* seq);