In [1]:
%load_ext autoreload
%autoreload 2

import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from collections import OrderedDict
In [3]:
from matlas.pwms import ic_scale, adjust_for_ic_scale
from matlas.matches import vdom_pssm
from modisco.visualization import viz_sequence
from matlas.matches import vdom_pssm
In [4]:
motif_name = 'E2F6'

top_k_filters = OrderedDict()
filt_infl_from_loss = OrderedDict()
for fold_no in range(1,11):
    aitacdir = "/mnt/lab_data2/msharmin/oc-atlas/DanSkinData/alex_bpnets/{0}/{1}".format(motif_name, fold_no)
    filt_infl_from_loss[fold_no] = np.load(aitacdir+"/filt_infl_from_loss.npy")
    top_k_filters[fold_no] = np.flip(np.argsort(filt_infl_from_loss[fold_no]))[:15]
    print(fold_no, top_k_filters[fold_no])
1 [47 57 42 21 55 31 63 62 45 50  8 48 29 26 46]
2 [23  9 39 59 28 13  4 21 10 20 14 22 40 34  5]
3 [53 16 47 36 49 56 20 26 35 44 38 37 46 19 10]
4 [49 20 59 39 23 51 21 28 17  1 46 33 32 44 30]
5 [29 21 17  3 34 53 40 20 30 38 39 15 54 12 61]
6 [ 1 37 44 15 53 30 62 25 26 63 45 56 29 55 49]
7 [11 47 28 22 30 54 34 57  9 14 31  0 10 38 51]
8 [62 56 17 49 16  2  6 31 32 41 33 37 28  4 43]
9 [ 4 59 57 42 29 60 18 51 58 45 10 12 25 17 33]
10 [ 5 15 21  3 27 41  1  4 19 58 10  9  2 33 24]
In [5]:
import numpy as np
import seaborn as sns

motif_name = 'CEBPB'
filter_weights = OrderedDict()
for fold_no in range(1,11):
    filter_weights[fold_no] = np.load("/mnt/lab_data2/msharmin/oc-atlas/DanSkinData/alex_bpnets/filters/{0}/{0}_fold{1}_filters.npy".format(
    motif_name, fold_no))

Raw and mean normalized filter weights

In [6]:
from modisco.visualization import viz_sequence

for fold_no in range(1,11):
    for i in top_k_filters[fold_no]:
        print('fold_no', fold_no, 'filter', i)
        mean_norm_weights = np.copy(filter_weights[fold_no][:,:,i])
        mean_norm_weights = mean_norm_weights - mean_norm_weights.mean(1, keepdims=True)
        print('raw weights')
        viz_sequence.plot_weights(filter_weights[fold_no][:,:,i])
        print('mean normalized weights')
        viz_sequence.plot_weights(mean_norm_weights)
        break
fold_no 1 filter 47
raw weights
mean normalized weights
fold_no 2 filter 23
raw weights
mean normalized weights
fold_no 3 filter 53
raw weights
mean normalized weights
fold_no 4 filter 49
raw weights
mean normalized weights
fold_no 5 filter 29
raw weights
mean normalized weights
fold_no 6 filter 1
raw weights
mean normalized weights
fold_no 7 filter 11
raw weights
mean normalized weights
fold_no 8 filter 62
raw weights
mean normalized weights
fold_no 9 filter 4
raw weights
mean normalized weights
fold_no 10 filter 5
raw weights
mean normalized weights
In [ ]: