Files

1690 lines
35 KiB
HTML
Raw Permalink Normal View History

2026-04-16 22:38:20 +02:00
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
2026-08-15 20:56:29 +02:00
<link rel="prev" href="../../usage/predicates/">
2026-04-16 22:38:20 +02:00
<link rel="next" href="../vcf/">
2026-04-16 22:38:20 +02:00
<link rel="icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.6">
<title>Index construction and on-disk layout - obiskim — User Guide</title>
2026-04-16 22:38:20 +02:00
<link rel="stylesheet" href="../../assets/stylesheets/main.484c7ddc.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
2026-08-15 20:56:29 +02:00
<a href="#index-construction-and-on-disk-layout" class="md-skip">
2026-04-16 22:38:20 +02:00
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../.." title="obiskim — User Guide" class="md-header__button md-logo" aria-label="obiskim — User Guide" data-md-component="logo">
2026-04-16 22:38:20 +02:00
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
obiskim — User Guide
2026-04-16 22:38:20 +02:00
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Index construction and on-disk layout
2026-04-16 22:38:20 +02:00
</span>
</div>
</div>
</div>
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../.." title="obiskim — User Guide" class="md-nav__button md-logo" aria-label="obiskim — User Guide" data-md-component="logo">
2026-04-16 22:38:20 +02:00
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
obiskim — User Guide
2026-04-16 22:38:20 +02:00
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." class="md-nav__link">
<span class="md-ellipsis">
Home
</span>
</a>
</li>
<li class="md-nav__item">
2026-08-15 20:56:29 +02:00
<a href="../../installation/" class="md-nav__link">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Installation
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Theory
2026-04-16 22:38:20 +02:00
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
2026-08-15 20:56:29 +02:00
Theory
2026-04-16 22:38:20 +02:00
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--nested">
2026-04-16 22:38:20 +02:00
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_1" >
<label class="md-nav__link" for="__nav_3_1" id="__nav_3_1_label" tabindex="0">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
Kmer indexing
2026-04-16 22:38:20 +02:00
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_1_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_1">
<span class="md-nav__icon md-icon"></span>
Kmer indexing
2026-04-16 22:38:20 +02:00
</label>
<ul class="md-nav__list" data-md-scrollfix>
2026-04-16 22:38:20 +02:00
<li class="md-nav__item">
<a href="../../theory/kmer_indexing/encoding/" class="md-nav__link">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
DNA encoding
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../theory/kmer_indexing/kmers/" class="md-nav__link">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
Kmers
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../theory/kmer_indexing/minimizer_selection/" class="md-nav__link">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Minimizer selection
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../theory/kmer_indexing/superkmers/" class="md-nav__link">
<span class="md-ellipsis">
Super-kmers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../theory/kmer_indexing/indexing_architecture/" class="md-nav__link">
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Partitioning and indexing architecture
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../theory/kmer_indexing/entropy_filter/" class="md-nav__link">
<span class="md-ellipsis">
Low-complexity kmer filter
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_2" >
<label class="md-nav__link" for="__nav_3_2" id="__nav_3_2_label" tabindex="0">
<span class="md-ellipsis">
Phylogeny
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_2">
<span class="md-nav__icon md-icon"></span>
Phylogeny
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_2_1" >
<label class="md-nav__link" for="__nav_3_2_1" id="__nav_3_2_1_label" tabindex="0">
<span class="md-ellipsis">
Kmer-based
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_3_2_1_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_2_1">
<span class="md-nav__icon md-icon"></span>
Kmer-based
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../theory/phylogeny/kmer_based/kmer_set_distances/" class="md-nav__link">
<span class="md-ellipsis">
Whole k-mer set distances
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_2_2" >
<label class="md-nav__link" for="__nav_3_2_2" id="__nav_3_2_2_label" tabindex="0">
<span class="md-ellipsis">
SNP-based
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_3_2_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_2_2">
<span class="md-nav__icon md-icon"></span>
SNP-based
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../theory/phylogeny/snp_based/central_snp_model/" class="md-nav__link">
<span class="md-ellipsis">
Central-position SNP model
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../theory/phylogeny/snp_based/gamma_rate_heterogeneity/" class="md-nav__link">
<span class="md-ellipsis">
Gamma rate heterogeneity
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../theory/phylogeny/snp_based/sankoff_model/" class="md-nav__link">
<span class="md-ellipsis">
Sankoff model
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../theory/phylogeny/snp_based/sampling_design/" class="md-nav__link">
<span class="md-ellipsis">
Sampling design
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
2026-04-16 22:38:20 +02:00
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" >
<label class="md-nav__link" for="__nav_4" id="__nav_4_label" tabindex="0">
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Usage
2026-04-16 22:38:20 +02:00
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
2026-08-15 20:56:29 +02:00
Usage
2026-04-16 22:38:20 +02:00
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
2026-08-15 20:56:29 +02:00
<a href="../../usage/superkmer/" class="md-nav__link">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
superkmer
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
<li class="md-nav__item">
2026-08-15 20:56:29 +02:00
<a href="../../usage/index_command/" class="md-nav__link">
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
index
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/merge/" class="md-nav__link">
<span class="md-ellipsis">
merge
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/filter/" class="md-nav__link">
<span class="md-ellipsis">
filter
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/select/" class="md-nav__link">
<span class="md-ellipsis">
select
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/query/" class="md-nav__link">
<span class="md-ellipsis">
query
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/dump/" class="md-nav__link">
<span class="md-ellipsis">
dump
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/annotate/" class="md-nav__link">
<span class="md-ellipsis">
annotate
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/phylo/" class="md-nav__link">
<span class="md-ellipsis">
phylo
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/unitig/" class="md-nav__link">
<span class="md-ellipsis">
unitig
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/estimate/" class="md-nav__link">
<span class="md-ellipsis">
estimate
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/convert/" class="md-nav__link">
2026-08-15 20:56:29 +02:00
<span class="md-ellipsis">
convert
2026-08-15 20:56:29 +02:00
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/utils/" class="md-nav__link">
<span class="md-ellipsis">
utils
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/pack/" class="md-nav__link">
<span class="md-ellipsis">
pack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../usage/predicates/" class="md-nav__link">
<span class="md-ellipsis">
Predicates and taxonomy paths
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
</ul>
</nav>
</li>
2026-08-15 20:56:29 +02:00
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" checked>
<label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
<span class="md-ellipsis">
Formats
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
Formats
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Index construction and on-disk layout
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Index construction and on-disk layout
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#construction-pipeline" class="md-nav__link">
<span class="md-ellipsis">
Construction pipeline
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#minimal-perfect-hash-function-mphf" class="md-nav__link">
<span class="md-ellipsis">
Minimal perfect hash function (MPHF)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#evidence-exact-vs-approximate" class="md-nav__link">
<span class="md-ellipsis">
Evidence: exact vs. approximate
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#on-disk-layout" class="md-nav__link">
<span class="md-ellipsis">
On-disk layout
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../vcf/" class="md-nav__link">
<span class="md-ellipsis">
VCF pseudo-alignment
</span>
</a>
</li>
2026-08-15 20:56:29 +02:00
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../architecture/" class="md-nav__link">
<span class="md-ellipsis">
Architecture notes
</span>
</a>
</li>
2026-04-16 22:38:20 +02:00
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
2026-08-15 20:56:29 +02:00
<a href="#construction-pipeline" class="md-nav__link">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Construction pipeline
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
<li class="md-nav__item">
2026-08-15 20:56:29 +02:00
<a href="#minimal-perfect-hash-function-mphf" class="md-nav__link">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Minimal perfect hash function (MPHF)
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
<li class="md-nav__item">
2026-08-15 20:56:29 +02:00
<a href="#evidence-exact-vs-approximate" class="md-nav__link">
2026-04-16 22:38:20 +02:00
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
Evidence: exact vs. approximate
2026-04-16 22:38:20 +02:00
</span>
</a>
</li>
<li class="md-nav__item">
2026-08-15 20:56:29 +02:00
<a href="#on-disk-layout" class="md-nav__link">
<span class="md-ellipsis">
2026-08-15 20:56:29 +02:00
On-disk layout
</span>
</a>
2026-04-16 22:38:20 +02:00
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
2026-08-15 20:56:29 +02:00
<h1 id="index-construction-and-on-disk-layout">Index construction and on-disk layout</h1>
<h2 id="construction-pipeline">Construction pipeline</h2>
<p>Building an index (<a href="../../usage/index_command/"><code>index</code></a>) proceeds through a fixed sequence of phases, each operating independently per partition (see <a href="../../theory/kmer_indexing/indexing_architecture/">Partitioning and indexing architecture</a>):</p>
2026-08-15 20:56:29 +02:00
<ol>
<li><strong>Scatter.</strong> A single streaming pass over the input. Each sequence fragment is cut at non-ACGT bases, passed through the low-complexity entropy filter (see <a href="../../theory/kmer_indexing/entropy_filter/">Low-complexity kmer filter</a>), and any resulting segment shorter than k is dropped. Surviving segments are decomposed into super-kmers, canonicalized, and routed by <code>hash(minimizer) mod n_partitions</code> into one file per partition. The number of partitions is always a power of two, so this routing amounts to keeping the low bits of the hash.</li>
2026-08-15 20:56:29 +02:00
<li><strong>Dereplication.</strong> Within each partition, identical super-kmer sequences are merged and their occurrence counts summed. This count is per super-kmer, not per kmer — a kmer's true abundance is the sum of the counts of every super-kmer containing it.</li>
<li><strong>Exact counting.</strong> Every kmer in every dereplicated super-kmer is enumerated and its exact total count computed. To accumulate these counts, a provisional minimal perfect hash function is built over the distinct kmers of the partition and a temporary count file is filled through it. Both are working files: they are deleted at the end of the build unless <code>--keep-intermediate</code> is given. A per-genome kmer frequency spectrum is produced at this stage, from the counts as they are before any abundance filtering.</li>
<li><strong>Quorum filtering and local assembly.</strong> The kmers of the dereplicated super-kmers are fed one by one into a local de Bruijn graph of the partition. A kmer whose count falls outside the <code>--min-abundance</code>/<code>--max-abundance</code> range is dropped at this point, and never enters the graph; the super-kmers themselves are not rewritten. The kmers that remain are assembled into unitigs — maximal non-branching runs of the graph — such that every kmer appears exactly once, at one (unitig, offset) location.</li>
<li><strong>MPHF and evidence construction.</strong> The final minimal perfect hash function is built over the canonical kmers that survived, together with the evidence structure needed to verify that a queried kmer was genuinely indexed (see below). Per-genome counts or presence bits are recorded alongside if requested; the counts come from the counting phase.</li>
2026-08-15 20:56:29 +02:00
</ol>
<p>Within each phase, the partitions are independent of one another and are processed in parallel. The phases themselves follow one another over the whole index, and the index records in its <code>index.meta</code> file how far the build has gone (after scatter, after counting, and when fully built). A build that was interrupted can therefore be resumed: the phases already completed are skipped.</p>
2026-08-15 20:56:29 +02:00
<h2 id="minimal-perfect-hash-function-mphf">Minimal perfect hash function (MPHF)</h2>
<p>Each partition's surviving kmers are mapped to a dense range of integer slots by a minimal perfect hash function: no collisions, near-optimal space (a few bits per key), O(1) lookup. Because an MPHF maps <em>any</em> input to some slot — including kmers that were never indexed — a lookup alone cannot distinguish a genuinely indexed kmer from an arbitrary one; every lookup is followed by an evidence check.</p>
<h2 id="evidence-exact-vs-approximate">Evidence: exact vs. approximate</h2>
<p>Three verification modes exist. The exact and approximate modes are selected at build time (<code>index --approx</code>), and any of the three can be reached afterwards with <a href="../../usage/convert/"><code>convert</code></a>:</p>
2026-04-16 22:38:20 +02:00
<ul>
2026-08-15 20:56:29 +02:00
<li><strong>Exact</strong> (default): the hashed slot stores a pointer back into the partition's unitig data. At query time the kmer is reconstructed from that location and compared directly to the query. Zero false positives, at the cost of one extra random read per lookup.</li>
<li><strong>Approximate</strong> (<code>--approx</code>): the slot stores a short fingerprint (<code>--evidence-bits</code> bits) instead of a pointer; verification is a single fingerprint comparison. This trades a small, bounded false-positive rate (<span class="arithmatex">\(1/2^b\)</span> per kmer, reduced further to about <span class="arithmatex">\(1/2^{b \cdot z}\)</span> for a read requiring <span class="arithmatex">\(z\)</span> consecutive matching kmers via the <code>-z</code>/<code>--findere-z</code> parameter) for lower memory and disk usage, since no reconstruction index is needed. See <a href="../../usage/estimate/"><code>estimate</code></a> to explore this trade-off before building.</li>
<li><strong>Hybrid</strong> (<code>convert --hybrid-evidence</code>): both the fingerprint and the exact evidence are kept. A lookup uses the fingerprint, which is fast and approximate, while the exact evidence remains stored alongside it.</li>
2026-04-16 22:38:20 +02:00
</ul>
2026-08-15 20:56:29 +02:00
<h2 id="on-disk-layout">On-disk layout</h2>
<div class="highlight"><pre><span></span><code>📁 &lt;index_root&gt;/
├── 📄 index.meta configuration (k, minimizer size, partition count,
│ evidence mode, counts stored or not), genome list
│ and metadata, build state (empty, scattered,
│ counted, indexed)
├── 📄 .obiskim.lock lock files: commands that read the index share it,
├── 📄 .obiskim.gate commands that write into it hold it exclusively
├── 📁 spectrums/
│ └── 📄 &lt;label&gt;.json per-genome kmer frequency histogram
└── 📁 partitions/
├── 📁 part_00000/
│ └── 📁 index/
│ ├── 📁 layer_0/
│ │ ├── 📄 layer_meta.json number of kmers in this layer
│ │ ├── 📄 unitigs.bin reconstructible kmer sequence data — always kept
│ │ ├── 📄 unitigs.bin.idx random access into unitigs.bin (exact, hybrid)
│ │ ├── 📄 mphf.bin the minimal perfect hash function
│ │ ├── 📄 evidence.bin exact evidence (exact, hybrid)
│ │ ├── 📄 fingerprint.bin approximate evidence (approximate, hybrid)
│ │ ├── 📁 counts/ per-genome kmer counts (if requested)
│ │ └── 📁 presence/ per-genome presence/absence bits
│ └── 📁 layer_1/, layer_2/, … added by later merges, same structure
├── 📁 part_00001/
│ └── …
└── 📁 part_NNNNN/
2026-04-16 22:38:20 +02:00
</code></pre></div>
<p>The build state is stored in <code>index.meta</code> and not in separate marker files: it is what allows an interrupted build to resume. The number of layers of a partition is not stored anywhere either; it is found by looking for <code>layer_0</code>, <code>layer_1</code>, ... until one is missing. A partition that received no kmer at all (which happens with small inputs and many partitions) has no layer on disk.</p>
<p>The matrix directory of a layer, <code>counts/</code> or <code>presence/</code>, exists in three forms, which hold the same information. A freshly built index stores one file per genome, with a small metadata file (for counts, <code>col_000000.pciv</code>, <code>col_000001.pciv</code>, ... and <code>meta.json</code>). The dense packed form, produced by <a href="../../usage/pack/"><code>pack</code></a>, stores the whole matrix in a single file. The sparse packed form, produced by <code>pack --sparse</code> and, by default, by <a href="../../usage/merge/"><code>merge</code></a>, stores for each kmer only the list of genomes that carry it, with the lists shared between kmers deduplicated (for counts, the directory then holds files such as <code>dict_values.bin</code>, <code>singleton.pfiv</code>, <code>multi.pfiv</code> and <code>sparse_meta.json</code>). Which form a layer uses is detected from the files found in the directory.</p>
2026-08-15 20:56:29 +02:00
<p><code>unitigs.bin</code> is the only file from which the indexed kmer content can be fully recovered; it is always retained. Every other file (MPHF, evidence, counts) is derived from it.</p>
<p>A <strong>layer</strong> corresponds to one increment of kmer content added to a partition — most commonly, one <a href="../../usage/merge/"><code>merge</code></a> operation that introduces kmers not already present in the index. The genomes of the merged sources are added as new columns to the count/presence data of the existing layers; only genuinely new kmer content, that is kmers absent from every existing layer of the partition, is assembled into a new layer. A kmer therefore belongs to exactly one layer of its partition. Because of this, merging cost scales with the novel kmer content being added, not with the accumulated size of the index. A query against an index with several layers checks each layer's MPHF in turn.</p>
<p>Sources merged together must share the same kmer size, minimizer size and partition count; any mismatch is rejected rather than silently reconciled. The evidence mode, on the other hand, may differ between sources: as soon as one source is approximate or hybrid, the destination is chosen among the approximate or hybrid sources, and the merged index takes its evidence mode. A count merge additionally requires every source to store counts. Finally, an index whose matrices are already packed, which includes any merge output, can be merged in as a source but not used as the destination, so at least one source must still be unpacked.</p>
<p><a href="../../usage/pack/"><code>pack</code></a> consolidates a partition's per-column files (counts/presence) into a single file, reducing the number of file opens needed at query time; with <code>--sparse</code>, it also switches to the sparse form described above.</p>
2026-04-16 22:38:20 +02:00
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": [], "search": "../../assets/javascripts/workers/search.2c215733.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
<script src="../../assets/javascripts/bundle.79ae519e.min.js"></script>
<script src="https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js"></script>
</body>
</html>