Skip to main content

A python package for downloading and processing RRBS DNA methylation data.

Project description

bs-cpg

This is the main documentation homepage for bs-cpg. For comprehensive module-specific documentation, API references, and examples, see the sections below. For development guidance, see the Developer Guide.

Module Documentation

Detailed documentation for each module is available in separate notebooks:

Quick Start

Basic Workflow Example

Here’s a simple workflow to get started with bs-cpg:

from bs_cpg.setup import read_sample_cpg, get_base_data_path
from bs_cpg.liftover_ps import cpg_reads, cpg_percent, liftover_positions

# 1. Load sample CpG data
df = read_sample_cpg(["chromosome", "pos"])

# 2. Validate CpG sites
reads = cpg_reads(df["chromosome"], df["pos"], "hg19", index_base=1)
percent_valid = cpg_percent(reads)
print(f"Valid CpG sites: {percent_valid:.1f}%")

# 3. Perform liftover to hg38
new_chroms, new_pos = liftover_positions(
    chromosomes=df["chromosome"],
    positions=df["pos"],
    genome_from="hg19",
    genome_to="hg38",
    index_base_from=1,
    index_base_to=1
)

Installation & Setup

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/magistak/bs-cpg.git

or from conda

$ conda install -c magistak bs_cpg

or from pypi

$ pip install bs_cpg

Note: Ensure you have htslib (specifically bgzip) installed and in your PATH for reference genome processing.

Documentation

Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

from bs_cpg.download_processed import Geofetcher
geo = Geofetcher(just_metadata=True)
projects = geo.get_projects('GSE51239')
2

Liftover & Validation (bs_cpg.liftover_ps)

Perform genomic liftover while explicitly handling 0-based or 1-based indexing:

from bs_cpg.liftover_ps import liftover_positions
new_chroms, new_pos = liftover_positions(
    chromosomes=["chr1"], 
    positions=[100001], 
    genome_from="hg19", 
    genome_to="hg38", 
    index_base_from=1
)

You can also validate CpG site integrity using cpg_percent(reads).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bs_cpg-0.0.1.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bs_cpg-0.0.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file bs_cpg-0.0.1.tar.gz.

File metadata

  • Download URL: bs_cpg-0.0.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for bs_cpg-0.0.1.tar.gz
Algorithm Hash digest
SHA256 17ca841c6304b702c86c79710559b390a6fa0c54015c18aa73fa898fcd8d47e7
MD5 88851ebb48bb881832446e15a4ee5405
BLAKE2b-256 c689b00268d46a0883433a5c5c59c5be3b17424eda0116c3593bd62ecdae2e74

See more details on using hashes here.

File details

Details for the file bs_cpg-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: bs_cpg-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for bs_cpg-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2619a675ef16d7c6ae38c2bd3a96cf1f4d8bafc6ce892639dff538b75ff6962d
MD5 d36de402514e826228c11a64c541e2ef
BLAKE2b-256 501f7c558bbdfd202ce47d0c899b75be497269075755cd10a5ce0a97b76f84e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page