Pileup image encoding is the process of rendering aligned reads, reference bases, and associated quality metrics into a structured, tensor-like representation where each pixel column corresponds to a genomic position and each row to a read. The red, green, and blue channels are explicitly assigned to encode distinct biological data types—typically the reference base, the alternate allele, and strand or mapping quality information—creating a rich, multi-dimensional feature map for deep learning models.
Glossary
Pileup Image Encoding

What is Pileup Image Encoding?
Pileup image encoding is a data transformation technique that converts the vertical stack of aligned sequencing reads at a candidate genomic locus into a multi-channel image, enabling convolutional neural networks to perform variant calling as a visual classification task.
This encoding strategy, pioneered by DeepVariant, reframes variant calling from a statistical inference problem into an image classification task. By preserving the spatial relationships between reads and the reference genome, the pileup image allows a convolutional neural network to learn complex visual features such as strand bias artifacts, homopolymer indel errors, and mapping quality drop-offs directly from the raw alignment data without relying on hand-crafted statistical filters.
Key Features of Pileup Image Encoding
Pileup image encoding transforms raw sequence alignment data into a structured visual representation, enabling convolutional neural networks to perform variant calling as an image classification task.
Multi-Channel RGB Representation
The core innovation is mapping biological data to standard image channels. Each pixel column represents a genomic position, and each row is a read. The red channel encodes the reference base and reads matching it. The green channel encodes reads with the alternate allele. The blue channel encodes base quality scores. An additional alpha channel often represents strand orientation (forward vs. reverse). This allows a CNN to learn spatial features like strand bias artifacts directly from the pixel patterns.
Candidate Locus Windowing
Encoding does not occur genome-wide. A candidate variant locus is first identified by a traditional caller or heuristic. A fixed-size window (e.g., 221x100 pixels for DeepVariant) is centered on the candidate site. This window captures the local alignment context, including flanking reference sequence and nearby reads that may span the variant. The fixed dimensions ensure a consistent input tensor size for the neural network, regardless of the actual depth of coverage at the locus.
Read Realignment and Haplotype Sorting
Before pixel generation, reads overlapping the candidate window are locally realigned to the reference using algorithms like Smith-Waterman. This corrects for alignment artifacts near indels. Reads are then sorted by haplotype or alignment score to create a consistent vertical ordering. This sorting is critical: it transforms an unordered set of reads into a spatially coherent image where the CNN can learn vertical patterns associated with heterozygous alleles or mapping errors.
Quality Score Encoding in Pixel Intensity
Base quality scores (Phred scale) are not discarded but embedded directly into pixel intensity. A high-quality base matching the reference produces a bright pixel in the red channel. A low-quality base produces a dim pixel. This allows the CNN to learn to down-weight noisy signals automatically. The model learns to distinguish a true variant supported by high-quality mismatches from a sequencing error supported by low-quality mismatches, all from the visual pattern of pixel brightness.
Strand-Specific Channel Encoding
To detect strand bias artifacts, the encoding separates reads by strand. Forward-strand reads and reverse-strand reads are often placed in distinct rows or encoded with different alpha values. A true heterozygous variant should show the alternate allele on both strands. If the green channel signal appears only in the forward-strand rows, the CNN learns to recognize this as a systematic artifact, likely from oxidative damage during library preparation, and will down-weight the variant call.
Reference Sequence as Visual Anchor
The reference genome sequence is always included as the top row of the pileup image, providing a visual anchor for the CNN. This row is encoded in the red channel. The model learns to compare each read row against this reference row to identify mismatches. This explicit representation of the reference eliminates the need for the model to infer the expected base from the read pileup, simplifying the learning task and improving accuracy at repetitive loci.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about converting aligned sequencing reads into image-based representations for deep learning variant callers.
Pileup image encoding is the process of converting a vertical stack of aligned sequencing reads at a candidate genomic locus into a multi-channel red-green-blue (RGB) image where each channel encodes distinct biological and technical information. The reference genome and all reads overlapping a target position are aligned, and for each pixel row (representing a single read) and column (representing a genomic offset), the red channel encodes the base identity (A, C, G, T), the green channel encodes the per-base quality score, and the blue channel encodes strand orientation and other auxiliary signals. This transformation recasts the statistical variant calling problem into a visual classification task solvable by convolutional neural networks like DeepVariant, which learn to recognize patterns of true variants versus sequencing artifacts directly from the image texture.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core concepts, formats, and preprocessing steps that feed into the pileup image encoding pipeline for deep learning-based variant calling.
Neural Pileup Representation
The direct precursor to pileup image encoding, this method structures aligned reads into a multi-channel tensor. Instead of RGB, channels represent base identities, quality scores, and strand information. This tensor is the native input for a convolutional neural network, allowing the model to learn spatial features of true variants versus sequencing artifacts.
Sequence Alignment Map (SAM)
The raw tab-delimited text format storing biological sequences aligned to a reference genome. Each line represents a read and contains:
- Read sequence and base quality scores
- CIGAR string detailing match, insertion, and deletion operations
- Mapping position and flags for strand and pairing info This is the primary data source parsed to generate pileup images.
BAM File
The compressed binary version of the SAM format, essential for high-performance computing. BAM files enable high-speed random access to aligned reads via indexing, allowing variant callers to efficiently query the read stack at a specific candidate locus without loading the entire dataset into memory.
CIGAR String Encoding
A compact representation within alignment files summarizing the alignment operations for a read. Key operations include:
- M: Alignment match (can be a sequence mismatch)
- I: Insertion in the read relative to the reference
- D: Deletion from the reference
- S: Soft-clipped bases This string dictates how bases are positioned vertically in the pileup image.
Base Quality Score Recalibration
A critical preprocessing step before pileup encoding. The sequencer's raw per-base quality scores contain systematic errors. Machine learning models analyze covariation patterns to emit recalibrated, empirically accurate quality scores. Feeding recalibrated scores into the pileup image channels significantly reduces false positive variant calls.
Strand Bias Artifact
A systematic sequencing error where a variant allele appears predominantly on reads from one DNA strand. In a pileup image, this manifests as a color imbalance between forward and reverse strand channels. Deep learning models must learn to recognize this pattern as a technical artifact rather than a true biological mutation.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us