GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - marceelrf/cpg: CpG island analysis toolkit written in Rust

BranchesTags
Open more actions menu

Latest commit

 

History

34 Commits
34 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
DEVELOPMENT.md
DEVELOPMENT.md
 
 
LICENSE.md
LICENSE.md
 
 
readme.md
readme.md
 
 

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

Install via cargo (You must have Rust installed)

cargo install cpg-bio

Precompiled binary

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

# Default: Gardiner-Garden & Frommer 1987, 4 threads
cpg finder -i genome.fa

# 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

# Filter results to a specific genomic region
cpg finder -i genome.fa --region chr1:1000000-2000000

# Use the RunningSum algorithm (CpGcluster-style)
cpg finder -i genome.fa --algorithm runningsum

# Combine: RunningSum + region filter + BED output
cpg finder -i genome.fa --algorithm runningsum --region chr1:1000000-2000000 --output bed

Built-in presets:

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

--region flag

Restricts output to islands that overlap a given genomic interval. Format: chrom:start-end (0-based, same convention as BED).

cpg finder -i genome.fa --region chr1:1000000-2000000
cpg finder -i genome.fa -r chr1:1000000-2000000          # short form

The chromosome name must match the sequence ID in the FASTA header exactly. No index (.fai) is required — the full FASTA is read and results are filtered after detection.

--algorithm flag

Algorithm Description
slidingwindow (default) Seed-and-extend: scans the sequence in windows of min_length, extends any seed that meets GC and Obs/Exp thresholds, and merges overlapping islands.
runningsum CpGcluster-style scoring (Hackenberg et al. 2006): each CpG dinucleotide adds +17 to a running score; each non-CpG base subtracts 1. An island opens when the score exceeds 0 and closes when it returns to 0. Results are filtered by the active criteria.

Both algorithms respect all --criteria / --min-* flags and all output formats.

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.

Global flags

These flags work with every subcommand:

Flag Default Description
--output table Output format (see table below)
--threads 4 Number of threads (0 = all available)

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

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

Readme
MIT license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.