2. Installation

CpGtools is a Python package for analyzing DNA methylation data. It runs on Linux, macOS, and Windows, and requires Python 3.9 or later.

Most Python dependencies are installed automatically when CpGtools is installed with pip. Some commands additionally require R and specific R packages.

2.1. Prerequisites

Before installing CpGtools, ensure that the following software is available on your system:

The following software is optional and is required only by specific subcommands:

  • TensorFlow (required by beta_impute.py morel --model DNN)

  • R

  • R package aod (required by dmc_bb.py)

  • R package beanplot (required by beta_jitter_plot.py)

2.2. Install from PyPI

The recommended way to install CpGtools is from the Python Package Index (PyPI):

pip install cpgtools

2.3. Install the Development Version

To install the latest development version directly from GitHub:

pip install git+https://github.com/liguowang/cpgtools.git

2.4. Install from Source

Clone the repository and install CpGtools locally:

git clone https://github.com/liguowang/cpgtools.git
cd cpgtools
pip install .

Alternatively, install in editable (development) mode:

pip install -e .

2.5. Dependencies

The following Python packages are installed automatically when CpGtools is installed via pip:

  • numpy

  • scipy

  • pandas

  • matplotlib

  • scikit-learn

  • fancyimpute

  • umap-learn

  • weblogo

  • bx-python

  • pycombat

2.6. Optional Python Dependencies

Most Python dependencies are installed automatically when CpGtools is installed via pip. The following package is optional:

  • tensorflow — required only when running the MOREL algorithm with --model DNN in beta_impute.py. It is not required for the default Random Forest implementation (--model RF).

To install TensorFlow:

pip install tensorflow

2.7. Upgrade CpGtools

To upgrade an existing installation to the latest release:

pip install --upgrade cpgtools

2.8. Verify the Installation

To verify that CpGtools was installed successfully:

cpgtools --version

or

python -m cpgtools --version