FIREVAT: How an R Package Lets a Genetic Algorithm Hunt for Better Somatic Variant Filters
Instead of hard-coding cutoff rules, FIREVAT searches for the filter settings that keep true cancer mutations and discard sequencing artifacts, even across different variant callers.
- FIREVAT treats somatic variant refinement as an optimization problem, so the package searches for better filter settings instead of freezing expert thresholds into code.
- Its configuration-driven design lets the same engine adapt to different variant callers without rewriting the core logic.
- The objective function is the philosophy of the tool because it scores candidate filters by how well they preserve signal and suppress artifact patterns.
- The repo is built for practical throughput, with early-stop logic and HTML reporting that make refinement usable in real workflows.
The old way assumes you know the right cutoff
Most variant-filtering pipelines start with a simple bet: if a metric crosses a threshold, keep or drop the call. Depth, quality, allele balance, mapping quality. The rules are easy to explain, but in somatic calling they are brittle. Artifact profiles shift with sample quality, sequencing chemistry, and caller behavior.
That is the break FIREVAT makes. It does not treat filtering as a human guessing game. It treats it as a search over candidate filter settings, with the goal of keeping true cancer signal while pushing sequencing noise out of the final set.
| Conventional static filtering | FIREVAT |
|---|---|
| Hand-set thresholds are reused across samples | A Genetic Algorithm searches for sample-specific settings |
| One caller usually means one tuning story | Caller-specific JSON files abstract the input fields |
| Success means fewer variants | Success means better separation of signal from artifact |
| Expert tuning is often opaque | The refinement process is reproducible and report-driven |
FIREVAT treats filtering as an optimization problem
The engine centers on functions such as RunGAMode. The Genetic Algorithm proposes a population of candidate filter sets, scores each one, and then keeps iterating through selection, mutation, and crossover until it converges on a better answer.
What matters here is not the GA machinery by itself. It is the definition of fitness. FIREVAT is not optimizing for a generic statistical score. It is optimizing for a biologically meaningful separation between signal and artifact, using mutational signatures as part of the evaluation.
The objective function is the real philosophy
The objective function is where the repo stops looking like a utility and starts looking like a research framework. The codebase includes multiple objective-function variants, which suggests the authors were not just shipping one recipe. They were testing how to encode good judgment about somatic calls.
# Conceptual shape of the scoring loop
fitness <- objective_fn(
refined_signal = C.refined,
artifact_signal = A.artifactual,
weights = seq.art.sigs.weights.sum
)
# Higher fitness means the filter set
# preserves useful biology while suppressing artifacts.
That is the interesting inversion. A normal filter asks, "Is this variant above or below a cutoff?" FIREVAT asks, "Which filter settings best preserve what the sample is really saying?" That makes the scoring logic the heart of the package, not a supporting detail.
One JSON file changes the caller, not the engine
FIREVAT's other quiet move is abstraction. Instead of baking caller-specific assumptions into the code, it uses JSON configuration files to map fields like QUAL and AD into the filtering engine. That means the same core logic can work across callers as long as the config knows how to read their outputs.
{
"caller": "Mutect2",
"fields": {
"QUAL": {"direction": "POS"},
"AD": {"direction": "NEG"}
},
"vcf_format": "gzip"
}
That design matters more than it first appears. It separates policy from mechanism. The GA does not care whether the raw variants came from one caller or another. It only cares about how the config exposes the features it needs to score candidate filter sets.
Why the package stops early when the sample is already clean
The function CheckIfVariantRefinementIsNecessary is a small but revealing piece of engineering. Before spending compute on optimization, FIREVAT checks whether the sample already looks clean enough to skip refinement.
That is a throughput decision disguised as a quality decision. It says the package is meant for real pipelines, not just elegant demos. If the artifact burden is low, the tool gets out of the way.
The output is not just filtered variants. It is a report clinicians can use
FIREVAT does not stop at optimization. It generates HTML reporting that turns the refinement process into something a human can inspect. In translational genomics, that matters. People want to see what changed, why it changed, and how much confidence they should place in the refined call set.
This is where the package becomes more than backend plumbing. It is a turn-key refinement workflow. The optimizer, the configuration layer, and the report all point in the same direction: make somatic variant cleanup reproducible enough to trust and legible enough to use.
What FIREVAT is better than, and what it is not
| Question | Hand-tuned static filters | FIREVAT |
|---|---|---|
| How does it choose thresholds? | By expert judgment | By search over candidate settings |
| How does it adapt to a sample? | Usually not at all | It can converge on sample-specific filters |
| How portable is it across callers? | Often tied to a specific caller format | Caller-specific JSON config isolates the differences |
| What job does it do best? | Fast, simple cleanup | Refinement when artifact patterns are complex or sample-specific |
FIREVAT is strongest when the artifact landscape is messy and the sample deserves its own answer. It is not a replacement for the caller itself. It is a refinement layer that sits after calling and before downstream interpretation.
Why this repo matters beyond one package
The lasting idea in FIREVAT is bigger than somatic variants. It shows how scientific software can encode a search strategy for expert judgment instead of hard-coding one rule forever. That is a useful pattern well beyond cancer genomics.
When domain knowledge is noisy, incomplete, or sample-dependent, the right move may be to search the space of plausible decisions rather than pretend there is one universal cutoff. FIREVAT is a compact, practical argument for that approach.





