Here we present the explicit model building for a transcirptomic wide effec of CCA1 and LHY
!pip install seaborn
!pip install biopython==1.76
Requirement already satisfied: seaborn in /usr/local/lib/python2.7/dist-packages Requirement already satisfied: scipy>=0.17.1 in /usr/local/lib/python2.7/dist-packages (from seaborn) Requirement already satisfied: pandas>=0.17.1 in /usr/local/lib/python2.7/dist-packages (from seaborn) Requirement already satisfied: matplotlib>=1.5.3 in /usr/local/lib/python2.7/dist-packages (from seaborn) Requirement already satisfied: numpy>=1.10.4 in /usr/local/lib/python2.7/dist-packages (from seaborn) Requirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas>=0.17.1->seaborn) Requirement already satisfied: python-dateutil>=2.5.0 in /usr/local/lib/python2.7/dist-packages (from pandas>=0.17.1->seaborn) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.5.3->seaborn) Requirement already satisfied: backports.functools-lru-cache in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.5.3->seaborn) Requirement already satisfied: subprocess32 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.5.3->seaborn) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.5.3->seaborn) Requirement already satisfied: six>=1.10 in /usr/lib/python2.7/dist-packages (from matplotlib>=1.5.3->seaborn) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.5.3->seaborn) Requirement already satisfied: setuptools in /usr/lib/python2.7/dist-packages (from kiwisolver>=1.0.1->matplotlib>=1.5.3->seaborn) Requirement already satisfied: biopython==1.76 in /usr/local/lib/python2.7/dist-packages Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from biopython==1.76)
%pylab inline
import seaborn as sns
import os
import pickle
import pandas
from scipy.stats import linregress
from Bio import SeqIO
from scipy.stats import norm
Populating the interactive namespace from numpy and matplotlib
CCA1_pandas = pandas.read_csv('PBMS/CCA1_8mers.txt', delimiter='\t')
CCA1_pandas = CCA1_pandas.sort_values(['E-score'])
8-mer | 8-mer.1 | E-score | Median | Z-score | |
---|---|---|---|---|---|
27981 | GCTCCCCC | GGGGGAGC | -0.48828 | 25687.96 | -2.5398 |
25953 | GAGGGGCC | GGCCCCTC | -0.46804 | 25757.92 | -2.5176 |
27394 | GCCTGCCC | GGGCAGGC | -0.45769 | 27481.59 | -1.9898 |
5949 | ACGACCGA | TCGGTCGT | -0.45199 | 29127.70 | -1.5158 |
9049 | AGCGACGG | CCGTCGCT | -0.45145 | 29360.71 | -1.4509 |
26822 | GCAGCACC | GGTGCTGC | -0.44968 | 28347.12 | -1.7372 |
29517 | GGTGCACC | GGTGCACC | -0.44605 | 30882.95 | -1.0391 |
29188 | GGGGCCTA | TAGGCCCC | -0.44496 | 26950.85 | -2.1487 |
26801 | GCAGACCC | GGGTCTGC | -0.44250 | 28495.80 | -1.6945 |
29099 | GGGCCCCC | GGGGGCCC | -0.44223 | 28889.13 | -1.5828 |
18273 | CCCCCTGC | GCAGGGGG | -0.44188 | 27396.30 | -2.0152 |
6269 | ACGCGTGC | GCACGCGT | -0.44097 | 26891.55 | -2.1667 |
6700 | ACGTGCGC | GCGCACGT | -0.44065 | 28821.50 | -1.6019 |
29033 | GGGAGCCC | GGGCTCCC | -0.43975 | 28944.52 | -1.5672 |
20718 | CGCACGTC | GACGTGCG | -0.43467 | 29395.04 | -1.4414 |
9754 | AGGCCCGG | CCGGGCCT | -0.43335 | 26597.53 | -2.2563 |
28872 | GGCGTACC | GGTACGCC | -0.43291 | 28223.05 | -1.7729 |
29122 | GGGCGCGA | TCGCGCCC | -0.43138 | 29019.16 | -1.5463 |
18058 | CCCAATGC | GCATTGGG | -0.43128 | 29110.97 | -1.5205 |
28675 | GGCAGCTA | TAGCTGCC | -0.42901 | 29017.56 | -1.5467 |
9130 | AGCGCTGC | GCAGCGCT | -0.42242 | 29291.61 | -1.4701 |
1688 | AACGGGGC | GCCCCGTT | -0.42039 | 28421.62 | -1.7158 |
9924 | AGGGAGCC | GGCTCCCT | -0.42014 | 28947.24 | -1.5665 |
18256 | CCCCCGAC | GTCGGGGG | -0.41950 | 26842.06 | -2.1817 |
13225 | ATGGAGCC | GGCTCCAT | -0.41903 | 29595.17 | -1.3861 |
17614 | CCACGGGG | CCCCGTGG | -0.41775 | 28963.92 | -1.5618 |
29097 | GGGCCCAC | GTGGGCCC | -0.41556 | 29072.65 | -1.5313 |
18303 | CCCCGGCG | CGCCGGGG | -0.41452 | 28757.47 | -1.6201 |
2351 | AAGCCCCC | GGGGGCTT | -0.41420 | 28141.49 | -1.7965 |
9749 | AGGCCCCC | GGGGGCCT | -0.41417 | 26884.50 | -2.1688 |
... | ... | ... | ... | ... | ... |
25733 | GAGATATC | GATATCTC | 0.47773 | 95080.10 | 8.1234 |
11876 | ATATCTCC | GGAGATAT | 0.47804 | 86375.12 | 7.3411 |
3205 | AATATCAA | TTGATATT | 0.48000 | 96129.09 | 8.2128 |
8410 | AGATATAT | ATATATCT | 0.48000 | 104584.56 | 8.8997 |
8420 | AGATATTG | CAATATCT | 0.48159 | 101836.03 | 8.6827 |
11883 | ATATCTTG | CAAGATAT | 0.48196 | 95941.59 | 8.1969 |
2815 | AAGTATCT | AGATACTT | 0.48370 | 108555.24 | 9.2033 |
2219 | AAGATATC | GATATCTT | 0.48449 | 110205.64 | 9.3263 |
11882 | ATATCTTC | GAAGATAT | 0.48521 | 100548.56 | 8.5791 |
55 | AAAAATCT | AGATTTTT | 0.48575 | 113259.50 | 9.5490 |
3212 | AATATCCT | AGGATATT | 0.48582 | 97310.50 | 8.3124 |
11872 | ATATCTAA | TTAGATAT | 0.48690 | 115308.85 | 9.6951 |
11881 | ATATCTTA | TAAGATAT | 0.48751 | 110205.64 | 9.3263 |
562 | AAAGATAT | ATATCTTT | 0.48833 | 114539.50 | 9.6406 |
8419 | AGATATTC | GAATATCT | 0.48885 | 124776.51 | 10.3381 |
11327 | ATAATATC | GATATTAT | 0.49176 | 115367.77 | 9.6993 |
819 | AAATATCG | CGATATTT | 0.49198 | 111871.07 | 9.4485 |
3218 | AATATCTC | GAGATATT | 0.49298 | 122324.11 | 10.1763 |
8414 | AGATATCT | AGATATCT | 0.49332 | 149562.21 | 11.8144 |
817 | AAATATCA | TGATATTT | 0.49348 | 140105.47 | 11.2822 |
3219 | AATATCTG | CAGATATT | 0.49376 | 131118.93 | 10.7421 |
14522 | CAAATATC | GATATTTG | 0.49481 | 130830.38 | 10.7241 |
3217 | AATATCTA | TAGATATT | 0.49520 | 140469.23 | 11.3033 |
8418 | AGATATTA | TAATATCT | 0.49588 | 159459.88 | 12.3365 |
24743 | GAAATATC | GATATTTC | 0.49619 | 149768.90 | 11.8256 |
2221 | AAGATATT | AATATCTT | 0.49719 | 177068.59 | 13.1900 |
26225 | GATATTTA | TAAATATC | 0.49745 | 181082.77 | 13.3726 |
818 | AAATATCC | GGATATTT | 0.49795 | 160868.87 | 12.4082 |
205 | AAAATATC | GATATTTT | 0.49912 | 253196.75 | 16.1039 |
820 | AAATATCT | AGATATTT | 0.49942 | 270175.71 | 16.6327 |
32896 rows × 5 columns
CCA1 = array(pandas.read_csv('PBMS/CCA1_8mers.txt', delimiter='\t'))
CCA1
array([['AAAAAAAA', 'TTTTTTTT', 0.30529, 45366.56, 2.0944], ['AAAAAAAC', 'GTTTTTTT', 0.2516, 39653.74, 0.9978], ['AAAAAAAG', 'CTTTTTTT', 0.28368000000000004, 47122.61, 2.4038], ..., ['TTTGAAAA', 'TTTTCAAA', 0.11617999999999999, 36442.57, 0.3097], ['TTTGCAAA', 'TTTGCAAA', 0.18292, 37862.76, 0.6212], ['TTTTAAAA', 'TTTTAAAA', 0.35291, 53075.71, 3.3732]], dtype=object)
EE = 'AAAATATC'
CBS = 'AAAAAATC'
CCR2_mut = 'AAAATCGA'
for idx,seq in enumerate(CCA1):
if EE == CCA1[idx][0]:
pos_EE = idx
if CBS == CCA1[idx][0]:
pos_CBS = idx
if CCR2_mut == CCA1[idx][0]:
pos_CCR2_mut = idx
array(CCA1[:,2])
array([0.30529, 0.2516, 0.28368000000000004, ..., 0.11617999999999999, 0.18292, 0.35291], dtype=object)
figure(figsize=(7*2,5*2))
#hist(CCA1[:,2], bins=100)
xlabel('E-score', fontsize=22)
sns.distplot(CCA1[:,2], color="b")
ylabel('Frequency', fontsize=22)
xticks(fontsize=20)
yticks(fontsize=20)
#savefig('images/E_scores_CCA1_dist.png', format='png', dpi=300)
(array([0. , 0.5, 1. , 1.5, 2. , 2.5]), <a list of 6 Text yticklabel objects>)
EE_Kd = 8
CBS_Kd = 16
CCR2_mut_Kd = 235
affinties = log10(array([EE_Kd,CBS_Kd,CCR2_mut_Kd]))
intensities = array([CCA1[pos_EE][2],CCA1[pos_CBS][2],CCA1[pos_CCR2_mut][2]])
EE_Kd = 2.66
CBS_Kd = 4.91
CCR2_mut_Kd = 235
affinties = log(array([EE_Kd,CBS_Kd,CCR2_mut_Kd]))
intensities = array([CCA1[pos_EE][2],CCA1[pos_CBS][2],CCA1[pos_CCR2_mut][2]])
figure(figsize=(7,5))
plot(affinties,
intensities, 'o-')
#ylim(0.2,0.55)
#xlim(1.5,6)
ylabel('E-Score', fontsize=22)
xlabel('ln(Kd)', fontsize=22)
xticks(fontsize=16)
yticks(fontsize=16)
#savefig('images/Kd_vs_Escoe.pdf', dpi=300, format='pdf')
(array([0.2 , 0.25, 0.3 , 0.35, 0.4 , 0.45, 0.5 , 0.55]), <a list of 8 Text yticklabel objects>)
slope, intercept, r_value, p_value,std_err = linregress(affinties,intensities)
linregress(affinties,intensities)
LinregressResult(slope=-0.05503097538373463, intercept=0.551601304645103, rvalue=-0.9999390585113125, pvalue=0.007028357693400724, stderr=0.0006075731712832275)
figure(figsize=(7*2,5*2))
#subplot(1,2,1)
log_kd = linspace(0,8)
plot(log_kd,slope*log_kd+intercept,'k',lw=5)
plot(affinties,intensities, 'ro', markersize=22)
xlabel('ln(Kd nM)', fontsize=30)
yticks(fontsize=25)
ylabel('E-score', fontsize=30)
xticks(fontsize=25)
#subplot(1,2,2)
#log_kd = linspace(0,10)
#plot(exp(log_kd),exp(slope*log_kd+intercept))
#plot(exp(affinties),exp(intensities), 'ro')
#xlim(0,300)
#xlabel('Kd', fontsize=22)
#yticks(fontsize=16)
#ylabel('exp(E-score)', fontsize=22)
#xticks(fontsize=16)
savefig('images/Kd_vs_Escore_linearregress.png', dpi=300, format='png')
savefig('images/Kd_vs_Escore_linearregress.pdf', dpi=300, format='pdf')
savefig('images/Kd_vs_Escore_linearregress.svg', dpi=300, format='svg')
genome_kds_for = {}
genome_kds_rev = {}
for i in CCA1:
genome_kds_for[i[0]]=((i[2]-intercept)/slope)
genome_kds_rev[i[1]]=((i[2]-intercept)/slope)
Then we have the genomic we can import genomic sequences from TAIR
clockgenes = {'CCA1' : 'AT2G46830', 'LHY': 'AT1G01060',
'TOC1' : 'AT5G61380', 'GI':'AT1G22770',
'PRR7':'AT5G02810', 'PRR9':'AT2G46790',
'PRR5':'AT5G24470', 'LUX':'AT3G46640',
'ELF3':'AT2G25930', 'ELF4':'AT2G40080',
'ZTL':'AT5G57360'}
meristematic = {'AN3':'AT5G28640'}
chromosome_dict = {'AT1':'NC_003070.gbk','AT2':'NC_003071.gbk','AT3':'NC_003074.gbk','AT4':'NC_003075.gbk','AT5':'NC_003076.gbk'}
chromosomes_seq={}
chromosomes_genes={}
chromosome_concatenated = 'A'
for chromosome in os.listdir('ATGenome/'):
print 'Processing chromosome ', chromosome
genes={}
chromosomes_seq[chromosome] = SeqIO.read('ATGenome/'+chromosome, 'genbank')
chromosome_concatenated = chromosome_concatenated+chromosomes_seq[chromosome].seq
for f in chromosomes_seq[chromosome].features:
if f.type == 'gene':
genes[f.qualifiers['locus_tag'][0]] = f
chromosomes_genes[chromosome] = genes
Processing chromosome NC_003070.gbk Processing chromosome NC_003071.gbk Processing chromosome NC_003074.gbk Processing chromosome NC_003075.gbk Processing chromosome NC_003076.gbk
Then we study the background in terms of affinity by creating a subset of randomly sampled 10,000 genomic regions of length 1kb.
First we concatenate all the chormosomes in a single long string and from it we sample the seqeunces
promoter_length = 400
pos = range(0,len(chromosome_concatenated)-promoter_length)
random_regions = random.choice(pos,1000)
We first extract all the promoters of all the genes and collect them in a dictionary. This promoters will be 1.5 Kb from the transcription start site
Then from the random regions we calcualte the background model and we save it
ensemble = load('PBM_matrix_inference/CCA1_ensemble.npy')
seq
array(['TTTTAAAA', 'TTTTAAAA', 0.35291, 53075.71, 3.3732], dtype=object)
def seq_energy(seq, energy_matrix):
bound = {}
for j in range(0,len(seq)-7):
energy = 0
for i in range(8):
if seq[j+i] == 'A':
energy += energy_matrix[0][0,i]
elif seq[j+i] == 'T':
energy += energy_matrix[0][1,i]
elif seq[j+i] == 'G':
energy += energy_matrix[0][2,i]
elif seq[j+i] == 'C':
energy += energy_matrix[0][3,i]
if energy < energy_matrix[1] :
bound[j] = 1
return bound
def matrix_normalisation(energy_matrix_preturbed):
temp = copy(energy_matrix_preturbed[0])
x= 0
for i in range(8):
x+=min(temp[:,i])
for i in range(8):
for j in range(4):
energy_matrix_preturbed[0][j,i] = (energy_matrix_preturbed[0][j,i] - min(temp[:,i]))/(energy_matrix_preturbed[1]-x)
energy_matrix_preturbed[1] = 1.0
return copy(energy_matrix_preturbed)
norm_mat = matrix_normalisation(ensemble[-20000])
#boundf = seq_energy(seq,norm_mat)
#boundr = seq_energy(seq.reverse_complement(),norm_mat)
def seq_energy_eightmere(seq, energy_matrix):
energy = 0
for i in range(8):
if seq[i] == 'A':
energy += energy_matrix[0][0,i]
elif seq[i] == 'T':
energy += energy_matrix[0][1,i]
elif seq[i] == 'G':
energy += energy_matrix[0][2,i]
elif seq[i] == 'C':
energy += energy_matrix[0][3,i]
if energy < energy_matrix[1] :
return 1
else:
return 0
bound_bin = []
unbound_bin =[]
for idx, s in enumerate(CCA1_pandas['8-mer']):
if seq_energy_eightmere(s,norm_mat):
bound_bin.append(CCA1_pandas.iloc[idx]['E-score'])
else:
unbound_bin.append(CCA1_pandas.iloc[idx]['E-score'])
figure(figsize=(7*2,5*2))
hist(unbound_bin, alpha=0.5, label='Unbound', bins=30)
hist(bound_bin, alpha=0.5, color='orange', label='Bound', normed=False, bins=30)
legend(loc='upper right', fontsize=22)
xticks(fontsize=22)
yticks(fontsize=22)
ylabel('Ocurrence', fontsize=22)
xlabel('E-score', fontsize=22)
title('CCA1', fontsize=30)
savefig('images/EMA_separation_CCA1.png', format='png', dpi=600)
savefig('images/EMA_separation_CCA1.svg', format='svg', dpi=600)
savefig('images/EMA_separation_CCA1.pdf', format='pdf', dpi=600)
CCA1_peaks = asanyarray(pandas.read_csv('CCA1peaks_Kamioka2016', delimiter='\t', header=None))
CCA1_peaks
array([[1, 107656, 107910, 107783, 'AT1G01250'], [1, 107656, 107910, 107783, 'AT1G01260'], [1, 120415, 120931, 120673, 'AT1G01305'], ..., [5, 26932953, 26933344, 26933149, 'AT5G67488'], [5, 26949586, 26950106, 26949846, 'AT5G67550'], [5, 26949586, 26950106, 26949846, 'AT5G67560']], dtype=object)
The indexing for getting both forward and backward is $abs(i-m)$. where m is the sequence length and i is the squence position this
def affinity_calc_energy_mat(seq, genome_kds_for, genome_kds_rev, boundf,boundr):
affinities = 0
k = boundf.keys()
for pos in k:
try:
affinities+=(1/exp(genome_kds_for[seq[pos:pos+8]]))
except:
pass
k = boundr.keys()
len_seq = len(seq)
for pos in k:
try:
affinities+=(1/exp(genome_kds_rev[seq[abs(pos-len_seq):abs(pos-len_seq)+8]]))
except:
pass
return affinities
def affinity_calc(seq, genome_kds_for, genome_kds_rev):
affinities = 0
for pos in range(len(seq)-8):
try:
affinities+=(1/exp(genome_kds_for[seq[pos:pos+8]]))
except:
pass
try:
affinities+=(1/exp(genome_kds_rev[seq[pos:pos+8]]))
except:
pass
return affinities
CCA1_peaks = asanyarray(pandas.read_csv('CCA1peaks_Kamioka2016', delimiter='\t', header=None))
CCA1_peaks
array([[1, 107656, 107910, 107783, 'AT1G01250'], [1, 107656, 107910, 107783, 'AT1G01260'], [1, 120415, 120931, 120673, 'AT1G01305'], ..., [5, 26932953, 26933344, 26933149, 'AT5G67488'], [5, 26949586, 26950106, 26949846, 'AT5G67550'], [5, 26949586, 26950106, 26949846, 'AT5G67560']], dtype=object)
affinities = {}
background = {}
gene_num = 863
for idx, gene in enumerate(CCA1_peaks[:,4]):
print gene, float(idx)/gene_num
peak = chromosomes_seq[chromosome_dict[gene[0:3]]].seq[CCA1_peaks[idx,1]:CCA1_peaks[idx,2]]
affinities[gene]=affinity_calc(peak,genome_kds_for,genome_kds_rev)
print gene, float(idx)/gene_num
promoter_length = CCA1_peaks[idx,2]-CCA1_peaks[idx,1]
pos = range(0,len(chromosome_concatenated)-promoter_length)
random_regions = random.choice(pos,1000)
affinities_background = []
for randome_region in random_regions:
affinities_background.append(affinity_calc(chromosome_concatenated[randome_region:(randome_region+promoter_length)],
genome_kds_for, genome_kds_rev, ))
background[gene] = affinities_background
AT1G01250 0.0 AT1G01250 0.0
KeyboardInterruptTraceback (most recent call last) <ipython-input-46-c17ccf8a8ddf> in <module>() 9 promoter_length = CCA1_peaks[idx,2]-CCA1_peaks[idx,1] 10 pos = range(0,len(chromosome_concatenated)-promoter_length) ---> 11 random_regions = random.choice(pos,1000) 12 affinities_background = [] 13 for randome_region in random_regions: mtrand.pyx in mtrand.RandomState.choice() /usr/local/lib/python2.7/dist-packages/numpy/core/fromnumeric.pyc in prod(a, axis, dtype, out, keepdims, initial) 2662 2663 -> 2664 @array_function_dispatch(_prod_dispatcher) 2665 def prod(a, axis=None, dtype=None, out=None, keepdims=np._NoValue, initial=np._NoValue): 2666 """ KeyboardInterrupt:
#with open('background_with_matrix.pickle', 'wb') as handle:
# pickle.dump(background, handle)
#with open('affinities_with_matrix.pickle', 'wb') as handle:
# pickle.dump(affinities, handle)
with open('background_with_matrix.pickle', 'rb') as handle:
background_matrix = pickle.load(handle)
with open('affinities_with_matrix.pickle', 'rb') as handle:
affinities_matrix = pickle.load(handle)
#with open('background.pickle', 'wb') as handle:
# pickle.dump(background, handle)
#with open('affinities.pickle', 'wb') as handle:
# pickle.dump(affinities, handle)
with open('background.pickle', 'rb') as handle:
background = pickle.load(handle)
with open('affinities.pickle', 'rb') as handle:
affinities = pickle.load(handle)
background[clockgenes['TOC1']]
[1.8344671185606463, 0.5581885675753785, 1.6666260996447475, 2.9631302790305827, 0.8573496464806986, 1.2839613795817875, 0.6676937073951321, 1.2722133658388959, 0.8862839630077786, 0.6280772286263727, 2.2634420641586392, 0.15331004126379708, 0.359699122303179, 0.8209949599075179, 1.2987760109081201, 3.658462906410868, 1.310714779359457, 0.7108775019423363, 0.570284156900204, 1.2206739975154122, 2.3699734335697697, 0.8783783519025448, 2.2751364663556757, 0.6778623843486707, 1.7342371460087027, 1.5433241348362228, 1.7940045459214824, 1.7920277977545442, 1.628918826244327, 0.8918074565850429, 1.4511866862269174, 0.8481687548175212, 1.3862989023444077, 1.0713848890694222, 1.5275990023017596, 2.4102298035103953, 1.8382837789971387, 1.5155863656461352, 0.5599169824366934, 1.7300741055403541, 1.1319675440705532, 1.2305319042599574, 1.7493274443812805, 1.7779092154478942, 0.7712527986924155, 1.1289557247397062, 0.49471197738765665, 1.6858865806565722, 1.0257009482860995, 1.61073416132463, 1.1165992887453715, 1.488331295183724, 0.3737272606050346, 3.1490945011105493, 0.9747344430994359, 1.1803827418822501, 1.1515768306456615, 1.1184115820894345, 1.3666939411027872, 2.0589379867848288, 1.306263646507218, 0.9407865898687695, 3.1694604860190116, 1.711066867956474, 0.9980875935629131, 3.8177349185636618, 1.3788766108705584, 1.7820452274601735, 0.49301124605016616, 1.8584766430884958, 1.3158557562582054, 0.8748038648004073, 1.379600562612426, 1.7876236774415228, 1.6258121266418504, 2.0630156096055425, 2.2727787593094537, 1.6370173654599023, 1.6280590323812254, 1.756849041411956, 0.78154844563768, 1.853390389550714, 1.3141358981787556, 0.6607650110854766, 1.234143647446182, 2.7707860193519127, 1.2963116988290637, 1.5290417224767419, 1.9430776449737348, 3.0619643497202653, 1.1067695003789253, 2.3249846417039866, 2.3067519009930146, 0.21334181467179106, 1.6408004495164072, 2.1708228396539226, 3.872032474569528, 0.5841653250155974, 1.2670965554364793, 0.39448329011753797, 0.4226206779208499, 2.9249763154403827, 1.3507592735141736, 1.1312300568701101, 1.4272165823362748, 1.0406770754828383, 2.581813634617987, 0.7312900958359524, 1.5268063310333118, 1.1327883298774348, 1.3390150552638111, 1.729811341964295, 1.2755424049036832, 2.5939922857355824, 0.7963378489157146, 0.6178955679166092, 0.722382871884315, 0.6499144917935413, 1.6457151765383515, 1.3795070198570676, 1.3027171099981876, 1.3980069437278757, 0.5739701000774289, 1.8432519782185273, 1.228557466249194, 0.5737028130869316, 2.5290383836026717, 1.4562323433477102, 1.1115547546463118, 0.3895736210552276, 2.5956221319476063, 1.3772738940160827, 1.0605931411579574, 1.4264257015922563, 1.5389988901021874, 0.6037374700709102, 0.8840519093258482, 0.7699866924683155, 2.808871285389614, 0.9242213291408938, 1.308762881414728, 2.3169037406266817, 2.823930282399112, 0.6974349049318779, 1.2206457929077728, 1.1564399870318305, 0.9932588037622054, 0.7459649921918311, 0.6407361120254438, 1.0538894520239923, 3.0185029131726053, 0.8274033155286387, 0.7547129173420422, 1.037387129121822, 2.0255894474249345, 2.9420895900026105, 0.41875963638270103, 1.450995763936315, 0.6323362898366329, 0.5715985137933254, 2.1869668263838733, 1.934714853723143, 1.1678803462873066, 1.569036396428576, 0.8461246244012719, 1.7980771179092023, 1.1702881417804327, 0.9143078551908002, 0.633818578213963, 2.0414252882236172, 0.5827999216734266, 0.6199397306952568, 2.782918824931988, 1.7933030300162534, 2.0950210188901446, 0.9498539568365775, 1.8346539266003148, 1.2532642144787998, 1.2561417934319195, 1.1763630924344746, 1.2190439435908673, 0.6395772209718067, 1.9261465191006075, 0.7091086182553801, 4.1044523607800585, 1.8553821003587123, 1.0527500232504974, 0.6227504186255158, 1.1120702300245102, 1.3675297206965586, 1.3887562818614234, 0.7062992591628383, 2.839519757651368, 1.8717495941406128, 2.1093526454757234, 0.28813956013218045, 0.9549669262104108, 0.4801884238707022, 0.7469760557036084, 0.5389283847147212, 1.0783329694252548, 2.233248883329926, 1.2681790265408335, 0.7762471766127289, 1.219895280261644, 0.9407811558023226, 1.4766331767075145, 1.8226732713515423, 1.2371150126948565, 1.5086728102771731, 1.2669608853238223, 1.0142787658986925, 0.5555741546340411, 2.1180203924106, 1.181378299684626, 0.9817283585234224, 1.0833961715672062, 0.5147695280483782, 1.4439115808386627, 1.0620915692169446, 2.091654107751902, 1.6188217789412462, 2.62962724411249, 1.876318163438182, 0.6717420099997343, 2.3138918311587897, 1.019846012393044, 0.7617597102722453, 2.0000402948280924, 0.9580876436193031, 3.099972420071439, 1.3240414826963, 0.6730649818695763, 3.166135750839546, 1.4622587607695514, 1.4314925803549485, 1.9767732481750127, 1.1772031496563635, 1.7698944937363177, 2.933128176681148, 1.0477968306471743, 2.052899401742616, 2.2874394973610763, 1.1969053256199371, 1.090994914392598, 0.5626624707607544, 3.079793518337097, 1.5288508396347753, 0.6412789185431288, 1.539149995622435, 2.1613200907977355, 2.8774104471274304, 3.8253083235308902, 2.449047374028674, 1.4780557637260856, 0.7503453821574961, 0.7933032675939116, 1.2627710322162309, 2.4814776862575845, 1.2460022240682445, 1.705420011445832, 0.7246720560396855, 2.2930358988955297, 0.6011300067227717, 1.770417531998855, 1.0871798722635542, 0.5956315402618119, 1.7384115782286165, 0.7120693882416358, 1.505675022846593, 2.5006190471614143, 1.098830946867868, 0.5087747411926135, 1.7802624278506742, 2.0349517630113843, 0.6811017063470295, 1.2102408805294458, 1.67277333366683, 1.336334239801373, 0.8604136599111931, 1.0613245695113873, 1.5587152684332606, 1.6078519402984233, 0.8660264058200142, 1.2864083033315803, 0.48600138626581557, 0.46007707012554355, 1.7016616004403984, 1.3981257659416984, 2.1701945670264604, 2.053539832522787, 2.223031348443923, 1.973807850501834, 1.4917707030564757, 1.185564063287282, 2.437386775013322, 0.9002963656970566, 1.8651475197802896, 0.918278445414756, 0.7876958882608266, 0.8135840148103003, 1.0018720088279605, 0.9389725407542446, 1.4053450677391757, 1.6486104567479327, 2.4775334352265586, 1.0249854474932454, 2.1807720328724973, 1.666039681730903, 1.1281670910766628, 0.7172654289812807, 1.2025463212120082, 1.2968147486352062, 0.8919078311010895, 0.9432833055345041, 3.4614297687800124, 1.219304458784168, 2.944678264331021, 1.0171756093156905, 0.689463874316123, 0.3784011302877259, 1.5494528694299512, 1.1878633567418628, 0.7609667164680533, 0.5990854706332511, 0.38927932554645917, 1.7629842500306105, 0.9046089649163438, 0.4671405064401546, 1.5667214270848473, 0.8528111960790141, 1.937534109173258, 1.2683525447477866, 1.8063251564371974, 1.419407445120673, 0.8164975702610626, 0.9395842672980448, 1.8025721879548597, 1.4210980736559096, 2.065387599058849, 0.5090360932131434, 1.2654357963909368, 1.9312149746264438, 1.182407906163309, 0.7714156468629678, 1.1638489536739212, 1.4298782868076843, 1.9616119409639416, 1.366961373873103, 1.0227377911933153, 1.3274553718606894, 0.9388756524745211, 1.6773038760401464, 1.1886141605405598, 1.3422001484690964, 0.8722227603139245, 0.833486395457064, 1.696568472175836, 0.8215956503821809, 1.541293439126772, 1.5412016978013248, 0.9177047046854506, 0.5321124625665602, 1.3469808111220962, 2.0111122343466885, 1.8927074067711946, 1.679371167702375, 2.3616537621725704, 1.758710696810305, 0.4402194339352102, 1.8379615461689625, 3.423884002843686, 1.9807806158237686, 0.7807512080592401, 0.49768800121156526, 1.0431806577852036, 1.2210156684518272, 1.752878251956046, 1.9629378565109998, 1.2130383212720286, 1.275757264137097, 3.490635410098091, 2.0761784254635947, 0.9661683099885355, 1.8746953445397248, 1.4399534703530188, 1.4923428368724756, 0.7834819874646577, 2.7778191141442035, 1.4726824213901193, 1.165046799726863, 1.7150786303796333, 0.628000522163409, 1.970336902652698, 0.3599347815462103, 0.7172633099352208, 1.4987825239786214, 2.444617649144205, 0.8866663796093673, 1.249939765332793, 3.0750320797923325, 0.991816665380838, 0.4355717176035188, 1.3642519942966973, 2.2498059369569856, 1.2529835247894012, 1.5991006730097028, 0.8907972232533928, 1.442082405589513, 1.4533759981489143, 1.6207834783880894, 0.7868632374555689, 0.5371620074342173, 1.3299428871680399, 2.1814501989459596, 2.6750240892234673, 1.2812223957187403, 0.522147490571795, 2.521151912177446, 0.6445687275981357, 1.5991770984293383, 1.8145246544136668, 1.7160216330919649, 1.5973709629504935, 2.8452893401199955, 1.2594633971327067, 0.8911127616346971, 1.108344153083946, 2.0851213585485806, 1.3180780165178991, 1.6199798766449003, 1.2167533920173372, 0.4666000318531621, 2.0859675801109616, 0.5284004356394651, 0.5752610154305617, 1.3983724628002971, 0.517044304012011, 1.4104666181173071, 2.041330759537434, 2.183334052326599, 1.7575135200031504, 1.115661940898704, 2.2158892119846816, 1.1038175681567164, 1.0635768495704814, 1.850717009961305, 1.474520372647318, 0.8118398981672968, 0.7728264405106935, 2.4996962361219923, 1.5138705076954995, 0.6801946947015686, 0.4406853383503917, 1.4181030142464244, 2.016708023694193, 1.4729360223411745, 2.8490938774278285, 1.2315233661837337, 0.8663678156518931, 1.1923799013252274, 3.269381861734886, 1.6747208663070008, 0, 1.4546190801518664, 0.3977466860039558, 0.9787808052374632, 0.7698774312546817, 0.8991066048227185, 1.5958509445664157, 1.6323470956094024, 2.0047054855272073, 1.5070894739695078, 0.5807281742976725, 0.772916755158017, 0.8487270290518782, 1.083044342297007, 1.1904919972138868, 0.755495372750296, 1.5669479809517999, 1.1494814563539388, 2.357987269644912, 0.9090095740780009, 1.6417745535372705, 1.451698682760052, 2.106622916191012, 0.665220944904016, 1.06461696239402, 0.5255201091864808, 0.8943206953063454, 4.37373881462635, 0.49304040779012537, 2.0811926507767713, 1.862757536275302, 2.203613461774125, 1.3791109752327444, 1.0992319017256378, 0.6680138020598744, 0.8703652046953575, 2.303881141991623, 0.7975222716571284, 1.2930739262535995, 0.8290981521964983, 2.5756668022932785, 1.8749616242366713, 1.0347447168226853, 2.798814569208071, 1.6530358508872884, 0.624338819209143, 1.1172514279503023, 1.34461750027628, 0.6837975385308185, 2.2367585304341704, 1.5173971132853372, 2.418683305422879, 1.2814474932356967, 1.0898575808347535, 2.060393949798845, 1.7778029628987997, 1.1113420729554797, 2.504562991448412, 1.9164103406340336, 1.7905767891533293, 1.7117974413828367, 2.217714224891141, 1.991211178459064, 2.7161994257254305, 1.3020662570631507, 1.0157611577361865, 2.758353702367185, 2.6137830341085215, 0.2863122351010011, 0.5593829245584189, 0.9875996014214576, 3.8279341255058124, 2.0501918185472032, 1.379391396418904, 1.4072146925407856, 1.0653336091624903, 1.5382323193195961, 2.8944912768086457, 1.3061634765372845, 1.0710430719888788, 0.8611340760621063, 1.0975766735729842, 1.6356835763044666, 2.1655630168580617, 3.2991487979300977, 1.6496411844241199, 1.1384057431606853, 1.3949552263055975, 0.506327753194699, 2.106967370256788, 1.5264226797778282, 3.396801009854954, 2.610416233073217, 1.1724552695774038, 1.3609198952649328, 1.9518215540065105, 1.0426885115060351, 1.8050615275134858, 1.9564621650859988, 0.6102196602166482, 0.12409881103652666, 0.6995286974124321, 0.8193144275216138, 0.596018941188792, 1.4907177600388093, 2.8212907190312007, 1.2219670794636002, 1.2775897756717693, 2.0913130140618783, 1.0740527039571985, 3.563751668594284, 2.21986120715612, 1.1586909904008162, 0.6172245748848451, 1.862791167396533, 2.0423562982492522, 1.2656363886890145, 2.2011567642063183, 1.6692441320289242, 2.4729331688595892, 0.7273225734267964, 1.4615138197233253, 2.0138332119974405, 1.155153232117657, 1.764759036089811, 0.36809641382442243, 2.4582475494071, 0.8231485392845656, 1.0711451651133557, 2.9403367422045363, 2.472243010518679, 1.022668834871983, 1.2418003196753808, 1.3606004883010636, 1.2576714793491321, 1.469059507727747, 2.4258508295139514, 1.9646095212305796, 1.2806537457240914, 1.7411132692839932, 1.3540804429881363, 2.64428816601439, 1.85662143598271, 1.10263968733414, 0.37245119392116355, 1.438286788231995, 1.6588958257234752, 0.94694209810703, 1.302175077218993, 1.4354676928359371, 1.4358891445644024, 2.8669409311626404, 1.7524078935291267, 1.5989323642206075, 2.0342181812570344, 0.3541096757789658, 1.17723678239608, 0.9614944381715282, 3.23285961853322, 0.5929290290080447, 1.3135043949686454, 1.6922925327388103, 1.297980798372578, 0.8181931998775231, 0.43337967343376177, 0.661779627885746, 2.5295838341366497, 0.8238939389279785, 0.8091844270673196, 0.8190065376650707, 1.43629239290805, 1.8732234704312376, 2.1886259336975953, 1.1558193937460106, 0.37021677175709217, 0.7905355084381275, 0.6636550291714499, 0.6001625195092384, 0.9766555669558339, 0.9213057940232879, 1.6036027879096977, 0.6392335055258822, 2.093715843192151, 0.25909023217161925, 1.5422935162023517, 0.7140265063130423, 0.7569885988103103, 0.7723570775904487, 0.6102794248504202, 1.9187063484674025, 1.6566586574578652, 0.9221378897426942, 1.2711459224897148, 1.457375751056872, 1.006832019717008, 0.8523235986885024, 0.5299293123617645, 1.0040509560788318, 2.8205389893377846, 0.8324422752001527, 1.0641919191002889, 2.503045474058755, 1.197412893169442, 1.1650265660244676, 0.23842546883709748, 0.5545284922028275, 1.24658619999702, 0.8490941569292518, 1.238841195407834, 1.0192452175552928, 3.264674384319605, 0.730842330962766, 1.3803443704958842, 0.41438643017825894, 1.1356982966135496, 2.362972916097431, 1.030451078083989, 3.1235730833022513, 1.5550763730950892, 1.2970741392795444, 1.7361624482160052, 1.6174205903492855, 1.1632527432049788, 2.0357480067410725, 1.6523699454933987, 1.25735522391634, 1.85859856466044, 1.17032078972054, 2.0274482490117047, 1.386236724785523, 1.3183626939621844, 2.4944347407625753, 0.9847525214021189, 1.0747323984768637, 0.3163047651866706, 1.23190529980638, 1.368691089685277, 1.6149223160365405, 0.5941877911526684, 1.2538551117545862, 1.4542790817696758, 1.3934373890517375, 1.4149685302237098, 1.159469861379387, 0.636151754627942, 0.8759357401978819, 0.594221522893894, 2.0778911111768874, 0.9050589267198129, 1.4615271389031574, 0.7249077014267056, 4.85394863350978, 1.3415523310653683, 1.9688796640505195, 2.6013266924274547, 1.654545338114729, 1.7887407055396405, 1.2224615080630477, 0.5471131301020424, 1.589989161356984, 2.5139367193881164, 0.7550762191284522, 0.4373810211150726, 0.6811128669955079, 0.844856592678257, 2.243709605763798, 0.46280688799943276, 1.2510604396904874, 2.2179295688419316, 2.094880662357471, 0.6581462022119247, 0.9205927938111705, 1.7835260889976339, 0.7411030571943898, 1.0309348509858212, 1.464303974948998, 1.9757493496979222, 0.4587344662979919, 1.7196345028452622, 0.5488795740498863, 2.8333014060215804, 2.50467993843242, 1.607713216884217, 1.259540829278591, 1.7790329330946124, 1.8770111994731526, 2.3630483243068987, 1.2161329763625852, 2.0937277816168853, 1.5714502197660558, 1.5396022669778904, 2.2103699145931874, 0.5381815143376417, 1.1977151276583247, 1.0502228844384978, 2.493738260086247, 2.5601584015237453, 1.9008879368313294, 1.0188553281960804, 1.1782955204646606, 1.343889699724522, 1.95265411711751, 1.612498151211774, 1.0935909147594474, 0.5908195855136503, 1.2672397788145757, 1.6132727862586695, 2.467383393144308, 0.5802672107522919, 1.870928027348814, 0.6336037372837301, 1.153699506255745, 1.872433222103622, 2.611214346485318, 1.6018992138507069, 0.3653419705553188, 1.1217082563772172, 0.7969989101457937, 0.8015043131140276, 1.0006872301024887, 1.3837987290863756, 1.5853486986165743, 0.9768969005055296, 0.4220041247069584, 2.006426168294986, 1.992152687473707, 1.092609567791169, 1.2826395465108127, 0.4996694487680762, 1.158144707273152, 1.252066618021406, 0.5661599921298359, 1.8154542338167001, 0.7223612081763838, 1.335340695100542, 1.2154017628962406, 1.4411125414645782, 1.5372981809689652, 1.3738557872977843, 0.9476180318395552, 0.8200955710895038, 0.7019120316265622, 1.4189336327091269, 0.8538079064229707, 0.906831264171468, 0.8952233575321795, 1.4149487421985028, 1.5490573998655137, 1.015523688837949, 3.361094335079852, 1.1371903054643822, 1.1519487830047648, 1.5996213391480572, 1.1215149796348527, 2.0740759588629047, 0.9998008980596602, 2.4704761801932933, 0.46730455680599986, 1.3413958967008515, 2.616922056191747, 1.3491116973731014, 1.5276519108450834, 0.698298237361369, 1.8150609350631908, 1.1052636318928608, 0.6563704977105715, 0.9267566065905495, 1.2159384766691756, 2.019663394661801, 0.9956451045390143, 0.8904439418706204, 1.1518394374958603, 1.9583520818459863, 0.8963471894977187, 2.6638045507902395, 1.646783721097086, 0.5243362175531754, 1.854962069424317, 0.4930856427474717, 1.7255344554038252, 0.9299892892457483, 0.8535753269669297, 2.6367370474140346, 0.3009865300176775, 1.460330462362511, 2.486168183217785, 2.3878153338317056, 0.7695300350434213, 1.3433431593620546, 1.7273095407468981, 1.350945326415963, 1.9881547775894015, 0.48964578146463905, 1.910931128846307, 0.7997050322117092, 0.44930018287739715, 1.2921212557801791, 1.599121600219029, 1.3029704116231104, 1.1840606693891078, 0.5050003688119413, 0.5298398576802739, 2.063391931812277, 1.1939447194533386, 0.8459809620536427, 0.4798941021825611, 1.6282179169036821, 1.4466233665940949, 1.5676709193431844, 1.3452948854727447, 1.587704718859452, 1.2924408742469309, 1.370570892319204, 0.6745676943393414, 1.4262652897292953, 3.067719957952191, 1.6762683019616358, 1.9200706992535723, 2.114860968941124, 1.2147455439552792, 1.3987780743666467, 2.4959474404749638, 0.2479849199032661, 0.9313065000645993, 1.2838406472933515, 1.9680132300062119, 1.601621478737877, 2.0150426873831737, 2.4830925551064245, 1.2589886448776866, 1.0848177720892769, 0.515569889528379, 0.8772006833194425, 0.49708133209162053, 2.8681719959223906, 1.6548677885218013, 1.781174516524312, 1.0720791384827737, 0.8001419158677217, 2.2419187891003536, 2.7515518767751055, 0.7088400896634759, 1.3174740272393364, 0.7715133572010097, 1.5284443817435922, 1.856605398117466, 2.212115166217002, 2.2728456687500653, 1.0880858743915016, 1.7470281390678033, 2.3806212597904306, 1.3021528226367176, 1.8228060802086248, 3.102085720321795, 2.0814561730760026, 1.7744916010542138, 1.7071996696280924, 1.8160367928302321, 0.9746548797907604, 0.6181945427737751, 1.7219065232648036, 1.0516601143593696, 1.8060169508628487, 0.8761996636368585, 2.4438141215705746, 2.0706464783619367, 1.4138902699318916, 1.1670543833537992, 2.0175209396877483, 2.8039245001103335, 1.7566276439366295, 0.562409528006622, 1.5089634616841947, 0.9280276205495114, 1.385684774775358, 0.9505942597268305, 0.8219483620258132, 2.032211996426403, 1.5119710128784658, 0.46851791954170924, 1.469222256350784, 1.6640782019831704, 1.002860138848225, 1.2166387364155622, 2.3155160043568452, 1.4883468918976746, 1.2816254918459644, 3.0827506575445325, 1.392639823248613, 0.6840456433802147, 2.171201889946028, 0.7928731539448367, 1.6055548126162447, 0.9387334097736886, 1.9863490550111356, 0.742861936141805, 2.1219107561955806, 0.9926734488651351, 1.023122573954412, 1.2830302103295086, 1.1620732966990628, 0.9655207573941689, 1.5369457992853237, 0.9908083785654317, 2.600672418514531, 1.0445089189750953, 1.8351355430233172, 0.9204585613319385, 1.63288068112249, 1.5493478085796888, 1.4377672091378213, 1.646423670894179, 0.71676403348772, 1.119488948925118, 1.0801996224344657, 0.8788218741290419, 1.0462183135136272, 0.848836439950894, 3.203103034058676, 3.0621928321918483, 0.8129494882312861, 0.5786654715999358, 0.8019187647230215, 1.1397332121703203, 1.6462109007171568, 1.0900802186572627, 1.7201256924006327, 0.6861831182927246, 1.8221887722029408, 0.5059151184874964, 1.294210410904231, 1.3841492856877151, 2.860851531655892, 0.38700479429059736, 1.385767535413621, 0.669784637868556, 0.43618271203091546]
sns.set()
b_dist = array(background[clockgenes['TOC1']])[array(background[clockgenes['TOC1']]) > 0]
figure(figsize=(10,7))
hist((log(b_dist)-mean(log(b_dist)))/std(log(b_dist)), bins=100, normed=True, label='Full E-Score')
#savefig('images/toc1_background_raw_matrix.pdf', format='pdf', dpi=300)
b_dist = array(background_matrix[clockgenes['TOC1']])[array(background_matrix[clockgenes['TOC1']]) > 0]
hist((log(b_dist)-mean(log(b_dist)))/std(log(b_dist)), bins=100, normed=True, alpha=0.6, color='orange', label='EMA selected')
xlabel('Affinity ($1/K_d$)', fontsize=22)
xticks(fontsize=16)
yticks(fontsize=16)
ylabel('Frequency', fontsize=22)
legend(loc='upper right', fontsize=22)
#savefig('images/toc1_background_raw.png', format='png', dpi=300)
<matplotlib.legend.Legend at 0x43352c6050>
g = "CCA1"
figure(figsize=(10,7))
b_dist = array(background_matrix[clockgenes[g]])[array(background_matrix[clockgenes[g]]) > 0]
hist((log(b_dist)-mean(log(b_dist)))/std(log(b_dist)), bins=100, normed=True, label='Normed Ln(affinites)')
plot(linspace(-5,5,100),norm.pdf(linspace(-5,5,100),loc=0), lw=3, color='r', label='$N(0,1)$')
axvline((log(affinities_matrix[clockgenes[g]])-mean(log(b_dist)))/std(log(b_dist)), color='g', lw=3, label=g+' z-score')
xticks(fontsize=16)
yticks(fontsize=16)
xlabel('z-score', fontsize=22)
ylabel('Frequency', fontsize=22)
legend(loc='upper left', fontsize=16)
savefig('images/CCA1_background_matrix.pdf',format='pdf',dpi=300)
savefig('images/CCA1_background_matrix.png',format='png',dpi=600)
savefig('images/CCA1_background_matrix.svg',format='svg',dpi=600)
g = "PRR9"
figure(figsize=(10,7))
b_dist = array(background_matrix[clockgenes[g]])[array(background_matrix[clockgenes[g]]) > 0]
hist((log(b_dist)-mean(log(b_dist)))/std(log(b_dist)), bins=100, normed=True, label='Normed Ln(affinites)')
plot(linspace(-5,5,100),norm.pdf(linspace(-5,5,100),loc=0), lw=3, color='r', label='$N(0,1)$')
axvline((log(affinities_matrix[clockgenes[g]])-mean(log(b_dist)))/std(log(b_dist)), color='g', lw=3, label=g+' z-score')
xticks(fontsize=16)
yticks(fontsize=16)
xlabel('z-score', fontsize=22)
ylabel('Frequency', fontsize=22)
legend(loc='upper left', fontsize=16)
savefig('images/PRR9_background_matrix.pdf',format='pdf',dpi=300)
savefig('images/PRR9_background_matrix.png',format='png',dpi=600)
savefig('images/PRR9_background_matrix.svg',format='svg',dpi=600)
g = "PRR7"
figure(figsize=(10,7))
b_dist = array(background_matrix[clockgenes[g]])[array(background_matrix[clockgenes[g]]) > 0]
hist((log(b_dist)-mean(log(b_dist)))/std(log(b_dist)), bins=100, normed=True, label='Normed Ln(affinites)')
plot(linspace(-5,5,100),norm.pdf(linspace(-5,5,100),loc=0), lw=3, color='r', label='$N(0,1)$')
axvline((log(affinities_matrix[clockgenes[g]])-mean(log(b_dist)))/std(log(b_dist)), color='g', lw=3, label=g+' z-score')
xticks(fontsize=16)
yticks(fontsize=16)
xlabel('z-score', fontsize=22)
ylabel('Frequency', fontsize=22)
legend(loc='upper left', fontsize=16)
savefig('images/PRR7_background_matrix.pdf',format='pdf',dpi=300)
savefig('images/PRR7_background_matrix.png',format='png',dpi=600)
savefig('images/PRR7_background_matrix.svg',format='svg',dpi=600)
g = "GI"
figure(figsize=(10,7))
b_dist = array(background_matrix[clockgenes[g]])[array(background_matrix[clockgenes[g]]) > 0]
hist((log(b_dist)-mean(log(b_dist)))/std(log(b_dist)), bins=100, normed=True, label='Normed Ln(affinites)')
plot(linspace(-5,5,100),norm.pdf(linspace(-5,5,100),loc=0), lw=3, color='r', label='$N(0,1)$')
axvline((log(affinities_matrix[clockgenes[g]])-mean(log(b_dist)))/std(log(b_dist)), color='g', lw=3, label=g+' z-score')
xticks(fontsize=16)
yticks(fontsize=16)
xlabel('z-score', fontsize=22)
ylabel('Frequency', fontsize=22)
legend(loc='upper left', fontsize=16)
savefig('images/GI_background_matrix.pdf',format='pdf',dpi=300)
savefig('images/GI_background_matrix.png',format='png',dpi=600)
savefig('images/GI_background_matrix.svg',format='svg',dpi=600)
g = "PRR5"
figure(figsize=(10,7))
b_dist = array(background_matrix[clockgenes[g]])[array(background_matrix[clockgenes[g]]) > 0]
hist((log(b_dist)-mean(log(b_dist)))/std(log(b_dist)), bins=100, normed=True, label='Normed Ln(affinites)')
plot(linspace(-5,5,100),norm.pdf(linspace(-5,5,100),loc=0), lw=3, color='r', label='$N(0,1)$')
axvline((log(affinities_matrix[clockgenes[g]])-mean(log(b_dist)))/std(log(b_dist)), color='g', lw=3, label=g+' z-score')
xticks(fontsize=16)
yticks(fontsize=16)
xlabel('z-score', fontsize=22)
ylabel('Frequency', fontsize=22)
legend(loc='upper left', fontsize=16)
savefig('images/PRR5_background_matrix.pdf',format='pdf',dpi=300)
savefig('images/PRR5_background_matrix.png',format='png',dpi=600)
savefig('images/PRR5_background_matrix.svg',format='svg',dpi=600)
g = "TOC1"
figure(figsize=(10,7))
b_dist = array(background_matrix[clockgenes[g]])[array(background_matrix[clockgenes[g]]) > 0]
hist((log(b_dist)-mean(log(b_dist)))/std(log(b_dist)), bins=100, normed=True, label='Normed Ln(affinites)')
plot(linspace(-5,5,100),norm.pdf(linspace(-5,5,100),loc=0), lw=3, color='r', label='$N(0,1)$')
axvline((log(affinities_matrix[clockgenes[g]])-mean(log(b_dist)))/std(log(b_dist)), color='g', lw=3, label=g+' z-score')
xticks(fontsize=16)
yticks(fontsize=16)
xlabel('z-score', fontsize=22)
ylabel('Frequency', fontsize=22)
legend(loc='upper left', fontsize=16)
savefig('images/TOC1_background_matrix.pdf',format='pdf',dpi=300)
savefig('images/TOC1_background_matrix.png',format='png',dpi=600)
savefig('images/TOC1_background_matrix.svg',format='svg',dpi=600)
z_dist = {}
for b in background.keys():
abackground = array(background[b])
abackground = abackground[abackground>0]
z_dist[b]=(log(affinities[b])-mean(log(abackground)))/std(log(abackground))
z_dist_matrix = {}
for b in background.keys():
abackground = array(background_matrix[b])
abackground = abackground[abackground>0]
z_dist_matrix[b]=(log(affinities_matrix[b])-mean(log(abackground)))/std(log(abackground))
figure(figsize=(10,7))
hist(z_dist.values(),bins=50, normed=True, label='Full E-scores')
for c in clockgenes.keys():
try:
#axvline(z_dist[clockgenes[c]],color='blue', lw=2)
if z_dist[clockgenes[c]] < 1:
print 'Less ',c,z_dist[clockgenes[c]]
else:
print 'More ',c,z_dist[clockgenes[c]]
except:
print 'Not in list ',c
pass
xticks(fontsize=16)
yticks(fontsize=16)
xlabel('z-score', fontsize=22)
ylabel('Frequency', fontsize=22)
hist(z_dist_matrix.values(),bins=50, normed=True, color='orange', alpha=0.6, label = 'EMA selected')
for c in clockgenes.keys():
try:
#axvline(z_dist_matrix[clockgenes[c]],color='orange', lw=2)
if z_dist_matrix[clockgenes[c]] < 1:
print 'Less ',c,z_dist_matrix[clockgenes[c]]
else:
print 'More ',c,z_dist_matrix[clockgenes[c]]
except:
print 'Not in list ',c
pass
xticks(fontsize=16)
yticks(fontsize=16)
xlabel('z-score', fontsize=22)
ylabel('Frequency', fontsize=22)
legend(loc='upper left', fontsize=22)
savefig('images/z_scores_across_genome.pdf', format='pdf', dpi=300)
savefig('images/z_scores_across_genome.png', format='png', dpi=600)
savefig('images/z_scores_across_genome.svg', format='svg', dpi=600)
Not in list ZTL More LUX 1.3675763889618644 Not in list ELF3 More ELF4 2.169719290651254 Less GI 0.998965250737051 More PRR9 1.4288326116755836 Less CCA1 0.11522348684192192 More PRR5 2.208151979517305 More PRR7 1.6299056367106595 Not in list LHY More TOC1 1.5567804475849913 Not in list ZTL More LUX 2.0263284863458964 Not in list ELF3 More ELF4 2.7021271353025513 More GI 1.2700458345468633 More PRR9 2.1300995719695046 Less CCA1 0.7537500478166206 More PRR5 2.0604308816327457 More PRR7 2.2371650409077137 Not in list LHY More TOC1 2.14672848448777