Metadata-Version: 2.4
Name: methylplotter
Version: 0.3.0
Summary: Plot methylation profiles from haplotype-phased BED files
Author: methylplotter contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/Fu-Yilei/methylplotter
Project-URL: Repository, https://github.com/Fu-Yilei/methylplotter
Project-URL: Issues, https://github.com/Fu-Yilei/methylplotter/issues
Keywords: bioinformatics,methylation,visualization,genomics,bed
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=1.5
Requires-Dist: matplotlib>=3.7
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Dynamic: license-file

# methylplotter

Plot methylation from haplotype-phased BED files.

![Methylation plot](https://raw.githubusercontent.com/Fu-Yilei/methylplotter/main/img/methylation_plot.png)

## What It Does
- Parses ONT/PacBio BED-like methylation files
- Filters records to a genomic region
- Applies sliding-window smoothing to `% modified` (point-based window)
- Draws publication-ready line plots for one or more samples
- Annotates genes and optional vertical marker lines
- Auto-detects methylation percent column per file by platform, with manual override

## Installation

```bash
python -m pip install methylplotter
```

Install from the local checkout instead:

```bash
python -m pip install .
```

For development with tests:

```bash
python -m pip install -e '.[test]'
```

## CLI Usage

```bash
methylplotter \
  --platform ont \
  --bed sampleA.bed --bed sampleB.bed \
  --sample sampleA --sample sampleB \
  --gene chr15:80143550-80197576:FAH \
  --region chr15:80150000-80200000 \
  --line breakpoint,80170000 \
  --window_size 20 \
  --min_points_for_smooth 3 \
  --verbose \
  --output methylation_plot
```

Equivalent module invocation:

```bash
python -m methylplotter --platform ont ...
```

Notes:
- `--window_size` is a number of rows/points, not base pairs
- By default, methylation percent column is auto-detected per input file (`ont` prefers index `10`, `pb` prefers index `3`)
- Use `--percent_col <index>` to force one column across all input files
- `--verbose` prints per-sample row counts, smoothed point counts, and the chosen percent column
- If `--output` has no extension, both `PNG` and `SVG` are written

## Test Data
Synthetic test data is bundled in `tests/data/`:
- `ont_sample_a.bed`
- `ont_sample_b.bed`
- `pb_sample_a.bed`

These are minimal fixtures for parser/smoother/plot tests, not biological reference datasets.

## Run Tests

```bash
PYTHONPATH=src pytest
```
