Repository navigation
Tutorial 1 Your First Build
Follow along! In about 30 minutes you will run the real pipeline on a small practice dataset and look at your own trees and surveillance report. Nothing here can break anything, and nothing leaves your computer.
What you'll use: 20 H1N1, 20 H3N2 and 20 B/Victoria samples generated by
Dr. Heba Mostafa's Lab at the Johns Hopkins Hospital, stored in tutorial/.
The tutorial makes all 24 segment builds, 3 whole-genome builds and the
surveillance report, using exactly the same workflow as a production run.
📽️ Supplemental slides: https://elginakin.github.io/posts/content/pekosz_nextstrain/
Important
This tutorial uses the pekosz-nextstrain conda environment. Earlier
versions of the tutorial offered the Nextstrain Docker runtime
(nextstrain shell). It is no longer supported: viewing trees locally was
unreliable (especially on WSL), and Docker may not support the report steps.
If any older material tells you to install Docker, follow
Getting Started instead.
flowchart LR
A["Setup done<br/>(Getting Started)"] --> B["Add vaccine.fasta<br/>(or an empty file)"]
B --> C["Dry run"]
C --> D["Run"]
D --> E["Open the report<br/>and the trees"]
Five moves: your setup, one input file, a rehearsal, the run, and the results.
- You finished Getting Started and saw
All N checks passed. - Your terminal is in the top-level
nextstrainfolder. Check:
ls Snakefile config/tutorial.yaml tutorial/JHH_sequences.fasta-
conda activate pekosz-nextstrain(your prompt shows(pekosz-nextstrain)). - No production build is sitting in the workspace (see FAQ below).
GISAID data cannot be openly redistributed, so vaccine.fasta is not
included. If you have your own GISAID account, download and format the
vaccine strains (Tutorial 3) and save
them at exactly:
tutorial/vaccine.fasta
No GISAID account yet? The pipeline runs fine with an empty file (your trees just won't show vaccine strains):
touch tutorial/vaccine.fastaDo not commit or share this file (git ignores it, and the data guard blocks it anyway). Confirm all three inputs:
ls -lh tutorial/JHH_sequences.fasta tutorial/JHH_metadata.txt tutorial/vaccine.fastaA dry run checks the workflow and input paths without building anything:
snakemake --dry-run --cores 8 --configfile config/tutorial.yamlYou'll see a list of jobs and a summary count. A message mentioning
tutorial/vaccine.fasta means the vaccine file is missing or misnamed.
snakemake --profile profiles/default --cores 8 --configfile config/tutorial.yaml-
--profile profiles/defaultprints each command and the log of any failed job. -
--cores 8allows up to eight CPU cores. Use--cores 4or--cores 2on smaller computers. -
--configfile config/tutorial.yamlreads the small tutorial inputs instead ofsource/.
It takes a few minutes. At the start you'll see a data-protection line
(data_guard: OK ...). Success ends without a red error message and creates:
auspice/
├── h1n1/ 8 segment builds + genome build (+ tip-frequency files)
├── h3n2/
└── vic/
reports/
├── surveillance_report.html interactive report – open in any browser
├── surveillance_report.pptx slide deck
├── figures/ tables/ PNG figures and TSV tables
└── report.tsv report.xlsx
-
The report: open
reports/surveillance_report.htmlin a browser (macOS:open reports/surveillance_report.html; WSL:explorer.exe reports/surveillance_report.html). How to read it: Step 4. -
Explore live:
marimo run scripts/report.pyopens the report as an app where you can pick any sequencing run. -
The trees: go to https://auspice.us and drag in a build's two JSON
files (e.g.
auspice/h3n2/ha.jsonandha_tip-frequencies.json), or runauspice view --datasetDir auspice/h3n2and open http://localhost:4000. Try coloring byclade, then bysequencing_run. -
How the run went:
.run/reports/index.mdand the run'sreport.md.
You've just run the whole pipeline. 🚀
Before running anything else (another tutorial run or production), archive and clean:
snakemake --cores 8 snapshot_cleanpython scripts/generate_tutorial_dataset.py
cp source/vaccine.fasta tutorial/vaccine.fastaThe generator picks 20 distinct samples per subtype from fludb and mixes
segment profiles (12 complete genomes, 2 HA-only, 2 NA-only, 3 without HA/NA,
1 NS-only) to exercise the diagnostics. Confirm the chosen samples are
released on GISAID before committing; the data guard's JHH check needs
ALLOW_JHH_DATA=1 (Data Protection).
The current tutorial samples (sequencing runs IV23Run6 to IV26Run7) were confirmed released on GISAID by the maintainer in October 2026.
-
A previous production build exists. Tutorial and production runs share
data/,results/,.run/,auspice/,reports/andfludb.db. Do not mix them: use a fresh clone, or archive first withsnapshot_clean(Step 2; it deletes outputs, so read it first). -
command not found: snakemake(or augur, nextclade...): runconda activate pekosz-nextstrain. Re-check any time withbash scripts/build_env.sh --check. -
The environment is broken or out of date:
bash scripts/build_env.sh --recreate. - The run was interrupted: fix the cause and rerun the same command; it continues where it stopped.
-
The vaccine file is rejected: check it is named exactly
tutorial/vaccine.fastaand its headers match the 7-field format. - Never post GISAID sequence data in a public issue, repository or support message.
Next step → Pipeline Overview
Pekosz Lab Seasonal Influenza Nextstrain · Repository · Builds · Never post GISAID or unpublished JHH data on this wiki (why) · Found an error? Fix it in the same PR as your code (how).
Written with support from Opus 5.5.
Start here
The pipeline, in order
- Source Data Preparation
- Running the Pipeline
- Filtering & QC
- Reports & Outputs
- Reviewing & Publishing
🧪 Tutorials
🤖 Coding with Agents
📚 Reference