@@ -47,6 +47,7 @@ To cite this work, please use both of the following:
4747 * [ ` neat model-seq-err ` ] ( #neat-model-seq-err )
4848 * [ ` neat model-qual-score ` ] ( #neat-model-qual-score )
4949 * [ ` neat model-gc-bias ` ] ( #neat-model-gc-bias )
50+ * [ ` neat compare-vcfs ` ] ( #neat-compare-vcfs )
5051 * [ Tests] ( #tests )
5152 * [ Guide to run locally] ( #guide-to-run-locally )
5253 * [ Note on Sensitive Patient Data] ( #note-on-sensitive-patient-data )
@@ -598,6 +599,75 @@ neat model-gc-bias \
598599
599600and creates ` gc_model.pickle.gz ` model in the working directory.
600601
602+ ### ` neat compare-vcfs `
603+
604+ Compares a downstream variant caller's VCF against a NEAT-simulated truth VCF,
605+ attributing each false negative to the simulator's own configuration. The
606+ intended workflow is: run NEAT to produce a synthetic FASTQ and golden VCF →
607+ run your aligner + caller on the FASTQ → compare the caller's VCF against the
608+ golden with ` neat compare-vcfs ` .
609+
610+ Variant equivalence (multi-allelic normalization, haplotype-level matching) is
611+ delegated to ` hap.py ` . The NEAT-specific value-add is the false-negative
612+ attribution: each FN is tagged with one or more reasons drawn from the run
613+ config recorded in ` simulation_summary.json ` .
614+
615+ ``` bash
616+ neat compare-vcfs golden.vcf called.vcf \
617+ --neat-run-dir /path/to/neat/output/dir \
618+ --output-dir /path/to/comparison/output \
619+ --reference reference.fa \
620+ [--target-bed target.bed] \
621+ [--happy-bin /abs/path/to/hap.py] \
622+ [--plot] \
623+ [--chrom-aliases aliases.tsv]
624+ ```
625+
626+ Outputs (in ` --output-dir ` ):
627+
628+ | File | Purpose |
629+ | ------| ---------|
630+ | ` comparison_summary.json ` | Machine-readable: counts (TP/FN/FP), precision/recall/F1, per-reason FN counts |
631+ | ` comparison_summary.txt ` | Human-readable rollup of the same |
632+ | ` FN_with_reasons.vcf ` | hap.py's false-negative records, each annotated with a ` NEAT_REASON ` INFO tag |
633+ | ` happy.vcf.gz ` (+ siblings) | Raw hap.py output preserved for inspection |
634+ | ` fn_attribution.png ` | Optional — only written when ` --plot ` is set |
635+
636+ ** Chromosome-name conventions:** NEAT does NOT silently normalize chrom names
637+ across the reference, golden VCF, called VCF, and BED files. If your
638+ ` mutation_bed ` uses ` 1 ` , ` 2 ` , … but the reference uses ` chr1 ` , ` chr2 ` , …,
639+ ` compare-vcfs ` detects the mismatch up front and writes a warning into
640+ ` comparison_summary.json ` suggesting the rename. Pass `--chrom-aliases
641+ aliases.tsv` (two-column TSV: ` bed_name<TAB >canonical_name`) to apply the
642+ rename at load time. This also handles common mitochondrial variants
643+ (` M ` /` MT ` /` chrM ` /` chrMT ` ).
644+
645+ ** False-negative reason categories:**
646+
647+ | Tag | Meaning |
648+ | -----| ---------|
649+ | ` outside_simulated_contigs ` | FN's chromosome wasn't part of the NEAT run at all |
650+ | ` outside_mutation_bed ` | ` mutation_bed ` was set in the config and the FN falls outside its regions |
651+ | ` outside_target_bed ` | ` target_bed ` was set and the FN falls outside its regions |
652+ | ` unknown ` | None of the above — NEAT has no specific explanation |
653+
654+ ** ` simulation_summary.json ` prerequisite:** Every ` neat read-simulator ` run now
655+ emits ` simulation_summary.json ` into its output dir as part of the standard
656+ artifacts; ` compare-vcfs ` reads this file from ` --neat-run-dir ` to drive
657+ attribution. No extra step required when running NEAT yourself; if you're
658+ working with pre-NEAT-4.5 output, re-run the simulator to produce one.
659+
660+ ** ` hap.py ` install:** ` hap.py ` is an external dependency. The cleanest install
661+ path is a dedicated conda env:
662+
663+ ``` bash
664+ conda create -n hap_py_env -c bioconda -c conda-forge hap.py -y
665+ ```
666+
667+ then point ` --happy-bin ` at ` /path/to/hap_py_env/bin/hap.py ` (or put that
668+ directory on ` $PATH ` ). Without ` hap.py ` available, ` neat compare-vcfs ` exits
669+ with a clear install hint.
670+
601671## Tests
602672
603673We provide unit tests (e.g., mutation and sequencing error models) and basic integration tests for the CLI.
0 commit comments