De Novo Genome Assembly with Flye and hifiasm: A Practical Walkthrough
Assemble a genome from scratch with Flye for ONT reads or hifiasm for PacBio HiFi, when Canu still wins, and how to read the assembly graph.
You have a box of long reads from a species with no reference genome, and the goal is to turn millions of noisy, overlapping fragments into a handful of chromosome-scale contigs. That is de novo assembly, and unlike alignment it has no map to lean on — the answer has to emerge from the reads agreeing with each other. This walkthrough covers the two assemblers that dominate long-read work today: Flye for Oxford Nanopore data and hifiasm for PacBio HiFi, plus when Canu is still the right call and how to actually read the graph they hand you.
Why Long Reads Changed De Novo Assembly
Short-read assembly with tools like SPAdes was always fighting repeats. A 150 bp read cannot span a repetitive element longer than itself, so the assembler stalls at every repeat boundary and you end up with thousands of fragmented contigs. Long reads solve this by physically spanning repeats: a single Nanopore read of 50 kb or a HiFi read of 15-20 kb walks straight through most interspersed repeats and resolves the surrounding unique sequence in one piece.
The trade-off used to be accuracy. Raw Nanopore reads once carried error rates north of 10%, and PacBio's original continuous long reads were similar. Two developments fixed this: PacBio HiFi (circular consensus, or CCS) delivers reads at over 99.9% accuracy, and Nanopore's newer chemistries with R10.4.1 pores plus modern basecallers now routinely clear 99%. If you want a full comparison of the two platforms before committing, see ONT vs PacBio HiFi long-read sequencing compared. The assembler you pick follows directly from which of these two data types you hold.
Flye: The Workhorse for Nanopore Data
Flye is built around the idea of repeat graphs. Instead of demanding clean overlaps up front, it deliberately assembles a rough draft that collapses repeats, then uses the structure of that graph to untangle them. This tolerance for noise is exactly what Nanopore data needs, and it is why Flye remains the default recommendation for ONT assemblies.
A minimal run looks like this:
flye --nano-hq reads.fastq.gz \
--out-dir flye_out \
--threads 16The --nano-hq flag tells Flye the reads come from a modern high-accuracy basecaller (Guppy 5+ or Dorado); use --nano-raw only for older data below roughly 95% accuracy. There is deliberately no genome-size argument required in recent versions — Flye estimates coverage itself — though you can still pass --genome-size 120m as a hint for very fragmented input. The key outputs are assembly.fasta, the contigs themselves, and assembly_graph.gfa, the graph you will inspect below.
Do not skip read QC just because the reads are long. Run NanoPlot or nanoq first and check the read-length N50 and mean quality. A library dominated by short, degraded fragments will assemble badly no matter how good the tool is, and no assembler can invent sequence that the reads never covered.
hifiasm: Purpose-Built for PacBio HiFi
If your reads are HiFi, hifiasm is the tool. It exploits the near-perfect accuracy of HiFi reads to build a phased assembly string graph, and its headline feature is haplotype resolution: from a single diploid sample it can output both haplotypes rather than a mashed-together consensus that flip-flops between the two parental copies.
hifiasm -o sample.asm \
-t 32 \
hifi_reads.fastq.gzhifiasm writes its graphs in GFA format. The primary assembly you usually want is sample.asm.bp.p_ctg.gfa, while sample.asm.bp.hap1.p_ctg.gfa and sample.asm.bp.hap2.p_ctg.gfa hold the two phased haplotypes. Because the native output is GFA, not FASTA, you convert with a one-line awk:
awk '/^S/{print ">"$2"\n"$3}' sample.asm.bp.p_ctg.gfa > primary.fastahifiasm gets a dramatic quality boost from trio binning or Hi-C data. Feed it maternal and paternal short reads with -1/-2 for trio binning, or the sample's own Hi-C read pairs with --h1/--h2 for proximity-ligation phasing, and the assembly becomes genuinely chromosome-scale and fully haplotype-resolved rather than locally phased. That is the modern route to a true diploid, telomere-to-telomere-style assembly.
When Canu Is Still the Right Call
Canu is the elder of the three, and its reputation for being slow is deserved — it does aggressive all-versus-all overlapping and correction that can take days on a large genome. But it still earns its place. Canu produces excellent results on noisy PacBio CLR data (the pre-HiFi continuous long reads that hifiasm will not touch), it has mature support for low-coverage or unusual libraries, and its explicit correction step can rescue datasets that Flye chokes on. For most projects today you will reach for Flye or hifiasm first, but keep Canu in mind for legacy CLR archives and awkward edge cases.
| Read type | First choice | Why | Avoid |
|---|---|---|---|
| ONT R10 high-accuracy | Flye | Repeat-graph tolerance of residual noise | short-read assemblers |
PacBio HiFi (CCS) | hifiasm | Native phasing, exploits 99.9% accuracy | Canu (needlessly slow) |
| PacBio CLR (legacy) | Canu | Robust correction of noisy reads | hifiasm |
| Low coverage / odd library | Canu | Mature, forgiving pipeline | speed-critical runs |
Reading the Assembly Graph
Both tools hand you a GFA file, and learning to read it is what separates a passable assembly from a well-understood one. A GFA file has segment lines (S) that are your contigs and link lines (L) that record where contig ends overlap. When links form a clean linear chain, you have a resolved chromosome. When they tangle into loops and bubbles, the assembler could not decide how repeats connect.
Load the graph in Bandage and the picture becomes intuitive. Isolated straight lines are happy, fully-resolved contigs. A bubble — two parallel paths between the same two nodes — usually marks a heterozygous region or unresolved haplotype. A knot of nodes with many links is a repeat the reads could not span. Circular nodes that close on themselves are the signature of a complete bacterial chromosome or a plasmid, which is exactly what you hope to see in a microbial assembly. If you are assembling a metagenome rather than a single isolate, these tangles multiply, and the strategy shifts toward binning covered in metagenomics and microbiome analysis.
A single-contig assembly.fasta is not automatically a good assembly. Always inspect the graph. A tool can force a linear sequence out of an ambiguous tangle by making arbitrary choices, and you will only see those choices — and the misassemblies they cause — in the GFA, never in the flat FASTA.
Polishing and Evaluating the Result
After assembly comes polishing: mapping reads back and correcting residual errors. HiFi assemblies from hifiasm are usually accurate enough to skip this, but Nanopore assemblies benefit from a round of Medaka, which uses a neural network trained on ONT signal to fix systematic basecalling errors. For any assembly that also has short reads available, a pass of Pilon or Polypolish cleans up the last indels.
Then you judge the result on three axes. Contiguity is the classic N50 — the contig length at which half the assembly sits in contigs that size or larger; bigger is better, but only alongside the other two axes. Completeness comes from BUSCO or compleasm, which check for the presence of near-universal single-copy orthologs and report percentages of complete, duplicated, fragmented, and missing genes — a duplicated fraction above a few percent hints your haplotypes were not merged. Correctness you assess by mapping reads back and looking for regions of anomalous coverage or clipping, the same SAM/BAM inspection habits you use everywhere else in genomics.
Setting Up the Environment
All three assemblers install cleanly from Bioconda. Keep them in a dedicated environment so their dependencies do not collide with the rest of your stack:
conda create -n assembly -c bioconda -c conda-forge \
flye hifiasm canu bandage nanoq medaka busco
conda activate assemblyIf Bioconda channel setup or environment isolation is new to you, the mechanics are worth understanding up front — see conda environments and Bioconda channels. On Apple Silicon, note that some assembly tools still ship x86-only builds, so you may need an osx-64 environment running under Rosetta rather than native arm64.
Practical Takeaways
- Match the tool to the data:
Flyefor Nanopore,hifiasmfor PacBio HiFi,Canufor legacy CLR and awkward low-coverage libraries. - Never trust a
FASTAwithout reading itsGFAgraph inBandage— bubbles, tangles, and circular contigs tell you what the flat sequence hides. - Use
hifiasmphasing (--h1/--h2Hi-C or-1/-2trio) to get true diploid haplotypes rather than a consensus that switches between parental copies. - Polish Nanopore assemblies with
Medaka; HiFi assemblies are usually clean enough to skip polishing. - Evaluate on three axes together —
N50for contiguity,BUSCOfor completeness, read-mapping for correctness — because any one alone lies. - Run read QC (
NanoPlot,nanoq) before you assemble; no tool recovers coverage the library never had.
De novo assembly rewards patience and skepticism more than raw compute. Get the read QC right, pick the assembler that fits your chemistry, and spend real time in the graph before you call anything finished. Once the environment above is built and a first assembly is in hand, wrapping the QC-assemble-polish-evaluate chain in Snakemake turns a one-off run into something you can rerun on the next genome without retyping every command.