Skip to main content

write_bedgraph

Function write_bedgraph 

Source
pub fn write_bedgraph<W: Write>(
    writer: &mut W,
    dict: &SequenceDictionary,
    per_contig: &[(String, ContigMethylation, Vec<u8>, Vec<Haplotype>)],
) -> Result<()>
Expand description

Write a complete population-fraction bedGraph — header line followed by per-CpG records for every contig in per_contig.

Each per_contig entry is (contig_name, ContigMethylation, reference, haplotypes_for_this_contig). The haplotypes slice must be the same per-haplotype layout used to build ContigMethylation so per-haplotype ref→hap coordinate mappings line up; pass an empty slice for variant-free contigs.

dict is accepted for future contig-order validation but is not used yet.

§Errors

Returns an error if writing to writer fails.