Latest docker image:
weisburd/expansion-hunter@sha256:ed8f7fafb69f6bcb0c70ed76628653e19ce49ce82d0a1c869773c91c3a2ecce7
This modified version of ExpansionHunter introduces the following new features:
- New analysis mode:
--analysis-mode optimized-streamingis like the originalstreamingmode, but uses much less memory (< 10GB on 30x coverage BAMs) and significantly speeds up analysis of large catalogs (> ~10k loci) by introducing 2 key modifications:- It uses simple heuristics to detect which loci can be confidently genotyped using spanning reads alone. For these loci, it quickly computes their genotypes without running the full computationally-expensive ExpansionHunter genotyping algorithm. Since any given individual has fewer than ~5k to 10k large expansions in their genome (see [Weisburd 2023]), this heuristic-based genotyping handles 90+% of loci in genome-wide catalogs, while maintaining overall accuracy within ~2% of the original algorithm (see tool benchmark). If you'd like to use
optimized-streamingmode without this heuristic shortcut, adding--genotyping-approach only-fullturns it off and runs the full genotyping algorithm on every locus (this was previously provided as a separatelow-mem-streaminganalysis mode). - To keep memory usage low and independent of catalog size, this mode reads the BAM/CRAM file twice. The first pass caches all mate pairs that aligned far away (> ~2kb) from each other - a small subset of the reads kept in memory by the original single-pass
streamingmode. The second pass then relies on this cache as it streams through the read data again, genotyping all loci on the fly without needing to keep additional reads in memory beyond the ones that aligned near the locus it's currently processing. Since reading through a file sequentially is relatively fast (taking minutes rather than hours), this two-pass approach isn't much slower than the single-pass approach used by the originalstreamingmode.
- It uses simple heuristics to detect which loci can be confidently genotyped using spanning reads alone. For these loci, it quickly computes their genotypes without running the full computationally-expensive ExpansionHunter genotyping algorithm. Since any given individual has fewer than ~5k to 10k large expansions in their genome (see [Weisburd 2023]), this heuristic-based genotyping handles 90+% of loci in genome-wide catalogs, while maintaining overall accuracy within ~2% of the original algorithm (see tool benchmark). If you'd like to use
June 21, 2026: reservoir sampling now further reduces processing time by downsampling reads at loci with extremely high read depth (see--max-depth).
- Integrated read visualizations: REViewer functionality is now built directly into ExpansionHunter, outputting SVG read pileup images without needing a separate post-processing step (see VariantCatalog docs).
--plot-allgenerates read visualizations for every locus--disable-all-plotsdisables all image generation (overrides catalog settings)PlotReadVisualizationfield in the variant catalog enables conditional image generation based on genotype thresholds (e.g. only visualize when long allele >= 400 repeats)
- Per-allele quality metrics: New
AlleleQualityMetricsin JSON output provides detailed quality information for each allele (see AlleleQualityMetrics docs).- Metrics include QD (quality by depth), strand bias, flank depth, insertion/deletion rates, and more
- These metrics were used to train an Allele Quality Score model on a genome-wide tandem repeat truth set derived from the HG002 and CHM1_CHM13 T2T assemblies plus the assemblies of 50 1kGP/HPRC samples. This model adds 3 probabilities to the output -
pOk,pTooShort, andpTooLong- predicting whether the called allele size is close to, shorter than, or longer than the true allele size. It also outputs thePredictedLengthCorrectionFactor- dividing ExpansionHunter's allele size by this factor should bring it closer to the true allele size, especially for the larger alleles that have 0 spanning reads and wherepOk< 0.5 (see AlleleQualityMetrics docs). --dont-output-quality-metricsdisables quality metrics computation if not needed
- Consensus allele sequences: Consensus nucleotide sequences are now reported for each allele. This is a simplistic first implementation that just collapses confidently-placed (i.e. darker-colored) reads within the REViewer visualization and takes the most common base at each position. Insertions and deletions within the reads are not incorporated into the consensus sequence. Also, any positions not covered by confidently-placed reads are reported as Ns (see Consensus Sequences docs).
--dont-output-consensus-sequencesdisables consensus sequence computation if not needed
- Repeat allele phasing: For loci with more than one repeat (e.g. the CAG and CCG repeats at HTT), a new
RepeatAllelePhasingrecord in the JSON output reports which allele of each repeat is on the same haplotype, along with how many read pairs support that pairing over the next-best one and whether the choice was a tie (see Repeat allele phasing docs). - Motif composition:
--output-motif-composition all-loci(orloci-with-non-ref-motifs, orloci-with-known-motifs) outputs how many times different motifs (including the catalog motif) were observed in the reads aligned to each locus. These counts are written to a new "MotifComposition" section in the output JSON and are reported per locus. When the two allele sizes in a genotype differ by 2 or more repeats and reads can be unambiguously assigned to one or the other allele based on repeat length, per-allele counts are also reported. Optionally, a "KnownMotifs" list can be added to the locus definition in the input catalog to guide motif discovery (see Motif composition docs). Enabling motif composition output increases runtime by ~5% and doesn't affect memory usage. The output JSON file size increases by 5% to 10%. - Misc. new convenience features and options:
- supports gzip-compressed input catalogs, and provides a
-zoption to compress the output files - Converts N chars error to a warning: changes
Flanks can contain at most 5 characters N but found x Nsfrom an error to a warning. ExpansionHunter now just prints this warning and skips the offending locus instead of exiting. --start-with,--n-loci, and--sort-catalog-byoptions allow processing a fixed number of loci from the input catalog--locusfor filtering the input catalog to specific LocusId(s)--reads-indexexplicitly specifies the BAM/CRAM index file path or URL, useful when the index is in a different location than the reads file or when auto-detection doesn't work with cloud URLs--regionfor filtering the input catalog to a specific genomic interval--skip-hom-refdoesn't output results for loci where the genotype is homozygous reference, reducing output file size--skip-missing-genotypesdoesn't output results for loci with a missing genotype (e.g. due to low coverage)--copy-catalog-fieldscopies extra annotation fields (e.g. Gene, Diseases) from the input catalog to the output JSON. By default, ExpansionHunter simply ignores custom fields in the input catalog.--enable-bamlet-outputwrites a "bamlet" BAM file containing the realigned reads for each locus--genotyping-approach <auto|only-quick|only-full>selects which genotyper(s)optimized-streamingmode runs on each locus.auto(the default) uses the quick spanning-read heuristic where it can confidently genotype a locus, while using the full genotyping algorithm elsewhere.only-quickskips full genotyping (except atRareRepeatloci that listOfftargetRegions, which are always genotyped as inseekingmode) and is provided mainly for benchmarking or debugging purposes.only-fullruns the full genotyping algorithm on every locus (previouslyonly-fullwas implemented as a separate--analysis-modecalledlow-mem-streaming).--cache-matesenables a cross-locus read cache inseekinganalysis mode to make it run faster on catalogs where many loci have the same motif (e.g. if your catalog contains mostlyCGGandCCGrepeats). Since in-repeat reads from all these loci will typically mismap to the same few places in the genome, caching the reads in-memory can substantially reduce disk access latency. For large catalogs (> ~5k loci), it is still better to useoptimized-streaming. Inoptimized-streamingmode, the cache is used only forRareRepeatloci that listOfftargetRegions, since they are genotyped as inseekingmode.--max-depth(default150) limits the number of reads processed per locus inoptimized-streamingmode using reservoir sampling. This bounds memory and runtime at extremely high-coverage loci (e.g. centromeric/satellite repeats) where millions of reads can pile up and slow down processing.RareRepeatloci that listOfftargetRegionsare not capped, since they are genotyped as inseekingmode. Set to0to disable the cap.
- supports gzip-compressed input catalogs, and provides a
- Input BAM or FASTA can be read directly from cloud buckets: allows direct access to remote BAM/CRAM or reference FASTA files in Google Cloud Storage or S3 via functionality provided by htslib
- for access to private buckets, set environment variable:
export GCS_OAUTH_TOKEN=$(gcloud auth application-default print-access-token) - for access to requester-pays buckets, also set environment variable:
export GCS_REQUESTER_PAYS_PROJECT=<your gcloud project>
- for access to private buckets, set environment variable:
Thank you to @maarten-k for testing out early versions and introducing substantial optimizations to the build process.
If you use this modified version of ExpansionHunter, in addition to citing the original ExpansionHunter paper [1], please cite:
Insights from a genome-wide truth set of tandem repeat variation
Ben Weisburd, Grace Tiao, Heidi L. Rehm
bioRxiv 2023.05.05.539588; doi: https://doi.org/10.1101/2023.05.05.539588
There are a number of regions in the human genome consisting of repetitions of short unit sequence (commonly a trimer). Such repeat regions can expand to a size much larger than the read length and thereby cause a disease. Fragile X Syndrome, ALS, and Huntington's Disease are well known examples.
Expansion Hunter aims to estimate sizes of such repeats by performing a targeted search through a BAM/CRAM file for reads that span, flank, and are fully contained in each repeat.
Linux and macOS operating systems are currently supported.
Expansion Hunter is provided under the terms and conditions of the Apache License Version 2.0. It relies on several third party packages provided under other open source licenses, please see COPYRIGHT.txt for additional details.
Installation instructions, usage guide, and description of file formats are contained in the docs folder.
- A genome-wide STR catalog containing polymorphic repeats with similar properties to known pathogenic and functional STRs
- REViewer, a tool for visualizing alignments of reads in regions containing tandem repeats
The method is described in the following papers:
-
Egor Dolzhenko, Joke van Vugt, Richard Shaw, Mitch Bekritsky, and others, Detection of long repeat expansions from PCR-free whole-genome sequence data, Genome Research 2017
-
Egor Dolzhenko, Viraj Deshpande, Felix Schlesinger, Peter Krusche, Roman Petrovski, and others, ExpansionHunter: A sequence-graph based tool to analyze variation in short tandem repeat regions, Bioinformatics 2019