|
| 1 | +--- |
| 2 | +title: "Using ROOT for genome sequencing" |
| 3 | +layout: post |
| 4 | +excerpt: "A GSoC 2025 project aiming to advance genomic data management by implementing ROOT's next-generation RNTuple format for sequence alignment storage." |
| 5 | +sitemap: false |
| 6 | +author: Aditya Pandey |
| 7 | +permalink: blogs/gsoc25_aditya_pandey_introduction_blog/ |
| 8 | +banner_image: /images/blog/gsoc-banner.png |
| 9 | +date: 2025-05-13 |
| 10 | +tags: gsoc root genome bioinformatics |
| 11 | +--- |
| 12 | + |
| 13 | +### Introduction |
| 14 | + |
| 15 | +I am Aditya Pandey currently a Bachelor of Technology student with experience in C++, Python, |
| 16 | +and algorithm optimization. During Google Summer of Code 2025, I'll be working on the project |
| 17 | +"Using ROOT in the field of genome sequencing" with CERN-HSF. |
| 18 | + |
| 19 | +**Mentors**:Martin Vassilev, Jonas Rembser, Fons Rademakers,Vassil Vassilev |
| 20 | + |
| 21 | + |
| 22 | +### The Challenge of Genomic Data |
| 23 | + |
| 24 | +Genomic sequencing data volumes are growing exponentially, creating performance bottlenecks in |
| 25 | +traditional storage formats. A single human genome sequencing project can generate files ranging |
| 26 | +from 10-30GB, and large-scale initiatives involve thousands of samples. This data tsunami requires |
| 27 | +more efficient storage and query solutions than traditional formats like BAM and CRAM can provide. |
| 28 | +Previous work with the GeneROOT project (a CERN initiative to use ROOT for genomics) has shown |
| 29 | +promising results with the TTree format, demonstrating approximately 4x performance improvements. |
| 30 | + My project aims to build on this foundation by implementing the next-generation RNTuple format, |
| 31 | +which promises even greater efficiency. |
| 32 | + |
| 33 | + |
| 34 | +### Project Description |
| 35 | +My project extends GeneROOT by implementing ROOT's next-generation RNTuple format for genomic data storage and analysis through two main stages: |
| 36 | + |
| 37 | +#### Stage 1: Reproduction and Baseline Establishment |
| 38 | + |
| 39 | +Reproduce and validate previous GeneROOT benchmarks showing 4x performance gains with TTree |
| 40 | +Establish reliable baseline metrics for comparison |
| 41 | +Identify and address performance bottlenecks in the current implementation |
| 42 | +Optimize the existing code before transitioning to RNTuple |
| 43 | +Analyze and compare compression strategies from Samtools/HTSlib and ROOT |
| 44 | + |
| 45 | +#### Stage 2: RNTuple Implementation |
| 46 | + |
| 47 | +Implement a genomic data model using RNTuple's templated field system |
| 48 | +Develop efficient converters between standard genomic formats (BAM/CRAM) and RNTuple |
| 49 | +Create advanced file splitting strategies (by chromosome, region, or read group) |
| 50 | +Implement high-performance query tools leveraging RNTuple's columnar structure |
| 51 | + |
| 52 | +### Compression Strategy Analysis |
| 53 | +A key component of this project involves analyzing the compression techniques used by Samtools/HTSlib and comparing them with ROOT's compression capabilities: |
| 54 | +BGZF (Blocked GZIP Format) in BAM Files |
| 55 | + |
| 56 | +I'll study the 64KB block architecture that enables random access while maintaining gzip compatibility |
| 57 | +Test the nine compression levels (1-9) to determine optimal settings for genomic data |
| 58 | +Analyze the multi-threading implementation for parallel compression/decompression |
| 59 | + |
| 60 | +CRAM Advanced Codecs |
| 61 | + |
| 62 | +Investigate rANS (Asymmetric Numeral Systems) implementations |
| 63 | +Examine CRAM transforms including interleaving, RLE, bit-packing, and striped encoding |
| 64 | +Analyze integration techniques for external codecs like bzip2 and LZMA |
| 65 | + |
| 66 | +The findings from this analysis will inform the implementation of: |
| 67 | + |
| 68 | +Codec library integration with HTSlib's compression libraries where possible |
| 69 | +ROOT-native implementations of key algorithms where direct integration isn't possible |
| 70 | +Reference-based compression similar to CRAM |
| 71 | +Adaptive selection of optimal compression methods based on data characteristics |
| 72 | + |
| 73 | +### Why RNTuple for Genomics? |
| 74 | +RNTuple is ROOT's successor to TTree columnar data storage, offering several advantages for genomic data: |
| 75 | + |
| 76 | +Improved Memory Efficiency: RNTuple's design allows uncompressed data to be directly mapped to memory without further copies due to the clear separation between offset/index data and payload data. This matches the in-memory layout on modern architectures and reduces RAM requirements when processing large genomic datasets. |
| 77 | +Type Safety: RNTuple provides compile-time type-safe interfaces through the use of templates, reducing common programming errors in genomic data processing. This is particularly valuable when handling complex nested data types common in genomic sequence information. |
| 78 | +Enhanced Storage Efficiency: Recent benchmarks show RNTuple achieving 20-35% storage space savings compared to TTree, which already outperforms traditional genomic formats. This translates to significant storage cost reductions for large-scale genomic datasets. |
| 79 | +Optimized Performance: RNTuple demonstrates multiple times faster read throughput than TTree, along with better write performance and multicore scalability. It can fully harness the performance of modern NVMe drives and object stores. |
| 80 | +Columnar Access Pattern: The columnar structure is ideal for genomic region queries that often only access chromosome and position information, avoiding unnecessary data loading. This is particularly important for genomic data, where analysts frequently need to examine specific regions rather than entire sequences. |
| 81 | + |
| 82 | +### Project Architecture |
| 83 | +<img src="/images/blog/genome_sequencing.png" style="display: block; margin-left: auto; margin-right: auto;" width="50%" /> |
| 84 | + |
| 85 | +### Implementation Progress |
| 86 | +I have already made significant progress optimizing the existing GeneROOT codebase. My initial work on ramview.C has shown impressive performance gains through: |
| 87 | + |
| 88 | +Replacing linear search with a two-phase approach combining exponential and binary search |
| 89 | +Implementing dynamic batch processing to reduce I/O operations |
| 90 | +Adding selective branch management to focus resources on necessary data |
| 91 | +Implementing resource optimization that scales based on file size |
| 92 | + |
| 93 | +### Expected Benefits |
| 94 | +This project will deliver tools for handling rapidly growing genomic datasets with significantly improved performance: |
| 95 | + |
| 96 | +Faster genomic region queries through RNTuple's columnar structure |
| 97 | +Better memory efficiency when processing large genomic files |
| 98 | +Enhanced type safety through RNTuple's templated interfaces |
| 99 | +Optimized storage through specialized compression and splitting strategies |
| 100 | +A potential new standard for high-performance genomic data analysis |
0 commit comments