bwa-mem2 is the maintained, architecture-aware reimplementation of BWA-MEM: near-identical output, ~1.5-3x faster, ~2x the memory, and a different index format. It is the standard DNA short-read aligner for WGS, WES, and germline/somatic variant-calling pipelines. The aligner itself is the easy part of the job; this skill emphasizes the decisions that actually determine whether downstream variant calling works -- read groups, the reference analysis set (decoy/ALT), the -M/-Y output flags, and the strict collate/fixmate/sort/markdup ordering.
conda install -c bioconda bwa-mem2 bwa samtools
bwa binary (the aln/samse/sampe path), not just bwa-mem2.Tell your AI agent what you want to do: - "Align my paired-end WGS reads to the human reference with read groups for GATK" - "Build a bwa-mem2 index for my reference genome" - "Align and mark duplicates in one streaming pipeline" - "Map reads for structural-variant calling with soft-clipped supplementary alignments" - "Run bwa-mem2 with reproducible output across thread counts"
"Align reads_R1.fq.gz and reads_R2.fq.gz to reference.fa with bwa-mem2, add read groups for sample NA12878, and output a coordinate-sorted, indexed BAM."
"Run a complete WGS alignment with duplicate marking for sample NA12878, then tell me which QC numbers to check before calling variants."
"Map my WGS reads for split-read SV detection -- which flags keep the supplementary alignments that Manta and Delly need?"
"Align with reproducible results across different thread counts, and confirm I am mapping to a decoy-containing GRCh38 analysis set."
"I have short, damaged ancient-DNA reads with a low mapping rate using bwa mem -- what should I use instead and why?"
bwa-mem2 index if needed.-Y (and never -M) so supplementary split reads keep their full sequence.-K 100000000 when bit-stable, thread-count-invariant output is required.| Field | Description | Example |
|---|---|---|
| ID | unique read-group id; the BQSR error-model unit | flowcell.lane |
| SM | sample name; variant callers group by SM | NA12878 |
| PL | platform; affects error modeling | ILLUMINA |
| LB | library; MarkDuplicates dedups WITHIN a library | lib1 |
| PU | platform unit (optional but recommended) | flowcell.lane.barcode |
samtools sort to avoid writing a huge intermediate SAM; never leave an uncompressed SAM on disk for a cohort.-Y for any pipeline that calls structural variants, and never -M there -- -M hides the split-read evidence.-K 100000000 for reproducible output; without it, per-batch insert-size estimation makes multithreaded runs vary.samtools view -C -T reference.fa, ~2x smaller); CRAM is reference-backed and needs the same reference to decode.