Compartments are detected on the full genome matrix
In [46]:
from pytadbit.parsers.hic_parser import load_hic_data_from_reads
from cPickle import load
In [19]:
%matplotlib inline
In [3]:
reso = 300000
base_path = 'results/both/03_filtering/valid_reads12.tsv'
bias_path = 'results/both/04_normalizing/biases_{0}.pick'
bads_path = 'results/both/04_normalizing/bad_columns_{0}.pick'
In [6]:
def my_load_hic_data(reso):
hic_data = load_hic_data_from_reads(base_path, resolution=reso)
hic_data.bias = load(open(bias_path.format(reso)))
hic_data.bads = load(open(bads_path.format(reso)))
return hic_data
In [8]:
hic_data = my_load_hic_data(reso)
In [9]:
! mkdir -p results/fragment/both/05_segmenting
In [31]:
crm = 'chr18'
corr = hic_data.find_compartments(
show=True, crms=[crm], vmin=-0.2, vmax=0.2, label_compartments='none',
savedata='results/fragment/both/05_segmenting/compartments_{0}_{1}.tsv'.format(crm, reso))
In [32]:
! head -n 20 results/fragment/both/05_segmenting/compartments_chr2_300000.tsv
In [35]:
from pytadbit import Chromosome
In [37]:
crm = Chromosome('18')
crm.add_experiment('HindIII',
hic_data='results/HindIII/04_normalizing/100000_raw/chr18.mat',
norm_data='results/HindIII/04_normalizing/100000_norm/chr18.mat',
resolution=100000)
crm.add_experiment('MboI',
hic_data='results/MboI/04_normalizing/100000_raw/chr18.mat',
norm_data='results/MboI/04_normalizing/100000_norm/chr18.mat',
resolution=100000)
In [38]:
crm.visualize([('HindIII', 'MboI')])
In [39]:
crm.visualize([('HindIII', 'MboI')], normalized=True)
In [41]:
crm.find_tad(['HindIII', 'MboI'], n_cpus=8)
In [42]:
crm.visualize([('HindIII', 'MboI')], normalized=True, paint_tads=True, )
In [43]:
crm.visualize([('HindIII', 'MboI')], normalized=True, paint_tads=True, focus=(670, 770))
In [44]:
crm.experiments
Out[44]:
In [47]:
ali = crm.align_experiments()
In [48]:
ali.draw()
In [45]:
crm.save_chromosome('results/crm18.tdb')