Binomial

Reference

BinomialData

Calculates P-value for cytosine residues.

RegionStat

Class for manipulation with region P-value data.

Usage

BSXplorer offers methods to define cytosine methylation status. Assuming the distribution of count of the methylated cytosine reads is binomial, BSXplorer runs a binomial test to calculate cytosine methylation p-value. BinomialData.from_report() reads the methylation report and saves cytosine methylation p-value into .parquet file for further usage.

import bsxplorer as bsx

binom = bsx.BinomialData.from_report(
    file="/path/to/report.txt",
    report_type="bismark",
    save="savename",
    dir="/path/to/work_dir"
)

# class BinomialData can also be initialized from preprocessed file directly
# binom = bsx.BinomialData("path/to/preprocessed.parquet")

Preprocessed methylation p-value report can be used as input report for Metagene or ChrLevels or can be utilized for Gene Body Methylation (gBM) [1] epigenetic mark categorization with RegionStat.

genome = bsx.Genome.from_gff("path/to/annot.gff").gene_body(min_length=0)
region_stat = binom.region_pvalue(genome, methylation_pvalue=.05)

bm, im, um = region_stat.categorise(context="CG", p_value=.05)

This way regions are categorised as BM (Body Methylation), IM (Intermediate Methylated) and UM (Undermethylated).