AttentiveChrome/E057
Authors: Ritambhara Singh , Jack Lanchantin , Arshdeep Sekhon , Yanjun Qi
License: MIT
Contributed by: Jack Lanchantin , Jeffrey Yoo
Cite as: https://doi.org:/10.1101/329334
Type: pytorch
Postprocessing: None
Trained on: Histone Modidification and RNA Seq Data From Roadmad/REMC database
Gene Expression Prediction
Dependency Requirements
- python>=3.5
- numpy
- pytorch-cpu
- torchvision-cpu
Quick Start
Creating new conda environtment using kipoi
kipoi env create AttentiveChrome
Activating environment
conda activate kipoi-AttentiveChrome
Command Line
Getting example input file
Replace {model_name} with the actual name of model (e.g. E003, E005, etc.)
kipoi get-example AttentiveChrome/{model_name} -o example_file
example: kipoi get-example AttentiveChrome/E003 -o example_file
Predicting using example file
kipoi predict AttentiveChrome/{model_name} --dataloader_args='{"input_file": "example_file/input_file", "bin_size": 100}' -o example_predict.tsv
This should produce a tsv file containing the results.
Python
Fetching the model
First, import kipoi:
import kipoi
Next, get the model. Replace {model_name} with the actual name of model (e.g. E003, E005, etc.)
model = kipoi.get_model("AttentiveChrome/{model_name}")
Predicting using pipeline
prediction = model.pipeline.predict({"input_file": "path to input file", "bin_size": {some integer}})
This returns a numpy array containing the output from the final softmax function.
e.g. model.pipeline.predict({"input_file": "data/input_file", "bin_size": 100})
Predicting for a single batch
First, we need to set up our dataloader dl
.
dl = model.default_dataloader(input_file="path to input file", bin_size={some integer})
Next, we can use the iterator functionality of the dataloader.
it = dl.batch_iter(batch_size=32)
single_batch = next(it)
First line gets us an iterator named it
with each batch containing 32 items. We can use next(it)
to get a batch.
Then, we can perform prediction on this single batch.
prediction = model.predict_on_batch(single_batch['inputs'])
This also returns a numpy array containing the output from the final softmax function.
kipoi env create AttentiveChrome
source activate kipoi-AttentiveChrome
kipoi test AttentiveChrome/E057 --source=kipoi
kipoi get-example AttentiveChrome/E057 -o example
kipoi predict AttentiveChrome/E057 \
--dataloader_args='{"input_file": "example/input_file"}' \
-o '/tmp/AttentiveChrome|E057.example_pred.tsv'
# check the results
head '/tmp/AttentiveChrome|E057.example_pred.tsv'
kipoi env create AttentiveChrome
source activate kipoi-AttentiveChrome
import kipoi
model = kipoi.get_model('AttentiveChrome/E057')
pred = model.pipeline.predict_example(batch_size=4)
# 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'])
pred = model.pipeline.predict(dl_kwargs, batch_size=4)
library(reticulate)
kipoi <- import('kipoi')
model <- kipoi$get_model('AttentiveChrome/E057')
predictions <- model$pipeline$predict_example()
# 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)
pred <- model$pipeline$predict(dl_kwargs, batch_size=4)
docker pull kipoi/kipoi-docker:attentivechrome-slim
docker pull kipoi/kipoi-docker:attentivechrome
docker run -it kipoi/kipoi-docker:attentivechrome-slim
docker run kipoi/kipoi-docker:attentivechrome-slim kipoi test AttentiveChrome/E057 --source=kipoi
# 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:attentivechrome-slim \
kipoi get-example AttentiveChrome/E057 -o /app/example
docker run -v $PWD/kipoi-example:/app/ kipoi/kipoi-docker:attentivechrome-slim \
kipoi predict AttentiveChrome/E057 \
--dataloader_args='{'input_file': '/app/example/input_file'}' \
-o '/app/AttentiveChrome_E057.example_pred.tsv'
# check the results
head $PWD/kipoi-example/AttentiveChrome_E057.example_pred.tsv
https://apptainer.org/docs/user/main/quick_start.html#quick-installation-steps
kipoi get-example AttentiveChrome/E057 -o example
kipoi predict AttentiveChrome/E057 \
--dataloader_args='{"input_file": "example/input_file"}' \
-o 'AttentiveChrome_E057.example_pred.tsv' \
--singularity
# check the results
head AttentiveChrome_E057.example_pred.tsv
- python=3.8
- numpy=1.19.2
- pytorch::pytorch
- pip=21.0.1
- python=3.8
- pytorch::pytorch
- numpy