In [5]:
from pytadbit.mapping.analyze import correlate_matrices
from pytadbit.mapping.analyze import eig_correlate_matrices
from pytadbit import load_hic_data_from_reads
from cPickle import load

In [3]:
reso = 1000000

In [11]:
hic_data1 = load_hic_data_from_reads(
'results/HindIII/03_filtering/valid_reads12_HindIII.tsv',
resolution= reso)

In [12]:
hic_data1.bias = load(open(
    'results/HindIII/04_normalizing/biases_1000000_HindIII.pick'))

In [13]:
hic_data1.bads = load(open(
    'results/HindIII/04_normalizing/bad_columns_1000000_HindIII.pick'))

In [14]:
hic_data2 = load_hic_data_from_reads(
'results/MboI/03_filtering/valid_reads12_MboI.tsv',
resolution= reso)

In [15]:
hic_data2.bias = load(open(
    'results/MboI/04_normalizing/biases_1000000_MboI.pick'))

In [16]:
hic_data2.bads = load(open(
    'results/MboI/04_normalizing/bad_columns_1000000_MboI.pick'))

In [21]:
%matplotlib inline

In [22]:
correlate_matrices(hic_data1,hic_data2,max_dist=100,resolution= reso, show=True, normalized=True)


Out[22]:
([0.74569401385371981,
  0.84090915711344227,
  0.79464652060677199,
  0.71383422394495566,
  0.65616165558955986,
  0.60898868711253118,
  0.58164517847634756,
  0.56403420383568115,
  0.53006468158654696,
  0.46170984267229226,
  0.49718966624172006,
  0.48420690565841779,
  0.46382499063599342,
  0.45266593737942851,
  0.46276312918844048,
  0.49817640083480819,
  0.4727820605161886,
  0.47454402250653877,
  0.459816323070873,
  0.47583033113923523,
  0.46258307096989887,
  0.50924852763420914,
  0.46715127282005792,
  0.48135810010466523,
  0.48223980084590296,
  0.47551364787005068,
  0.47939071635513975,
  0.45939228706623791,
  0.47675931748330702,
  0.45647535528179284,
  0.47838943347581114,
  0.46474108274156467,
  0.4811772186847551,
  0.47177777949554917,
  0.47864677691006019,
  0.42981553694726793,
  0.47977587797663274,
  0.43072351932459596,
  0.42786552780914106,
  0.41636394466405474,
  0.42808740170880627,
  0.3918314056911712,
  0.44333533415470228,
  0.43238111559564352,
  0.37964361005056912,
  0.39630538083421951,
  0.39817859126157606,
  0.38914572137210024,
  0.39605753459291665,
  0.37898352582441425,
  0.34292921826092165,
  0.35698231891345983,
  0.3636872697591309,
  0.35440331306160744,
  0.37335452321077522,
  0.31512118958082314,
  0.33765936240169547,
  0.34041660266885676,
  0.36625885162059579,
  0.3646903581878389,
  0.32888626887966466,
  0.30807135061733865,
  0.32612229977563711,
  0.32005807555290205,
  0.32761438306252116,
  0.31114533795065724,
  0.33423908924822576,
  0.28976522354951545,
  0.25690506223277843,
  0.26965107457759518,
  0.24872417896018006,
  0.29107890005747949,
  0.26995010782434248,
  0.28369239634833959,
  0.27821575317902619,
  0.24921821672464095,
  0.25693359362138929,
  0.22868367056063776,
  0.21259378253995539,
  0.2044199503240004,
  0.2142126320171226,
  0.2155910555846017,
  0.1922947258091289,
  0.20911327572457819,
  0.21831359685212937,
  0.20281046865331515,
  0.20800034946310694,
  0.18772427469836359,
  0.18686868605257459,
  0.1585098258368012,
  0.15167328573960676,
  0.22588120240045062,
  0.15661883513940256,
  0.18883785781630605,
  0.21410382222972107,
  0.19986969244463884,
  0.15099579451381157,
  0.18302707716339947,
  0.17357236093972539,
  0.18648729612641157],
 [1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  15,
  16,
  17,
  18,
  19,
  20,
  21,
  22,
  23,
  24,
  25,
  26,
  27,
  28,
  29,
  30,
  31,
  32,
  33,
  34,
  35,
  36,
  37,
  38,
  39,
  40,
  41,
  42,
  43,
  44,
  45,
  46,
  47,
  48,
  49,
  50,
  51,
  52,
  53,
  54,
  55,
  56,
  57,
  58,
  59,
  60,
  61,
  62,
  63,
  64,
  65,
  66,
  67,
  68,
  69,
  70,
  71,
  72,
  73,
  74,
  75,
  76,
  77,
  78,
  79,
  80,
  81,
  82,
  83,
  84,
  85,
  86,
  87,
  88,
  89,
  90,
  91,
  92,
  93,
  94,
  95,
  96,
  97,
  98,
  99,
  100])

In [23]:
eig_correlate_matrices(hic_data1,hic_data2,show=True)


Out[23]:
[[0.81667807046133234,
  0.49748877653400586,
  0.0048590767932388838,
  0.065289352746532858,
  0.048604242246137581,
  0.010026527830634548],
 [0.18947382172361266,
  0.35527611514992918,
  0.0053530604854015416,
  0.70565525196431955,
  0.15666616915450235,
  0.16225864271534263],
 [0.34782737361856086,
  0.30796135314852541,
  0.024290630470542078,
  0.099285258657763498,
  0.1646061174884873,
  0.090860378818298712],
 [0.069753866176019863,
  0.13276878877888995,
  0.93998012888817428,
  0.12112921861558698,
  0.039562861317189481,
  0.096089169049164244],
 [0.28298395087704087,
  0.61470700809859735,
  0.25088089992223001,
  0.43314287927587491,
  0.15847573856346558,
  0.21407720381312431],
 [0.17535864716400626,
  0.25753032804790738,
  0.046218167719057165,
  0.078531824146848839,
  0.096162745208613662,
  0.45992779071935358]]
from pytadbit.mapping import merge_2d_beds

In [25]:
! mkdir -p results/both/03_filtering

In [26]:
merge_2d_beds(
'results/HindIII/03_filtering/valid_reads12_HindIII.tsv',
'results/MboI/03_filtering/valid_reads12_MboI.tsv',
'results/both/03_filtering/valid_reads12.tsv')


Out[26]:
9751233

In [ ]: