MultiomicsStore
quantnado.dataset.store_multiomics.MultiomicsStore
¶
Unified multi-modal genomic store combining coverage (BAM), methylation (bedGraph), and variant (VCF) data in a single directory.
On-disk layout::
<store_dir>/
coverage.zarr/ (present if BAM files were provided)
methylation.zarr/ (present if bedGraph files were provided)
variants.zarr/ (present if VCF files were provided)
Each sub-store is a self-contained Zarr archive; access them individually
via :attr:coverage, :attr:methylation, and :attr:variants, or use the
high-level helpers on this class.
Example
ms = MultiomicsStore.from_files( ... store_dir="dataset/", ... bam_files=["atac.bam", "meth-rep1.bam"], ... methyldackel_files=["meth-rep1.bedGraph", "meth-rep2.bedGraph"], ... vcf_files=["snp.vcf.gz"], ... ) ms.modalities ['coverage', 'methylation', 'variants'] ms.coverage.sample_names ['atac', 'meth-rep1'] ms.methylation.to_xarray() ms.variants.extract_region("chr21:5000000-6000000")
Source code in quantnado/dataset/store_multiomics.py
chromosomes
property
¶
Sorted union of chromosome names across all modalities.
samples
property
¶
Sample names available per modality.
Returns:
| Type | Description |
|---|---|
dict
|
Mapping modality name → list of sample names. |
all_sample_names
property
¶
Ordered union of sample names across all modalities.
from_files
classmethod
¶
from_files(
store_dir: Path | str,
bam_files: list[str | Path] | None = None,
methyldackel_files: list[str | Path] | None = None,
cxreport_files: list[str | Path] | None = None,
mc_files: list[str | Path] | None = None,
hmc_files: list[str | Path] | None = None,
vcf_files: list[str | Path] | None = None,
chromsizes: str | Path | dict[str, int] | None = None,
metadata: DataFrame
| Path
| str
| list[Path | str]
| None = None,
*,
bam_sample_names: list[str] | None = None,
methyldackel_sample_names: list[str] | None = None,
cxreport_sample_names: list[str] | None = None,
mc_hmc_sample_names: list[str] | None = None,
vcf_sample_names: list[str] | None = None,
filter_chromosomes: bool = True,
overwrite: bool = True,
resume: bool = False,
sample_column: str = "sample_id",
chunk_len: int = DEFAULT_CHUNK_LEN,
construction_compression: str = "default",
local_staging: bool = False,
staging_dir: "Path | str | None" = None,
log_file: "Path | None" = None,
max_workers: int = 1,
test: bool = False,
stranded: list[str] | dict[str, str] | None = None,
) -> "MultiomicsStore"
Create a MultiomicsStore from genomic data files.
At least one of bam_files, methyldackel_files, or vcf_files
must be provided. Any omitted modality is simply absent from the store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store_dir
|
Path or str
|
Output directory. Created if it does not exist. |
required |
bam_files
|
list of Path
|
BAM files for per-base coverage storage. |
None
|
methyldackel_files
|
list of Path
|
MethylDackel CpG bedGraph files for methylation storage. |
None
|
vcf_files
|
list of Path
|
VCF.gz files (one per sample) for variant storage. |
None
|
chromsizes
|
str, Path, or dict
|
Chromosome sizes for the coverage store. Extracted from the first BAM file if not provided. |
None
|
metadata
|
DataFrame, Path, or str
|
Sample metadata CSV attached to all sub-stores. Each sub-store's sample names are used to subset the metadata automatically. |
None
|
bam_sample_names
|
list of str
|
Override sample names for BAM files (default: file stems). |
None
|
methyldackel_sample_names
|
list of str
|
Override sample names for bedGraph files (default: file stems).
Useful when MethylDackel embeds genome/suffix in the filename,
e.g. |
None
|
vcf_sample_names
|
list of str
|
Override sample names for VCF files (default: filename before first dot). |
None
|
filter_chromosomes
|
bool
|
Keep only canonical chromosomes ( |
True
|
overwrite
|
bool
|
Overwrite existing sub-stores. |
True
|
resume
|
bool
|
Resume processing an existing sub-store, skipping completed samples. |
False
|
sample_column
|
str
|
Column in |
"sample_id"
|
chunk_len
|
int
|
Zarr chunk size for the position dimension (coverage store only). |
65536
|
construction_compression
|
('default', 'fast', 'none')
|
Build-time compression profile for the coverage store. |
"default"
|
local_staging
|
bool
|
Build the coverage store under local scratch storage before publishing. |
False
|
staging_dir
|
str or Path
|
Scratch directory for local staging. Defaults to system temp dir. |
None
|
log_file
|
Path
|
Path to write BAM processing logs. |
None
|
max_workers
|
int
|
The number of threads used to process chromosomes in parallel. Samples are processed sequentially to keep memory usage low. |
1
|
test
|
bool
|
Restrict coverage to chr21/chr22/chrY (for testing). |
False
|
stranded
|
list of str or dict
|
Strand-specific coverage configuration. Pass a list of sample names
to use
Example:: |
None
|
Source code in quantnado/dataset/store_multiomics.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
open
classmethod
¶
Open an existing MultiomicsStore directory.
Source code in quantnado/dataset/store_multiomics.py
set_metadata
¶
Attach metadata to all sub-stores.
Each store is updated using the subset of metadata that matches its
own sample names — samples not present in that store are ignored.
Source code in quantnado/dataset/store_multiomics.py
get_metadata
¶
Combined metadata across all modalities.
Returns a DataFrame indexed by sample_id with one row per unique
sample. A modalities column lists which modalities each sample
appears in.