This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Where the dataloader is implemented and in what form | |
type: Dataset | |
defined_as: dataloader.py::SeqDataset | |
# Arguments of the dataloader | |
args: | |
intervals_file: | |
doc: tsv file containing dna interval indices (chr, start, end) and (optonally) binary 0/1 labels | |
example: example_files/intervals_files.tsv | |
fasta_file: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = kipoi.get_model( | |
"https://github.com/kipoi/models/tree/<commit>/<model>", | |
source='github-permalink' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# figure size | |
# tilted xaxis | |
# from https://github.com/kipoi/manuscript/blob/master/src/transfer_learning/plot.ipynb | |
plotnine.options.figure_size = (5,2.5) | |
gplt = ggplot(aes(x='Cell_Type', y='auPRC', fill='Model'), data=dft) + \ | |
theme_classic() + \ | |
theme(axis_text_x=element_text(angle=20, hjust = 1)) + \ | |
theme(legend_title=element_blank(), | |
legend_box_margin=0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kipoi | |
from kipoi_interpret.importance_scores.gradient import GradientXInput | |
model = kipoi.get_model("DeepBind/Homo_sapiens/TF/D00765.001_ChIP-seq_GATA1") | |
val = GradientXInput(model).score(seq_array)[0] | |
seqlogo_heatmap(val, val.T) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create and activate a new conda environment | |
# with all model dependencies installed | |
kipoi env create <Model> | |
source activate kipoi-<Model> | |
# Run model predictions and save the results | |
# sequentially into an HDF5 file | |
kipoi predict <Model> --dataloader_args='{ | |
"intervals_file": "intervals.bed", | |
"fasta_file": "hg38.fa"}' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(reticulate) | |
kipoi <- import('kipoi') | |
model <- kipoi$get_model('Basset') | |
model$predict_on_batch(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kipoi | |
kipoi.list_models() # list available models | |
model = kipoi.get_model("Basset") # load the model | |
model = kipoi.get_model( # load the model from a past commit | |
"https://github.com/kipoi/models/tree/<commit>/<model>", | |
source='github-permalink' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from pybedtools import BedTool | |
from genomelake.extractors import FastaExtractor | |
from kipoi.data import Dataset | |
from kipoi.metadata import GenomicRanges | |
class SeqDataset(Dataset): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torch.utils.data import DataLoader | |
# if you don't want to install pytorch, | |
# you can use a fork in Kipoi: | |
# from kipoi.external.torch.data import DataLoader | |
from kipoi.data_utils import numpy_collate | |
ds = SeqDataset(fasta_file = '', ...) | |
dl = DataLoader(ds, | |
batch_size=32, | |
collate_fn=numpy_collate, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Build latest version of Emacs, version management with stow | |
# OS: Ubuntu 14.04 LTS | |
# version: 24.5 | |
# Toolkit: lucid | |
# Warning, use updated version of this script in: https://github.com/favadi/build-emacs | |
set -e |