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);
48 /* Set the seed to use for seq_hash. Different seeds result in different hash
50 void seq_hash_set_seed(uint32_t seed);
53 /* Internal data for the fastq parser. */
54 typedef struct fastq_t_ fastq_t;
57 /* Create a new fastq parser object.
60 * file: A file that has been opened for reading.
62 fastq_t* fastq_create(FILE* file);
65 /* Free memory associated with a fastq_t object. */
66 void fastq_free(fastq_t*);
69 /* Read one fastq entry.
72 * f: A fastq_t parser object.
73 * seq: A seq_t object that has been allocated with seq_create.
76 * True if an entry was read, false if end-of-file was reached.
78 bool fastq_read(fastq_t* f, seq_t* seq);
81 /* Rewind the fastq file.
83 * The FILE passed to fastq_create must be seekable for this to work.
85 void fastq_rewind(fastq_t* f);
88 /* Print a fastq entry. */
89 void fastq_print(FILE* fout, const seq_t* seq);