Metadata-Version: 2.4
Name: cpgfuse
Version: 0.1.1
Summary: Attention-based deep learning framework for imputing single-cell CpG methylation states
Author-email: YOUR NAME <your.email@example.com>
License: MIT
Project-URL: Homepage, https://github.com/YOUR-USERNAME/cpgfuse
Project-URL: Repository, https://github.com/YOUR-USERNAME/cpgfuse
Project-URL: Issues, https://github.com/YOUR-USERNAME/cpgfuse/issues
Keywords: methylation,single-cell,bioinformatics,deep-learning,CpG,imputation
Classifier: Programming Language :: Python :: 3
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: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: scikit-learn
Requires-Dist: tqdm
Requires-Dist: keras
Requires-Dist: openpyxl
Provides-Extra: cpu
Requires-Dist: tensorflow-cpu>=2.15; extra == "cpu"
Provides-Extra: gpu
Requires-Dist: tensorflow[and-cuda]>=2.15; extra == "gpu"
Provides-Extra: tf
Requires-Dist: tensorflow>=2.15; extra == "tf"
Dynamic: license-file

# CpGFuse

An attention-based deep learning framework for imputing single-cell CpG methylation states,
based on the paper:

> Park, Chong & Tayara. "CpGFuse: a holistic approach for accurate identification of
> methylation states of DNA CpG sites." *Briefings in Bioinformatics*, 2025.

## Installation

TensorFlow is not installed by default, so pick the variant that matches your hardware:

```bash
# CPU only
pip install cpgfuse[cpu]

# GPU (bundled CUDA)
pip install cpgfuse[gpu]

# Let TensorFlow auto-detect your hardware
pip install cpgfuse[tf]
```

If TensorFlow is already installed in your environment, plain `pip install cpgfuse` works too.

## Quick start

```python
from cpgfuse import CpG_Pipeline

pipeline = CpG_Pipeline(
    Experiment_name="HepG2_test",
    Experiment_folder="./HepG2_test_result",
    genome_path="./hg19.fa",
    chromosomes=["chr1", "chr2"],
    number_of_cells=6,
    window_size=20,
    processed_files=["cell1.txt", "cell2.txt", "cell3.txt",
                     "cell4.txt", "cell5.txt", "cell6.txt"],
    num_workers=4,
    training_set=["chr1"],
    test_set=["chr2"],
    validation_set=["chr2"],
    lr=0.05,
    patience=1,
    epochs=2,
    batch_size=32,
    gpu=0,
)

# Preprocess data, build train/test/validation splits, and train per-cell models
pipeline.run_pipeline()

# Impute methylation states for a genomic region using the trained models
results = pipeline.impute_region(
    chrom="chr1",
    start=3_000_000,
    end=3_500_000,
    cells=[1, 2, 3],
    threshold=0.5,
    save_path="./HepG2_test_result/imputation_results/imputed_chr1_3M_3.5M.xlsx",
    save_bedgraph=True,
)
```

`window_size` must be between 10 and 100 (the package uses a fixed 100-CpG boundary margin).

## Package contents

| Module | Purpose |
|---|---|
| `Data_Processing` | Parses raw per-cell methylation files and the reference genome into per-chromosome feature tensors |
| `Model` | Builds, trains, and evaluates the attention-based CpGFuse Keras model, one model per cell |
| `Imputer` | Loads trained per-cell models and imputes methylation states for a chosen genomic region |
| `CpG_Pipeline` | End-to-end orchestrator combining the three components above |
| `Genome` | Lightweight FASTA reader used internally for sequence feature extraction |

## Citation

If you use this package, please cite the original paper:

```
Park, S., Chong, J., & Tayara, H. (2025). CpGFuse: a holistic approach for accurate
identification of methylation states of DNA CpG sites. Briefings in Bioinformatics.
```

## License

MIT
