Hifiasm
Introduction
Hifiasm is a fast haplotype-resolved de novo assembler, originally designed for PacBio HiFi reads, although currently it also supports Oxford Nanopore R10 simplex reads. Hifiasm automatically switches to Nanopore mode when this type of data is selected, but HiFi and Nanopore reads cannot be combined within the same run.
Depending on the auxiliary data provided alongside the long reads, Hifiasm produces results ranging from a partially phased, best-effort assembly to a fully haplotype-resolved, telomere-to-telomere-quality pair of genomes. A single, most-curated primary genome assembly is always produced. When the sample is diploid, or is being phased with Hi-C for a higher ploidy, the individual haplotype-resolved assemblies are produced as well.
Different phasing strategies are also available, including Trio Binning and Hi-C Phasing, to fully resolve the two haplotypes of the assembly.
Optionally, Oxford Nanopore ultra-long reads can be provided alongside any phasing strategy to further improve contiguity towards telomere-to-telomere assemblies.
Please cite Hifiasm as:
The summary report generated after the assembly computes its statistics with QUAST. Please also cite QUAST as:
Run Hifiasm Assembly
This functionality can be found under Genome Analysis → DNA-Seq de novo Assembly → Hifiasm. The wizard is organized into an Input, a Phasing Strategy, a Configuration, and an Output page (Figure 1, Figure 2, Figure 3, and Figure 4), described below.
Input
- Input Long Reads: Select the PacBio HiFi, or Oxford Nanopore R10 simplex, long reads to assemble. One or more files of the same technology are expected, since Hifiasm cannot handle HiFi and Nanopore reads within a single run.
- Use Ultra-Long Reads: Provide Oxford Nanopore ultra-long reads to improve contiguity towards telomere-to-telomere assemblies. This option can be combined with any phasing strategy (below).
- Ultra-Long Reads: Select the Oxford Nanopore ultra-long read files. Ultra-long reads must always be Oxford Nanopore reads, regardless of whether the main input above is PacBio HiFi or Nanopore R10.
Figure 1. Input page.
Phasing Strategy
Choose one of the following three strategies.
- None: Assembles the long reads only. Phasing relies solely on the heterozygous sites visible within and across overlapping long reads, so this strategy produces a primary assembly plus two partially phased haplotype assemblies.
- Trio Binning: Fully phases the assembly into a paternal and a maternal haplotype assembly, using short sequencing reads from both parents. This strategy always runs the assembler twice, once with the trio information and once without, so an additional unphased primary assembly is produced as well.
- Hi-C Phasing: Uses the long-range contact information from Hi-C reads to produce a primary assembly and two, or more, fully phased haplotype assemblies in the same run.
Trio Binning requires the following short read data from both parents:
- Paternal Reads and Maternal Reads: Select the paternal's and the maternal's short reads. Both single-end and paired-end reads are supported. These reads are used to build a parental k-mer database with yak.
- Yak K-mer Size: K-mer size used by yak to build the parental k-mer databases.
- Yak Bloom Filter Bits: Bloom filter size used by yak.
Hi-C Phasing requires the following paired-end data:
-
Hi-C Reads: Select all the Hi-C read files, both upstream and downstream. Every file is matched into pairs using the patterns below. Hi-C reads must always be paired-end.
-
Paired-End File Matching: When paired-end reads are provided for Trio Binning or Hi-C Phasing, a pattern to distinguish upstream files from downstream files is required. The provided patterns are searched in the filenames right before the extension. The beginning of the filenames should be the same for both files of each pair.
- Upstream Files Pattern: Establish the pattern to recognize upstream files.
- Downstream Files Pattern: Establish the pattern to recognize downstream files.
Info
For example, if the upstream file is SRR037717_1.fastq and the downstream SRR037717_2.fastq, "_1" should be established as the upstream pattern and "_2" as the downstream pattern. Hi-C reads are always paired-end, so these patterns are always required for Hi-C Phasing. For Trio Binning, they are only required once at least one paired-end file is selected among the Paternal or Maternal reads.
Figure 2. Phasing Strategy page.
Configuration
- Ploidy: Number of haplotypes to resolve. Separate haplotype assemblies can only be produced with the Hi-C Phasing strategy. With the None strategy, values above 2 make Hifiasm fall back to a single collapsed, primary-only assembly, although specifying the real ploidy can still improve the quality of this primary assembly. Ploidy is always 2 for Trio Binning, since parental data can only separate two haplotypes.
Duplication Purging and Coverage:
- Collapsed / Primary-Only Assembly: Disables haplotype resolution and produces a single primary assembly, plus alternate contigs, instead of separate haplotype assemblies. This option is recommended for inbred or homozygous samples. It is automatically enabled, with a warning, whenever the None strategy is used with a ploidy greater than 2. It does not apply to Trio Binning.
- Purge Level: Controls how aggressively duplicated haplotigs are purged from the primary or collapsed assembly. A value of 0 disables purging entirely, which is recommended for inbred or homozygous genomes. A value of 3 is Hifiasm's own default and the most aggressive setting.
- Similarity Threshold: Similarity threshold above which two haplotigs are considered duplicates and purged. Lower values purge more aggressively, which is useful for highly heterozygous genomes whose primary assembly comes out much larger than expected.
- Homozygous Coverage: Manually overrides the homozygous read coverage peak that Hifiasm otherwise infers from the k-mer spectrum. Set this value to 0 to let Hifiasm detect it automatically, which is recommended. Override it only if the k-mer spectrum chart, described under Results, shows an implausible coverage threshold.
- Estimated Genome Size: Improves coverage inference during error correction. Leave this field empty for automatic detection. It is mainly useful when automatic detection struggles, for example at very low coverage. Example values: "3g" or "600m".
- Bloom Filter Bits: Bloom filter size for k-mer counting. A value of 0 disables it, which is recommended for small genomes. Higher values, such as 38 or 39, save memory for genomes much larger than human.
Advanced Assembly Options:
- K-mer Size: Length, in base pairs, of the k-mers that Hifiasm samples from the reads to detect overlaps between them.
-
Window Size: Number of consecutive k-mers considered when selecting each minimizer. Larger windows keep fewer minimizers per read, which lowers memory usage and speeds up overlap detection, but can also miss shorter or more divergent overlaps.
Info
A minimizer is the k-mer with the smallest hash value within a window of consecutive k-mers along a read. Hifiasm only needs to index this single representative k-mer for the whole window, so comparing reads through their minimizers is far cheaper than comparing every k-mer, without missing genuine overlaps.
-
Error Correction Rounds: Number of rounds of haplotype-aware error correction. Odd numbers are preferred.
- Adapter Trim (bp): Trims this number of bases from both ends of every read. This is useful for older HiFi data with residual adapter sequence.
Scaffolding and Telomere Identification:
- Dual Scaffolding: Lets the two haplotype assemblies scaffold each other across gaps using their homologous regions. This improves contiguity for diploid assemblies.
- Telomere Motif: Telomeric repeat motif to preserve in telomere-to-telomere assemblies, for example "CCCTAA" for human and vertebrate telomeres. Leave this field empty to disable it.
Figure 3. Configuration page.
Output
The assembly files that Hifiasm actually produces depend on the phasing strategy and on the Collapsed / Primary-Only Assembly option. See Table 1 in the Results section below for details.
- Primary Assembly Fasta: Where to store the most-curated primary, or collapsed, genome assembly. This file is always produced.
- Haplotype 1 / Maternal Assembly Fasta: Where to store the first haplotype-resolved assembly, for the None or Hi-C Phasing strategies, or the maternal haplotype assembly, for Trio Binning. These are mutually exclusive outputs of the same run, so they share this destination.
- Haplotype 2 / Paternal Assembly Fasta: Where to store the second haplotype-resolved assembly, for the None or Hi-C Phasing strategies, or the paternal haplotype assembly, for Trio Binning. These are mutually exclusive outputs of the same run, so they share this destination.
- Alternate Contigs Fasta: Where to store the discarded, or alternate, contigs. This file is only produced for a collapsed, primary-only assembly.
- Save Assembly Graphs (GFA): Also saves the underlying .gfa assembly graphs, and their low-quality-region .bed files, in addition to the curated Fasta files.
- GFA Output Folder: Select a folder to store the assembly graph (.gfa) and low-quality-region (.bed) files.
Figure 4. Output page.
Results
The following table summarizes which assembly Fasta files are produced for each configuration.
Table 1. Assembly Fasta files produced per configuration
| Phasing Strategy | Primary | Haplotype 1 / Maternal | Haplotype 2 / Paternal | Alternate Contigs |
|---|---|---|---|---|
| None | Yes | Yes, unless Collapsed / Primary-Only is enabled, or ploidy is greater than 2 | Yes, unless Collapsed / Primary-Only is enabled, or ploidy is greater than 2 | Only if Collapsed / Primary-Only is enabled, or ploidy is greater than 2 |
| Trio Binning | Yes, from an additional unphased pass | Yes, the maternal assembly | Yes, the paternal assembly | No |
| Hi-C Phasing | Yes | Yes, if ploidy is 2 | Yes, if ploidy is 2 | Only if Collapsed / Primary-Only is also enabled |
- Primary Assembly: The single most-curated genome assembly. For Trio Binning, this file corresponds to the additional unphased assembly obtained from the second Hifiasm pass described in the Introduction.
- Haplotype 1 / Maternal and Haplotype 2 / Paternal Assemblies: The individual haplotype-resolved assemblies. For Trio Binning, these correspond to the fully phased maternal and paternal assemblies.
- Alternate Contigs: The contigs that were purged from the collapsed primary assembly as duplicated haplotigs.
If the "Save Assembly Graphs (GFA)" option is checked, Hifiasm returns the underlying sequence overlap graphs in GFA format, one for each produced assembly, together with a matching low-quality-region file in BED format. Graph files can be visualized with Bandage.
Summary Report
In addition to the resulting Fasta files, a report is generated (Figure 5). The report shows a summary of the DNA-Seq De Novo Assembly results. It contains information about the input sequencing data and a results overview. The Results Overview table shows a number of common statistics, computed reference-free with QUAST for every assembly Fasta file produced by the run:
- N50: This statistic defines the assembly quality in terms of contiguity. N50 is calculated by first ordering every sequence from the longest to the shortest. Next, starting from the longest sequence, the lengths of each sequence are summed up, until this running sum equals one-half of the total length of all sequences in the assembly. The N50 of the assembly is the length of the shortest sequence in this list. Higher values of N50 indicate a better assembly. Note that any Nx statistic is calculated in the same way, for example N75 is calculated summing up all the lengths until the sum equals 75% of the total length.
- L50: Defined as the smallest number of sequences whose lengths sum makes up half of the total assembly length.
Figure 5. Summary report.
Charts
Two charts are also generated after the assembly.
Nx Plot
The Nx plot shows Nx values as x varies from 0 to 100%. See above more information about how Nx statistics are computed. The Nx values are displayed for every assembly Fasta file produced by the run.
Figure 6. Nx plot.
K-mer Spectrum
The k-mer spectrum chart plots the number of distinct k-mers found in the input reads against their coverage, that is, how many times each k-mer occurs across the reads.
For a heterozygous diploid sample, this chart typically shows two peaks: a smaller heterozygous peak, made up of k-mers present in only one haplotype, and a taller homozygous peak at roughly twice that coverage, made up of k-mers present in both haplotypes. For a fully homozygous or inbred sample, only a single peak close to the full read coverage is expected. A small peak at very low coverage corresponds to sequencing errors, and should be clearly separated from the genuine peaks by a visible dip.
Some patterns in this chart signal a problem:
- If the error peak is not clearly separated from the heterozygous or homozygous peak, coverage may be too low, or the error rate too high, for Hifiasm to reliably tell errors apart from real genomic signal.
- An extra peak that does not sit at roughly one or two times the main coverage can indicate contamination from another organism, or a highly repetitive genome region.
- On highly heterozygous samples, the heterozygous peak can become as tall as, or taller than, the homozygous peak. Hifiasm's automatic peak detection can then mistake it for the homozygous peak, which typically results in noticeably unbalanced haplotype assemblies, for example one haplotype assembly much larger than the other.
If the coverage value that Hifiasm reports for the homozygous peak does not match where the real homozygous peak sits in this chart, override the Homozygous Coverage parameter with the correct value, read directly from the chart.
Figure 7. K-mer spectrum chart.
OmicsBox Engine
This tool can be run from the command line via the OmicsBox Engine.
Command: omicsbox hifiasm [options]
Inputs
| Flag | Type | Required | Description |
|---|---|---|---|
--i-hifi-reads-pacbio-hifi |
file (multiple) | No | PacBio HiFi |
--i-hifi-reads-nanopore-raw |
file (multiple) | No | Nanopore Raw |
--i-ul-reads |
file (multiple) | No | Ultra-Long Reads |
--i-paternal-reads-single-end |
file (multiple) | No | Single-End |
--i-paternal-reads-paired-end |
file (multiple) | No | Paired-End |
--i-maternal-reads-single-end |
file (multiple) | No | Single-End |
--i-maternal-reads-paired-end |
file (multiple) | No | Paired-End |
--i-hic-reads-paired-end |
file (multiple) | No | Paired-End |
Parameters
| Flag | Type | Default | Range / Candidates | Required | Description |
|---|---|---|---|---|---|
--use-ul-reads |
boolean | false | No | Use Ultra-Long Reads | |
--phasing-mode |
enum | none | NoneTrio BinningHi-C Phasing |
No | Phasing Strategy [None, Trio Binning, Hi-C Phasing] |
--upstream-pattern |
string | _1 | No | Upstream Files Pattern | |
--downstream-pattern |
string | _2 | No | Downstream Files Pattern | |
--yak-kmer-size |
integer | 31 | 1 – 63 | No | Yak K-mer Size |
--yak-bloom-bits |
integer | 37 | ≥ 0 | No | Yak Bloom Filter Bits |
--ploidy |
integer | 2 | ≥ 2 | No | Ploidy |
--primary-only |
boolean | false | No | Collapsed / Primary-Only Assembly | |
--purge-level |
integer | 3 | 0 – 3 | No | Purge Level |
--similarity-threshold |
double | 0.75 | 0.0 – 1.0 | No | Similarity Threshold |
--homozygous-coverage |
integer | 0 | ≥ 0 | No | Homozygous Coverage |
--estimated-genome-size |
string | No | Estimated Genome Size | ||
--bloom-filter-bits |
integer | 0 | ≥ 0 | No | Bloom Filter Bits |
--kmer-size |
integer | 51 | 1 – 63 | No | K-mer Size |
--window-size |
integer | 51 | ≥ 1 | No | Window Size |
--correction-rounds |
integer | 3 | ≥ 0 | No | Error Correction Rounds |
--adapter-trim-bp |
integer | 0 | ≥ 0 | No | Adapter Trim (bp) |
--dual-scaffolding |
boolean | false | No | Dual Scaffolding | |
--telomere-motif |
string | No | Telomere Motif | ||
--provide-gfa |
boolean | false | No | Save Assembly Graphs (GFA) | |
--output-prefix |
string | assembly | No | Output File Prefix |
Parameter relationships
| Flag | When | Effect | Affected flags |
|---|---|---|---|
--use-ul-reads |
true |
enables | --i-ul-reads |
--phasing-mode |
trio |
enables | --i-paternal-reads-single-end, --i-paternal-reads-paired-end, --i-maternal-reads-single-end, --i-maternal-reads-paired-end, --yak-kmer-size, --yak-bloom-bits |
--phasing-mode |
trio |
disables | --ploidy, --primary-only, --purge-level, --similarity-threshold |
--phasing-mode |
hic |
enables | --upstream-pattern, --downstream-pattern, --i-hic-reads-paired-end |
Global options (
--local-folder,--cloud-folder,--output-format,--config,--detach,--verbose, …) are shared by every Engine tool and are not repeated here — see the OmicsBox Engine reference.






