Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpg

CpG island analysis toolkit written in Rust. Accepts FASTA input and provides three subcommands: island detection, sequence statistics, and sliding-window profiling.

Install

Download the binary for your system from the latest release:

Linux

curl -LO https://github.com/marceelrf/cpg/releases/latest/download/cpg-linux-x86_64
chmod +x cpg-linux-x86_64
mv cpg-linux-x86_64 ~/.local/bin/cpg

macOS

curl -LO https://github.com/marceelrf/cpg/releases/latest/download/cpg-macos-aarch64
chmod +x cpg-macos-aarch64
mv cpg-macos-aarch64 ~/.local/bin/cpg

Windows — download cpg-windows-x86_64.exe from the releases page.

Subcommands

finder — detect CpG islands

# Built-in preset (default: Gardiner-Garden & Frommer 1987)
# Default: Gardiner-Garden & Frommer 1987
# The thread number default is 4
cpg finder -i genome.fa --threads 3

# Takai & Jones 2002
cpg finder -i genome.fa --criteria takai

# Fully custom thresholds
cpg finder -i genome.fa --min-length 300 --min-gc 0.52 --min-obs-exp 0.62

# Mix: start from a preset and override one threshold
cpg finder -i genome.fa --criteria takai --min-length 300

# BED output — open directly in IGV or bedtools
cpg finder -i genome.fa --output bed > islands.bed

Built-in presets:

Preset Length GC% Obs/Exp
gardiner ≥ 200 ≥ 50 ≥ 0.60
takai ≥ 500 ≥ 55 ≥ 0.65

stats — per-sequence statistics

cpg stats -i sequences.fa
cpg stats -i sequences.fa --output tsv
cpg stats -i sequences.fa --output json

Outputs: ID, Length, CG_count, GC%, Obs/Exp.

profiler — sliding-window metric profile

# Obs/Exp in 200 bp windows stepping 50 bp (default)
cpg profiler -i genome.fa --window 200 --step 50 --metric obs_exp

# GC% — TSV output, easy to pipe into R or Python
cpg profiler -i genome.fa -w 100 -s 10 -m gc_percent --output tsv

# BEDGRAPH output — load directly into IGV or UCSC Genome Browser
cpg profiler -i genome.fa -w 200 -s 50 -m obs_exp --output bedgraph > profile.bedgraph

Metrics: cg_count, gc_percent, obs_exp.

Output formats

Format Available in Use case
table all terminal / quick inspection
tsv all R, Python, Excel
json all downstream scripts
bed finder IGV, bedtools, UCSC
bedgraph profiler IGV, UCSC Genome Browser

All subcommands accept --output as a global flag.

Funding

We thank FAPESP(2025/28063-3) and CAPES(PIPD 88887.114278/2025-00) for the financial support.

About

CpG island analysis toolkit written in Rust

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages