A pipeline isa series of file conversions
Each step reads one format and writes another. Once you see it that way, an NGS workflow stops being intimidating and starts being bookkeeping.
Reads and quality scores, gzipped, usually a pair of files per sample.
Aligned, sorted, indexed, deduplicated. The working format for everything in the middle.
Small enough to take home. Almost everything else on the machine is intermediate.
Six stages,the same every time
DNA or RNA, human or bacterial — the frame is identical and only the tools inside it change.
A shell script worksuntil it does not
Every pipeline starts as a list of commands. The question is when to stop and pick up a workflow manager.
$ fastqc -t 8 -o qc/ raw/*.fastq.gz
$ bwa mem -t 8 ref.fa r1.fq.gz r2.fq.gz | samtools sort -@ 4 -o aln.bam
$ samtools index aln.bam && samtools flagstat aln.bam
Right for a handful of samples. Version it, and it is perfectly reproducible.
Resume from failure, skip finished steps, run samples in parallel. Worth it past ten samples.
Community pipelines already assembled and validated. Start here before writing your own.
The honest threshold is roughly: more than ten samples, or any step that takes long enough that you mind rerunning it. Below that a script is fine and a workflow manager is overhead. Above it, resuming from a failure and not recomputing finished steps is worth the learning curve on its own.
Disk, then memory,then cores
NGS work is bounded by different things at different steps, which is worth knowing before you pick a machine.
Alignment wants cores and a moderate amount of memory. Assembly wants an enormous amount of memory and does not care much about cores. Everything wants disk, and intermediate SAM files are the usual reason a volume fills up — pipe the aligner straight into samtools sort rather than writing SAM to disk at all.
Because disk here is billed from the first run until you delete it, deleting intermediates as you go is not tidiness — it is the largest single lever on what the analysis costs.
BWA isbeing built
The image and its definition are being verified. When they are done, it deploys by name like the rest.