Authors: Haoyang Zeng , David K. Gifford

License: Apache License v2

Contributed by: Roman Kreuzhuber

Cite as: https://doi.org/10.1093/nar/gkx177

Type: keras

Postprocessing: variant_effects

Trained on: RRBS (restricted representation bisulfite sequencing) data from ENCODE (https://www.encodeproject.org/)

Source files

Abstract: DNA methylation plays a crucial role in the establishment of tissue-specific gene expression and the regulation of key biological processes. However, our present inability to predict the effect of genome sequence variation on DNA methylation precludes a comprehensive assessment of the consequences of non-coding variation. We introduce CpGenie, a sequence-based framework that learns a regulatory code of DNA methylation using a deep convolutional neural network and uses this network to predict the impact of sequence variation on proximal CpG site DNA methylation. CpGenie produces allele-specific DNA methylation prediction with single-nucleotide sensitivity that enables accurate prediction of methylation quantitative trait loci (meQTL). We demonstrate that CpGenie prioritizes validated GWAS SNPs, and contributes to the prediction of functional non-coding variants, including expression quantitative trait loci (eQTL) and disease-associated mutations. CpGenie is publicly available to assist in identifying and interpreting regulatory non-coding variants.

Create a new conda environment with all dependencies installed
kipoi env create CpGenie
source activate kipoi-CpGenie
Install model dependencies into current environment
kipoi env install CpGenie
Test the model
kipoi test CpGenie/HepG2_ENCSR530RCY --source=kipoi
Make a prediction
kipoi get-example CpGenie/HepG2_ENCSR530RCY -o example
kipoi predict CpGenie/HepG2_ENCSR530RCY \
  --dataloader_args='{"intervals_file": "example/intervals_file", "fasta_file": "example/fasta_file"}' \
  -o '/tmp/CpGenie|HepG2_ENCSR530RCY.example_pred.tsv'
# check the results
head '/tmp/CpGenie|HepG2_ENCSR530RCY.example_pred.tsv'
Get the model
import kipoi
model = kipoi.get_model('CpGenie/HepG2_ENCSR530RCY')
Make a prediction for example files
pred = model.pipeline.predict_example()
Use dataloader and model separately
# Download example dataloader kwargs
dl_kwargs = model.default_dataloader.download_example('example')
# Get the dataloader and instantiate it
dl = model.default_dataloader(**dl_kwargs)
# get a batch iterator
it = dl.batch_iter(batch_size=4)
# predict for a batch
batch = next(it)
Make predictions for custom files directly
pred = model.pipeline.predict(dl_kwargs, batch_size=4)
Get the model
kipoi <- import('kipoi')
model <- kipoi$get_model('CpGenie/HepG2_ENCSR530RCY')
Make a prediction for example files
predictions <- model$pipeline$predict_example()
Use dataloader and model separately
# Download example dataloader kwargs
dl_kwargs <- model$default_dataloader$download_example('example')
# Get the dataloader
dl <- model$default_dataloader(dl_kwargs)
# get a batch iterator
it <- dl$batch_iter(batch_size=4)
# predict for a batch
batch <- iter_next(it)
Make predictions for custom files directly
pred <- model$pipeline$predict(dl_kwargs, batch_size=4)
Get the docker image
docker pull haimasree/kipoi-docker:sharedpy3keras1.2
Get the activated conda environment inside the container
docker run -it haimasree/kipoi-docker:sharedpy3keras1.2
Test the model
docker run haimasree/kipoi-docker:sharedpy3keras1.2 kipoi test CpGenie/HepG2_ENCSR530RCY --source=kipoi
Make prediction for custom files directly
# Create an example directory containing the data
mkdir -p $PWD/kipoi-example 
# You can replace $PWD/kipoi-example with a different absolute path containing the data 
docker run -v $PWD/kipoi-example:/app/ haimasree/kipoi-docker:sharedpy3keras1.2 \
kipoi get-example CpGenie/HepG2_ENCSR530RCY -o /app/example 
docker run -v $PWD/kipoi-example:/app/ haimasree/kipoi-docker:sharedpy3keras1.2 \
kipoi predict CpGenie/HepG2_ENCSR530RCY \
--dataloader_args='{'intervals_file': '/app/example/intervals_file', 'fasta_file': '/app/example/fasta_file'}' \
-o '/app/CpGenie_HepG2_ENCSR530RCY.example_pred.tsv' 
# check the results
head $PWD/kipoi-example/CpGenie_HepG2_ENCSR530RCY.example_pred.tsv



Single numpy array

Name: seq

    Shape: (4, 1, 1001) 

    Doc: DNA sequence


Single numpy array

Name: methylation_prob

    Shape: (2,) 

    Doc: Methylated and Unmethylated probabilities


Defined as: kipoiseq.dataloaders.SeqIntervalDl

Doc: Dataloader for a combination of fasta and tab-delimited input files such as bed files. The dataloader extracts regions from the fasta file as defined in the tab-delimited `intervals_file` and converts them into one-hot encoded format. Returned sequences are of the type np.array with the shape inferred from the arguments: `alphabet_axis` and `dummy_axis`.

Authors: Ziga Avsec , Roman Kreuzhuber

Type: Dataset

License: MIT


intervals_file : bed3+<columns> file path containing intervals + (optionally) labels

fasta_file : Reference genome FASTA file path.

num_chr_fasta (optional): True, the the dataloader will make sure that the chromosomes don't start with chr.

label_dtype (optional): None, datatype of the task labels taken from the intervals_file. Example: str, int, float, np.float32

use_strand (optional): reverse-complement fasta sequence if bed file defines negative strand. Requires a bed6 file

ignore_targets (optional): if True, don't return any target variables

Model dependencies
  • python=3.6.12
  • h5py=2.10.0
  • tensorflow=1.10.0
  • keras=1.2.2
  • pysam=0.15.3
  • pip=20.2.4


Dataloader dependencies
  • bioconda::pybedtools
  • bioconda::pyfaidx
  • bioconda::pyranges
  • numpy
  • pandas

  • kipoiseq