Add BPNet model ENCSR223XGT (ENCSR928API)
Browse filesFiles changed (23)
- .gitattributes+5
- README.mdAdded+137
- config.jsonAdded+45
- fold_0/model.h5Added+3
- fold_0/saved_model/saved_model.pbAdded+3
- fold_0/saved_model/variables/variables.data-00000-of-00001Added+3
- fold_0/saved_model/variables/variables.indexAdded
- fold_1/model.h5Added+3
- fold_1/saved_model/saved_model.pbAdded+3
- fold_1/saved_model/variables/variables.data-00000-of-00001Added+3
- fold_1/saved_model/variables/variables.indexAdded
- fold_2/model.h5Added+3
- fold_2/saved_model/saved_model.pbAdded+3
- fold_2/saved_model/variables/variables.data-00000-of-00001Added+3
- fold_2/saved_model/variables/variables.indexAdded
- fold_3/model.h5Added+3
- fold_3/saved_model/saved_model.pbAdded+3
- fold_3/saved_model/variables/variables.data-00000-of-00001Added+3
- fold_3/saved_model/variables/variables.indexAdded
- fold_4/model.h5Added+3
- fold_4/saved_model/saved_model.pbAdded+3
- fold_4/saved_model/variables/variables.data-00000-of-00001Added+3
- fold_4/saved_model/variables/variables.indexAdded
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines333435363738394032 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textfold_0/saved_model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -textfold_1/saved_model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -textfold_2/saved_model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -textfold_3/saved_model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -textfold_4/saved_model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137---license: cc-by-4.0library_name: bpnettags: - bpnet - dna - genomics - transcription-factor-binding - chip-seq - encode - encode-bpnet-atlas - hg38 - qc-passed - RFX1---
# ENCODE BPNet Atlas
As part of the ENCODE 4 Project, we trained BPNet models on 2,339 ENCODEtranscription factor ChIP-seq experiments spanning 788 targets across175 biosamples. Here, we provide all models for open-source use.
For more information about the models, see:
- Main ENCODE 4 Paper- A unified lexicon of predictive DNA sequence motifs from ENCODE transcription factor binding and chromatin accessibility assays (Deshpande et al., Zenodo 2025)- Base-resolution models of transcription-factor binding reveal soft motif syntax (Avsec et al., Nat Genet 2021)
## BPNet model: RFX1 ChIP-seq in HepG2 (ENCSR928API)
- Model: BPNet- Assay: TF ChIP-seq- Target: RFX1- Experiment: [ENCSR928API](https://www.encodeproject.org/experiments/ENCSR928API/)- Model annotation: [ENCSR223XGT](https://www.encodeproject.org/annotations/ENCSR223XGT/)- Biosample: HepG2 (Full name: Homo sapiens HepG2)- Cell slim(s): cancer cell, epithelial cell- Organ slim(s): epithelium, endocrine gland, liver, exocrine gland- Developmental slim(s): endoderm- System slim(s): digestive system, endocrine system, exocrine system- Assembly: hg38
## QC
- Status: passed- Notes: Found direct motif (counts, profile);
## Directory structure
5-fold cross-validation. Each `fold_*/` contains the trained BPNet model in two formats:
- `fold_0/model.h5` — BPNet model in .h5 (Keras) format- `fold_0/saved_model/` — BPNet model in TensorFlow SavedModel format (a directory; load directly)- `config.json` — training / architecture parameters
## Instructions
BPNet takes a one-hot DNA sequence plus control (bias) inputs and predictsstranded profile logits and total logcounts. The control inputs come from thematched WCE/Input DNA control and **can be passed as zeros**.
### 1. Loading the SavedModel and making predictions
```pythonimport numpy as npimport tensorflow as tffrom scipy.special import logsumexp
model = tf.saved_model.load("fold_0/saved_model")# sequence: (N, 2114, 4) one-hot [A,C,G,T]# profile_bias_input: (N, 1000, 2) per-base profile bias from WCE/Input control, or zeros# counts_bias_input: (N, 2) log2 total counts from WCE/Input control, or zerospredictions = model.signatures["serving_default"](**{ "sequence": sequence.astype("float32"), "profile_bias_input_0": profile_bias_input.astype("float32"), "counts_bias_input_0": counts_bias_input.astype("float32")})# predictions["profile_predictions"]: (N, 1000, 2) logits (strands NOT independent)# predictions["logcounts_predictions"]: (N, 1) total logcount
output_len = 1000def vectorized_prediction_to_profile(predictions): logits_arr = predictions["profile_predictions"] counts_arr = predictions["logcounts_predictions"] pred_profile_logits = np.reshape(logits_arr, [-1, 1, output_len * 2]) probVals_array = np.exp(pred_profile_logits - logsumexp( pred_profile_logits, axis=2).reshape([len(logits_arr), 1, 1])) profile_predictions = np.multiply( np.exp(counts_arr).reshape([len(counts_arr), 1, 1]), probVals_array) plus = np.reshape(profile_predictions, [len(counts_arr), output_len, 2])[:, :, 0] minus = np.reshape(profile_predictions, [len(counts_arr), output_len, 2])[:, :, 1] return plus, minus, counts_arr
plus, minus, logcounts = vectorized_prediction_to_profile(predictions)```
### 2. Loading the .h5 (Keras) and making predictions
```pythonimport numpy as npimport tensorflow as tfimport tensorflow.keras.backend as kbfrom tensorflow.keras.models import load_modelfrom tensorflow.keras.utils import CustomObjectScopefrom bpnet.model.custommodel import CustomModel
def get_model(model_path): with CustomObjectScope({"kb": kb, "tf": tf, "CustomModel": CustomModel}): return load_model(model_path)
model = get_model("fold_0/model.h5")N = sequence.shape[0]predictions = model.predict([ sequence, # (N, 2114, 4) np.zeros((N, 1000, 2)), # profile_bias_input (or real WCE/Input control values) np.zeros((N, 2))]) # counts_bias_input (or real control log2 counts)# predictions[0]: (N, 1000, 2) logits; predictions[1]: (N, 1) logcounts# convert with the same vectorized_prediction_to_profile() (predictions[0], predictions[1])```
## Docker image to load and use the models
`kundajelab/bpnet-atlas` (placeholder — image forthcoming).
## Code
- Code: https://github.com/kundajelab/bpnet/- Toolbox & downstream analysis: https://github.com/kundajelab/bpnet/wiki
## License & citation
External data users may freely download, analyze and publish results based on anyENCODE data without restrictions.
Released under the ENCODE data-use policy. Please cite the ENCODE ProjectConsortium and the model software: BPNet (Avsec et al., Nat Genet 2021).123456789101112131415161718192021222324252627282930313233343536373839404142434445{ "input_len": 2114, "output_profile_len": 1000, "motif_module_params": { "filters": [64], "kernel_sizes": [21], "padding": "valid" }, "syntax_module_params": { "num_dilation_layers": 8, "filters": 64, "kernel_size": 3, "padding": "valid", "pre_activation_residual_unit": true }, "profile_head_params": { "filters": 1, "kernel_size": 75, "padding": "valid" }, "counts_head_params": { "filters": 1, "kernel_size": 75, "padding": "valid", "units": [1], "activations":["linear"], "dropouts":[0] }, "profile_bias_module_params": { "kernel_sizes": [1] }, "counts_bias_module_params": { }, "use_attribution_prior": false, "attribution_prior_params": { "frequency_limit": 150, "limit_softness": 0.2, "grad_smooth_sigma": 3, "profile_grad_loss_weight": 200, "counts_grad_loss_weight": 100 }, "loss_weights": [1, 168.62609945872802], "counts_loss": "MSE"}123version https://git-lfs.github.com/spec/v1oid sha256:af9126e30c773c020d0bbeb3fd9be8b957ef04b926864e0da611433c8a8efefcsize 561784123version https://git-lfs.github.com/spec/v1oid sha256:948371f7fd17967e1fe695a7a6c32360fb29a95dc963e0210ad22ef1bfe34104size 750202123version https://git-lfs.github.com/spec/v1oid sha256:aa03c830edbfd29a507e140e5853c3bc73ed96589e63ec811f561c289ec3954csize 1393322123version https://git-lfs.github.com/spec/v1oid sha256:8f52acf3621a72f2cc9c9494245da2115a5e50d9a6c91ec08df22109747ba9eesize 561784123version https://git-lfs.github.com/spec/v1oid sha256:17570a2fb28e0bf7af2c3272a4c933056ad85818391b6c16cdd46baabe1ae8a2size 750202123version https://git-lfs.github.com/spec/v1oid sha256:82348c53e51ffb4d2f0810dce62fb74cb03fe7a9a23909d9c6146e35e6d04df9size 1393322123version https://git-lfs.github.com/spec/v1oid sha256:7fec68ffdcc4c6dbfd9acd2c92df334818c79c5ebe2d5989bb5eda11b6b0a828size 561784123version https://git-lfs.github.com/spec/v1oid sha256:1844c6ea01b761ef4082152c7d69e977fc5de53f36efbe6e6afb28532a28233esize 750202123version https://git-lfs.github.com/spec/v1oid sha256:743b2f6ad5e6f1ff50222facfcbf8821675ed57d91d2ef1a63ad85272d2d9594size 1393322123version https://git-lfs.github.com/spec/v1oid sha256:c9aa81a8915896b3b14b9fa10b0ba1b21f69de22c2e31ebdcc09dbb9127f46d8size 561784123version https://git-lfs.github.com/spec/v1oid sha256:d557bdd3638667b38ca832170240603a18223caf91958feb54289a4f231dbb81size 750202123version https://git-lfs.github.com/spec/v1oid sha256:fb87fe567e40ef40526a41c180ce9b19157e0c9967e7a035003d044634bb90f0size 1393322123version https://git-lfs.github.com/spec/v1oid sha256:0fb7daf21b6878d20b132febc9e4fc45c31d151b841810d6dc4c004bc784d210size 561784123version https://git-lfs.github.com/spec/v1oid sha256:63bf31f7a8dd2293ea77e529b68d646e0b2d78d0e2e3d6190f1d32f18db10a3fsize 750202123version https://git-lfs.github.com/spec/v1oid sha256:c42b4c59113353adefdcc7bb0e9fa23dac5baf5c4787a8845ab60a2e6dcb0c2csize 1393322.gitattributes+5
README.mdAdded+137
config.jsonAdded+45
fold_0/model.h5Added+3
fold_0/saved_model/saved_model.pbAdded+3
fold_0/saved_model/variables/variables.data-00000-of-00001Added+3
fold_0/saved_model/variables/variables.indexAdded
fold_1/model.h5Added+3
fold_1/saved_model/saved_model.pbAdded+3
fold_1/saved_model/variables/variables.data-00000-of-00001Added+3
fold_1/saved_model/variables/variables.indexAdded
fold_2/model.h5Added+3
fold_2/saved_model/saved_model.pbAdded+3
fold_2/saved_model/variables/variables.data-00000-of-00001Added+3
fold_2/saved_model/variables/variables.indexAdded
fold_3/model.h5Added+3
fold_3/saved_model/saved_model.pbAdded+3
fold_3/saved_model/variables/variables.data-00000-of-00001Added+3
fold_3/saved_model/variables/variables.indexAdded
fold_4/model.h5Added+3
fold_4/saved_model/saved_model.pbAdded+3
fold_4/saved_model/variables/variables.data-00000-of-00001Added+3
fold_4/saved_model/variables/variables.indexAdded