Quickstart
Train and run MethylSeg on a WGBS or TCGA HM450K sample.
[4]:
from pathlib import Path
from methylseg import MethylSegPathway, MethylationStates
from methylseg.helper_classes import DATA_DIR
reference_dir = DATA_DIR / "reference_files"
# WGBS: replace these with your own sample name and count table.
# sample_name = "WGBS_colon-primary-tumor_1"
# sample_file = reference_dir / "WGBS_colon-primary-tumor_1_wgbs.tsv.gz"
# resolution = "wgbs"
# TCGA/HM450K alternative:
sample_name = "TCGA-BD-A3EP-01A"
sample_file = reference_dir / "TCGA-BD-A3EP-01A_450k.tsv.gz"
resolution = "450k"
sample_info, removed_df = MethylSegPathway.prepare_sample_info(
sample_name=sample_name,
sample_file=sample_file,
resolution=resolution,
remove_low_coverage_like_cpgs=True,
)
pathway = MethylSegPathway(
train_sample_info=sample_info,
out_dir=Path("out/quickstart") / sample_name,
)
pathway.run_pathway()
fig = pathway.plot_labels(
sample_info=sample_info,
sample_info_removed=removed_df,
chrom="chr1",
region_start=2_200_000,
region_end=3_700_000
)
Fitting pathway...
Generating regions ...