{ "cells": [ { "cell_type": "markdown", "id": "a1b2c3d4", "metadata": {}, "source": [ "# Quickstart\n", "\n", "Train and run MethylSeg on a WGBS or TCGA HM450K sample." ] }, { "cell_type": "code", "execution_count": 4, "id": "7ce01fb5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Fitting pathway...\n", "Generating regions ...\n" ] }, { "data": { "text/html": [ " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from pathlib import Path\n", "\n", "from methylseg import MethylSegPathway, MethylationStates\n", "from methylseg.helper_classes import DATA_DIR\n", "\n", "reference_dir = DATA_DIR / \"reference_files\"\n", "\n", "# WGBS: replace these with your own sample name and count table.\n", "# sample_name = \"WGBS_colon-primary-tumor_1\"\n", "# sample_file = reference_dir / \"WGBS_colon-primary-tumor_1_wgbs.tsv.gz\"\n", "# resolution = \"wgbs\"\n", "\n", "# TCGA/HM450K alternative:\n", "sample_name = \"TCGA-BD-A3EP-01A\"\n", "sample_file = reference_dir / \"TCGA-BD-A3EP-01A_450k.tsv.gz\"\n", "resolution = \"450k\"\n", "\n", "sample_info, removed_df = MethylSegPathway.prepare_sample_info(\n", " sample_name=sample_name,\n", " sample_file=sample_file,\n", " resolution=resolution,\n", " remove_low_coverage_like_cpgs=True,\n", ")\n", "\n", "pathway = MethylSegPathway(\n", " train_sample_info=sample_info,\n", " out_dir=Path(\"out/quickstart\") / sample_name,\n", ")\n", "\n", "pathway.run_pathway()\n", "\n", "fig = pathway.plot_labels(\n", " sample_info=sample_info,\n", " sample_info_removed=removed_df,\n", " chrom=\"chr1\",\n", " region_start=2_200_000,\n", " region_end=3_700_000\n", ")\n" ] } ], "metadata": { "kernelspec": { "display_name": "jt_wgbs_analysis", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.14" } }, "nbformat": 4, "nbformat_minor": 5 }