Files
hifiasm/README.md
2020-06-27 12:27:16 -04:00

7.0 KiB

Getting Started

# Install hifiasm (requiring g++ and zlib)
git clone https://github.com/chhylp123/hifiasm
cd hifiasm && make
# Assembly
./hifiasm -o NA12878.asm -t 32 NA12878.fq.gz

Introduction

Hifiasm is a fast haplotype-resolved de novo assembler for PacBio Hifi reads. Unlike most existing assemblers, hifiasm starts from uncollapsed genome. Thus, it is able to keep the haplotype information as much as possible.

For non-trio assembly, the input of hifiasm is the PacBio Hifi reads in fasta/fastq format, and its outputs consist of:

  1. Haplotype-resolved raw unitig graph in GFA format (prefix.r_utg.gfa). This graph keeps all haplotype information, including somatic mutations and recurrent sequencing errors.
  2. Haplotype-resolved processed unitig graph without small bubbles (prefix.p_utg.gfa). Small bubbles might be caused by somatic mutations or noise in data, which are not the real haplotype information.
  3. Primary assembly contig graph (prefix.p_ctg.gfa). This graph collapses different haplotypes.
  4. Alternate assembly contig graph (prefix.a_ctg.gfa). This graph consists of all assemblies that are discarded in primary contig graph.

For trio assembly, the input of hifiasm is the PacBio Hifi reads in fasta/fastq format, and the paternal/maternal trio indexes generated by yak count (see https://github.com/lh3/yak). The outputs consist of:

  1. Haplotype-resolved raw unitig graph in GFA format (prefix.r_utg.gfa). This graph keeps all haplotype information.

  2. Phased paternal/haplotype1 contig graph (prefix.hap1.p_ctg.gfa). This graph keeps the phased paternal/haplotype1 assembly.

  3. Phased maternal/haplotype2 contig graph (prefix.hap2.p_ctg.gfa). This graph keeps the phased maternal/haplotype2 assembly.

In addition, hifiasm also outputs three binary files that save all overlap information (prefix.ec.bin, prefix.ovlp.reverse.bin, prefix.ovlp.source.bin). With these files, hifiasm can avoid the time-consuming all-to-all overlap calculation step, and do the assembly directly and quickly. This might be helpful when you want to get an optimized assembly by multiple rounds of experiments with different parameters.

Hifiasm is a standalone and lightweight assembler, which does not need external libraries (except zlib). For large genomes, it can generate high-quality primary assembly in a few hours. Hifiasm has been tested on various large and complex datasets. The results are as follows:

Dataset GSize Cov Asm options CPU time Wall time RAM N50
[Mouse (C57/BL6J)] 2.7Gb x25 -t48 -l0 172.9h 4.8h 76G 21.1Mb
[Maize (B73)] 2.2Gb x22 -t48 -l0 203.2h 5.1h 68G 36.7Mb
[Strawberry] 0.8Gb x36 -t48 -D10 152.7h 3.7h 91G 17.8Mb
[Mountain yellow-legged frog] 9.0Gb x29 -t48 2834.3h 69.0h 463G 9.3Mb
[Redwood] 26.5Gb x28 -t64 3890.3h 65.5h 699G 5.4Mb
[CHM13] 3.1Gb x32 -t48 -l0 310.7h 8.2h 114G 88.1Mb
[HG00733] 3.1Gb x33 -t48 269.1h 6.9h 135G 70.0Mb
[HG002] 3.1Gb x36 -t48 305.4h 7.7h 137G 98.7Mb

Hifiasm also can produce high-quality fully resolved assembly. We tested it on the following trio-binning datasets:

Dataset GSize Cov Asm options CPU time Wall time RAM N50
HG00733: [child], [father], [mother] 3.1Gb x36 -t48 305.4h 7.7h 137G 98.7Mb

Usage

For Hifi reads assembly, a typical command line looks like:

./hifiasm -o NA12878.asm -t 32 NA12878.fq.gz

where NA12878.fq.gz is the input reads and -o specifies the output files. In this example, all output files can be found at NA12878.asm.*. -t specifies the number of CPU threads. Note that at first run, hifiasm will save all overlaps to disk, which can avoid the time-consuming all-to-all overlap calculation next time. For hifiasm, once the overlap information has been obtained during the previous run in advance, it is able to load all overlaps from disk and then directly do assembly. If you want to ignore the pre-computed overlap information, please specify -i.

Please note that some old Hifi reads may consist of short adapters. To improve the assembly quality, adapters should be removed by -z as follow:

./hifiasm -o butterfly.asm -t 42 -z 20 butterfly.fq.gz

In this example, hifiasm will remove 20 bases from both ends of each read.

For trio assembly, first the trio indexes of paternal/maternal should be generated by yak count (see https://github.com/lh3/yak):

./yak count -k31 -b37 -t16 -o mat.yak mat.fq.gz
./yak count -k31 -b37 -t16 -o pat.yak pat.fq.gz

and then run hifiasm as follow:

./hifiasm -o NA12878.asm -t 32 -1 pat.yak -2 mat.yak NA12878_1.fq.gz NA12878_2.fq.gz

Getting Help

For detailed description of options, please see man ./hifiasm.1. The -h option of hifiasm also provides simple description of options. If you have further questions, please raise an issue at the issue page.

Limitations and future works

  1. The running time and memory usage should be further reduced.

  2. The N50 should be further improved.