read_bedmethyl

read_bedmethyl(
    path,
    *,
    min_coverage=10,
    sample_id=None,
    mod_code='m',
    manifest=None,
    probe_col='feature_id',
    with_coverage=False,
)

One nanopore bedMethyl file as a per-site methylation fraction.

WHY THIS IS NOT JUST ANOTHER CSV READER. Long-read methylation arrives with a coverage number per site, and coverage is information the array path never had: a CpG read twelve times is measured worse than one read two hundred times, and :func:falconage.technical_se can use that directly. Sites below min_coverage are dropped rather than kept with a wide error bar, because a fraction from three reads takes only four values.

Nanopore reads native DNA, so there is no bisulfite conversion and no conversion-efficiency question – but also no Illumina probe identifier. To score an array-trained clock the sites must be mapped to probe ids, which needs a manifest with genomic coordinates. Without one this returns coordinate-keyed values, which are perfectly good for a clock trained on sequencing and useless for one trained on an array. That is stated rather than papered over: silently returning a matrix no clock can align to is how a user ends up with a coverage error they cannot interpret.

Parameters

Name Type Description Default
mod_code str The modification to take. "m" is 5mC. Nanopore calls 5hmC ("h") in the same file, and adding the two together is a different quantity from what any array measured. 'm'
manifest pd.DataFrame | None Optional frame with chrom, pos and probe_col, to map coordinates onto probe identifiers. None
with_coverage bool Return (beta, coverage) rather than just beta. A second return value rather than Series.attrs: pandas compares attrs for equality when concatenating, and a Series stored in there makes pd.concat raise on the ambiguous truth value. False