rbp_eclip/NONO

Authors: Ziga Avsec

License: MIT

Contributed by: Ziga Avsec

Cite as: https://doi.org/10.1093/bioinformatics/btx727

Type: keras

Postprocessing: None

Trained on: RBP occupancy peaks measured by eCLIP-seq (Van Nostrand et al., 2016 - https://doi.org/10.1038/nmeth.3810), https://github.com/gagneurlab/Manuscript_Avsec_Bioinformatics_2017 4000 training samples, 1000 validation sites, 1000 testing samples.

Source files

'RBP binding model from Avsec et al: "Modeling positional effects of regulatory sequences with spline transformations increases prediction accuracy of deep neural networks". '

112 eCLIP models from: https://doi.org/10.1093/bioinformatics/btx727

Associated code is located at: github.com/gagneurlab/Manuscript_Avsec_Bioinformatics_2017

Create a new conda environment with all dependencies installed
kipoi env create rbp_eclip
source activate kipoi-rbp_eclip
Test the model
kipoi test rbp_eclip/NONO --source=kipoi
Make a prediction
kipoi get-example rbp_eclip/NONO -o example
kipoi predict rbp_eclip/NONO \
  --dataloader_args='{"intervals_file": "example/intervals_file", "fasta_file": "example/fasta_file", "gtf_file": "example/gtf_file", "target_file": "example/target_file", "filter_protein_coding": true}' \
  -o '/tmp/rbp_eclip|NONO.example_pred.tsv'
# check the results
head '/tmp/rbp_eclip|NONO.example_pred.tsv'
Create a new conda environment with all dependencies installed
kipoi env create rbp_eclip
source activate kipoi-rbp_eclip
Get the model
import kipoi
model = kipoi.get_model('rbp_eclip/NONO')
Make a prediction for example files
pred = model.pipeline.predict_example(batch_size=4)
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
batch_iterator = dl.batch_iter(batch_size=4)
for batch in batch_iterator:
    # predict for a batch
    batch_pred = model.predict_on_batch(batch['inputs'])
Make predictions for custom files directly
pred = model.pipeline.predict(dl_kwargs, batch_size=4)
Get the model
library(reticulate)
kipoi <- import('kipoi')
model <- kipoi$get_model('rbp_eclip/NONO')
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)
model$predict_on_batch(batch$inputs)
Make predictions for custom files directly
pred <- model$pipeline$predict(dl_kwargs, batch_size=4)
Get the docker image
docker pull kipoi/kipoi-docker:sharedpy3keras2tf1-slim
Get the full sized docker image
docker pull kipoi/kipoi-docker:sharedpy3keras2tf1
Get the activated conda environment inside the container
docker run -it kipoi/kipoi-docker:sharedpy3keras2tf1-slim
Test the model
docker run kipoi/kipoi-docker:sharedpy3keras2tf1-slim kipoi test rbp_eclip/NONO --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/ kipoi/kipoi-docker:sharedpy3keras2tf1-slim \
kipoi get-example rbp_eclip/NONO -o /app/example 
docker run -v $PWD/kipoi-example:/app/ kipoi/kipoi-docker:sharedpy3keras2tf1-slim \
kipoi predict rbp_eclip/NONO \
--dataloader_args='{'intervals_file': '/app/example/intervals_file', 'fasta_file': '/app/example/fasta_file', 'gtf_file': '/app/example/gtf_file', 'target_file': '/app/example/target_file', 'filter_protein_coding': True}' \
-o '/app/rbp_eclip_NONO.example_pred.tsv' 
# check the results
head $PWD/kipoi-example/rbp_eclip_NONO.example_pred.tsv
    
Install apptainer
https://apptainer.org/docs/user/main/quick_start.html#quick-installation-steps
Make prediction for custom files directly
kipoi get-example rbp_eclip/NONO -o example
kipoi predict rbp_eclip/NONO \
--dataloader_args='{"intervals_file": "example/intervals_file", "fasta_file": "example/fasta_file", "gtf_file": "example/gtf_file", "target_file": "example/target_file", "filter_protein_coding": true}' \
-o 'rbp_eclip_NONO.example_pred.tsv' \
--singularity 
# check the results
head rbp_eclip_NONO.example_pred.tsv

Schema

Inputs

Dictionary of numpy arrays

Name: seq

    Shape: (101, 4) 

    Doc: One-hot encoded RNA sequence

Name: dist_tss

    Shape: (1, 10) 

    Doc: Distance the nearest TSS site transformed with B-splines

Name: dist_polya

    Shape: (1, 10) 

    Doc: Distance the nearest Poly-A site transformed with B-splines

Name: dist_exon_intron

    Shape: (1, 10) 

    Doc: Distance the nearest exon_intron (splice donor) site transformed with B-splines

Name: dist_intron_exon

    Shape: (1, 10) 

    Doc: Distance the nearest intron_exon (splice acceptor) site transformed with B-splines

Name: dist_start_codon

    Shape: (1, 10) 

    Doc: Distance the nearest start codon transformed with B-splines

Name: dist_stop_codon

    Shape: (1, 10) 

    Doc: Distance the nearest stop codon transformed with B-splines

Name: dist_gene_start

    Shape: (1, 10) 

    Doc: Distance the nearest gene start transformed with B-splines

Name: dist_gene_end

    Shape: (1, 10) 

    Doc: Distance the nearest gene end transformed with B-splines


Targets

Single numpy array

Name: None

    Shape: (1,) 

    Doc: Predicted binding strength


Dataloader

Defined as: .

Doc: RBP binding model taking as input 101nt long sequence as well as 8 distances to nearest genomic landmarks - tss, poly-A, exon-intron boundary, intron-exon boundary, start codon, stop codon, gene start, gene end

Authors: Ziga Avsec

Type: None

License: MIT


Arguments

intervals_file : bed6 file with `chrom start end id score strand` columns

fasta_file : Reference genome sequence

gtf_file : file path; Genome annotation GTF file

target_file (optional): path to the targets (txt) file

filter_protein_coding (optional): Considering genomic landmarks only for protein coding genes when computing the distances to the nearest genomic landmark.

position_transformer_file : Provided file for each dataloader obtained from https://sandbox.zenodo.org/record/248594/files/NONO.dataloader.pkl?download=1

use_linecache (optional): if True, use linecache https://docs.python.org/3/library/linecache.html to access bed file rows


Model dependencies
conda:
  • pip=20.3.3

pip:
  • concise
  • tensorflow==1.15
  • keras==2.1.6
  • h5py==2.10.0
  • protobuf==3.20

Dataloader dependencies
conda:
  • bioconda::pybedtools
  • bioconda::pysam=0.15.3
  • bioconda::genomelake
  • bioconda::pybigwig
  • bioconda::pyfaidx
  • bioconda::gtfparse=1.0.7
  • python=3.7
  • cython
  • pip=20.3.3

pip:
  • concise>=0.6.6
  • scikit-learn==0.19.2