Expand description
Per-CpG methylation classifier and MT/MB FORMAT VCF reader/writer used by
the methylate subcommand and the methylation-aware simulate path.
VCF MT/MB FORMAT-field schema, per-CpG ownership classifier, and
reader/writer for methylation-annotated VCFs.
Each CpG on each haplotype is routed to exactly one VCF record by
[classify_cpgs]: methylation-only records for reference-coordinate
CpGs outside any variant span, and variant-record annotations for CpGs
inside or straddling a variant’s alt allele.
Structs§
- Methylation
VcfRecords - Pre-parsed methylation VCF body: header MT/MB detection plus per-contig
record bytes ready for
read_contig_methylation.
Enums§
- Classify
Error - Error returned by
classify_cpgswhen the input violates the classifier’s preconditions: phased genotypes only, and no two variants whose REF spans overlap while both alt alleles land on a shared haplotype. - CpgPlacement
- Where a single CpG (haplotype-coord pair) is recorded in the methylated VCF.
- Read
Error - Error returned by
read_contig_methylationwhen the input VCF stream violates the writer’s encoding contract.
Constants§
- DEFAULT_
METHYLATE_ SAMPLE - Default sample column name used by
methylatewhen no VCF sample is provided.
Functions§
- classify_
cpgs - Classify every CpG on every haplotype into
CpgPlacements. - load_
contig_ methylation_ from_ records - Look up the parsed methylation truth for a single contig from the
pre-parsed
MethylationVcfRecords. - parse_
methylation_ vcf - Read and split a methylation-annotated VCF into
MethylationVcfRecordsin a single pass: decompresses (BGZF or plain) once, detects whether the header declares MT/MB, and partitions data lines by contig. - read_
contig_ methylation - Parse MT/MB records from a per-contig VCF byte slice back into a
crate::meth::ContigMethylation. - vcf_
has_ mt_ mb_ records - Check whether a VCF actually carries methylation truth: the header must
declare both
MTandMBFORMAT fields and at least one data record must listMT(orMB) in its FORMAT column. - write_
contig - Write all methylation-only records for one contig as VCF text rows.
- write_
vcf_ header - Write a VCF header for a methylation-annotated VCF to
writer.