Filtlong: The Long-Read Filter That Lets Short Reads Decide What Is Real

A small C++ tool with a big idea: score noisy Nanopore and PacBio reads against length, quality, and optional reference evidence, then keep the parts most likely to help assembly.

8 min read • View on GitHub • More from rrwick

A long DNA strand lies across a workbench while a precise inspector studies it with a magnifying glass. Some sections are kept, others are cut away, and a stack of short reference fragments sits beside the strand as proof. The scene explains Filtlong’s core idea: it does not just filter reads, it judges which parts are supported by evidence.
Filtlong treats long reads like evidence files. It keeps what is supported, trims what is not, and can use short reads as a truth set.
Key Takeaways

Why Filtlong Treats Reads as Evidence, Not Just Strings

Most long-read QC tools start with a blunt question: is this read good enough to keep? Filtlong asks a better one: which parts of this read are real enough to help an assembler? That shift matters because Nanopore and PacBio data can be long, noisy, and uneven in ways that make simple pass or fail filters wasteful.

Filtlong is a tool for filtering long reads by quality. It can take a set of long reads and produce a smaller, better subset. It uses both read length (longer is better) and read identity (higher is better) when choosing which reads pass the filter.

Ryan Wick, Developer · rrwick/Filtlong

That README line gets to the heart of the project. Filtlong is not trying to be clever for its own sake. It is trying to make a better subset for assembly by mixing long-read utility with a more grounded notion of support.

How Filtlong Decides What to Keep

Under the hood, Filtlong combines several signals. Length matters because longer reads can bridge repeats. Mean quality matters because noisy reads can contaminate assembly. Window quality matters because a read can be mostly fine while hiding a disastrous stretch in the middle.

Filtlong is a ranking system before it is a filter. It scores reads, then decides whether to keep them whole, trim them, or break them into better fragments.

That design is why it feels more like triage than thresholding. A read does not need to be perfect to survive. It only needs to contribute enough useful sequence to be worth keeping.

filtlong --min_length 1000 --keep_percent 90 reads.fastq.gz > filtered.fastq
filtlong --target_bases 500000000 --trim --split reads.fastq.gz > cleaned.fastq

The CLI stays compact because the mental model stays compact. You decide how much data you want, how strict the selection should be, and whether you want Filtlong to salvage good sequence from bad reads.

The Trick Under the Hood: Bloom Filters for Reference Matching

The most interesting mode is reference-aware filtering. When short reads or an assembly are available, Filtlong can treat them as an external truth set. It does that with a Bloom filter of 16-mers, which gives it a fast, memory-light way to ask whether a short DNA word is supported by the reference.

A close-up of a long read broken into regions of support and weakness, with tiny matching stamps floating above it like 16-mer checkpoints. One region is densely marked as supported, the middle is broken and darkened for removal, and the right region is supported again. The image explains how Filtlong can scan a read, mark trustworthy stretches, and ignore unsupported stretches without doing full alignment.
Filtlong turns reference matching into a fast triage loop. Supported bases become stronger candidates, unsupported stretches are downgraded, and the read can be trimmed or split accordingly.

The point is not exact alignment. The point is a probabilistic shortcut that is good enough for ranking and trimming. Filtlong asks whether enough k-mers are present to treat a region as biologically credible, then uses that evidence to boost or downweight the read.

That is why the fallback mode matters too. Without a reference, Filtlong still works from read quality and length. With a reference, it becomes sharper.

Trimming, Splitting, and the Child-Read Pattern

Filtlong does not always treat a bad read as a lost cause. If one section is strong and another is weak, it can trim the bad section or split the read and keep the better fragments as child reads. That is a more intelligent outcome than deleting the whole record.

This matters most for chimeric or partially degraded reads. A single long molecule can contain enough useful sequence to matter, but only if the tool is willing to separate signal from junk. Filtlong is built for that kind of salvage.

In other words, the unit of value is not always the whole read. Sometimes the useful thing is the surviving segment.

Why the CLI Feels Built by Someone Who Actually Uses It

There is craft in the small details. Filtlong accepts suffixes like 500mb or 1.5g, which fits how bioinformaticians think about scale. You can feel that the interface was shaped by real pipelines, not by abstract product thinking.

If you have very deep reads, definitely do some sort of QC/subsampling to bring them down to a more reasonable depth (~50-100×) before assembly. This will not just save assembly time but probably also give you better assemblies.

Ryan Wick, Developer · ONT read QC strategies for assembly

That advice is pragmatic. It also explains why Filtlong has a clear role in pipelines: it is not for every dataset, but it is very good when the input is too deep, too uneven, or too noisy to feed directly into assembly.

Filtlong vs. Simpler Read Filters

Filtlong does not replace every other read filter. It solves a narrower, more interesting problem: pick the most useful reads, or the most useful parts of reads, based on multiple signals. Simpler tools are still useful when the goal is just a quick gate or a random downsample.

ToolInput signalDecision styleReference awareTrims or splits
FiltlongLength, mean quality, window quality, optional reference supportRanks reads and salvages useful partsYesYes
ChopperLength and qscore thresholdsPass or fail filteringNoNo
RasusaTarget depth onlyRandom subsamplingNoNo
fastplongQuality and adapter-like cleanupHybrid cleanup workflowUsually noSometimes

That table is the real comparison story. Filtlong is not the fastest knife. It is the one that makes a judgment call.

What Makes Filtlong Feel Mature

The project has a narrow surface area, a clear mission, and a stable place in long-read workflows. The codebase is small, the C++ is focused, and the behavior is consistent with how working bioinformaticians actually process data.

That is often what maturity looks like in open source. Not breadth. Precision.