Sometimes you just want to make a quick FASTQ file for testing.

Usage:

  1. Write your FASTQ spec in a foo.lisp file (see below for the syntax).
  2. quick-fastq foo.lisp (or cat foo.lisp | quick-fastq if you prefer) to dump a random FASTQ on stdout.

Syntax

quick-fastq will read two Common Lisp forms (using the standard reader for now, so don't run it on untrusted data). The format of the input is:

bindings
expr

expr is an expression describing how to generate a random read.

Bindings must be a (possibly empty) list of bindings, each of the form (symbol expr). expr will be evaluated and bound to symbol. Bindings are performed in order as if by let*. Several keyword symbols have special meanings:

Examples

Generate a random 1000bp read:

()
1000

Generate a read with the same 100bp beginning and end, with 500bp of random bases in the middle:

((x 100))
#(x 500 x)

Generate a gapped foldback chimeric read, with the second half having a lower quality than the first:

((x (q40 1000))
 (f (q20 (revcomp x))))
#(x 25 f)

Generate a read with a tandem repeat in the middle:

()
#(1000 (rep 200 "ATTT") 1000)

Generate a foldback chimeric read with a double tandem duplication in the foldback strand, with simulated sequencing error, and small chunks of low-quality bases to make the transitions between sections as a hack:

((x 1000)
 (lq (q1 10))
 (a (first 800 x))
 (b (last 200 x))
 (dup (last 150 a))
 (f (revcomp #(lq a lq dup lq (rc dup) lq dup lq b))))

(err 0.01 #(x f))