In [2]:
from matlas.matches import DenovoModisco, DenovoHomer
from vdom.helpers import (b, summary)
from IPython.display import display
import numpy as np

def adjust_motifs(ob):
    for motif_name in ob.denovo_pwms.keys():
        a = ob.get_pwm(motif_name)
        ones = np.sum(a, axis=1)
        for i, one in enumerate(ones):
            if (one-1.0)!=1:
            #print('decrease', motif_name, i)
                part = (one-1.0)/4
                ob.denovo_pwms[motif_name]['PPM'][i] -= part
    
    return ob

def display_paiwise_pattern_comparison(task_idx, sample_name, modiscodir, homerdir):
    display(summary(b(sample_name + " (differential regions)")))
    
    homer_ob = DenovoHomer(homerdir)
    #homer_ob.fetch_tomtom_matches(save_report=True, 
    #                              tomtom_dir= "{0}/{1}_tomtomout".format(homerdir, "CISBP_2.00"))
    
    homer_ob.load_matched_motifs()
    homer_ob.get_motif_per_celltype()

    modisco_ob = DenovoModisco(modiscodir)
    modisco_ob.load_matched_motifs()
    modisco_ob.get_motif_per_celltype()

    modisco_ob.display_pairwise_tf_table(homer_ob)
    return None

def display_denovo_patterns(sample_name, modiscodir, match_threshold=0.05):
    display(summary(b(sample_name)))
    
    ob = DenovoModisco(modiscodir)
    
    ob.load_matched_motifs()
    ob.get_motif_per_celltype(match_threshold=match_threshold)
    ob.display_individual_table()
    
    return None
In [5]:
root = "/mnt/lab_data/kundaje/users/msharmin/NSC_ATAC_PEAKS_to_share"
task_idx = 4
sample_name = 'qNSC_Old'

display_denovo_patterns(
    sample_name,
    modiscodir="{0}/gw_modisco/multi_tasks/{1}".format(root, sample_name)
)
qNSC_Old
The following two links show list of Denovo Patterns and corresponding Motifs discovered by TF-MoDISco
Click here for Denovo Patterns by TF-MoDISco: #1
Pattern NameTF Name(s)Modisco
metacluster_1/pattern_0 # seqlets: 36 SequenceContrib ScoresHyp_Contrib Scores
Ctcf, Ctcfl
Click here for Motifs by TF-MoDISco: #2
TF NamePattern(s)
Ctcf
Pattern NameModiscoSignificance
metacluster_1/pattern_09.043959999999999e-09
Ctcfl
Pattern NameModiscoSignificance
metacluster_1/pattern_09.043959999999999e-09
In [3]:
root = "/mnt/lab_data/kundaje/users/msharmin/NSC_ATAC_PEAKS_to_share"
task_idx = 4
sample_name = 'qNSC_Old'
display_paiwise_pattern_comparison(
    task_idx, sample_name, 
    modiscodir="{0}/gw_modisco/multi_tasks/{1}".format(root, sample_name),
    homerdir="{0}/size_gvn_nobkg/{1}".format(root, sample_name),
)
qNSC_Old (differential regions)
Number of CISBP TFs obtained by TF-MoDISco and Homer
Shared TFs between TF-MoDISco and Homer: #2
TF NameModiscoHomer
Ctcf
Pattern NameModiscoSignificance
metacluster_1/pattern_09.043959999999999e-09
Pattern NameHomerSignificance
motif1.motif0.025303400000000004
Ctcfl
Pattern NameModiscoSignificance
metacluster_1/pattern_09.043959999999999e-09
Pattern NameHomerSignificance
motif1.motif0.045573800000000005
Unique TF-MoDISco TFs: #0
TF NameModiscoHomer
Unique Homer TFs: #106
TF NameModiscoHomer
Tlx2Absent
Pattern NameHomerSignificance
motif4.motif0.0100318
Prrx1Absent
Pattern NameHomerSignificance
motif4.motif0.00454769
Hoxb4Absent
Pattern NameHomerSignificance
motif4.motif0.0484913
Prop1Absent
Pattern NameHomerSignificance
motif4.motif0.022286
Hoxc5Absent
Pattern NameHomerSignificance
motif4.motif0.00603834
Lhx6Absent
Pattern NameHomerSignificance
motif4.motif0.016796900000000003
Dlx2Absent
Pattern NameHomerSignificance
motif4.motif0.0418989
Phox2bAbsent
Pattern NameHomerSignificance
motif4.motif0.00454769
OtpAbsent
Pattern NameHomerSignificance
motif4.motif0.00338672
Meox2Absent
Pattern NameHomerSignificance
motif4.motif0.0145089
Hoxb7Absent
Pattern NameHomerSignificance
motif4.motif0.047503199999999995
Lhx5Absent
Pattern NameHomerSignificance
motif4.motif0.00841756
Hoxa5Absent
Pattern NameHomerSignificance
motif4.motif0.00568055
Msx1Absent
Pattern NameHomerSignificance
motif4.motif0.00568055
Hoxa6Absent
Pattern NameHomerSignificance
motif4.motif0.0300868
Phox2aAbsent
Pattern NameHomerSignificance
motif4.motif0.00568055
Hnf1bAbsent
Pattern NameHomerSignificance
motif4.motif0.036481599999999996
Lhx1Absent
Pattern NameHomerSignificance
motif4.motif0.011743700000000001
UncxAbsent
Pattern NameHomerSignificance
motif4.motif0.00217553
RaxAbsent
Pattern NameHomerSignificance
motif4.motif0.00169998
Hoxb3Absent
Pattern NameHomerSignificance
motif4.motif0.00454769
Pou6f1Absent
Pattern NameHomerSignificance
motif4.motif0.0261881
Twist1Absent
Pattern NameHomerSignificance
motif4.motif0.0484913
Pax7Absent
Pattern NameHomerSignificance
motif4.motif0.0339106
Gsx2Absent
Pattern NameHomerSignificance
motif4.motif0.00185558
Hoxd1Absent
Pattern NameHomerSignificance
motif4.motif0.00603834
En1Absent
Pattern NameHomerSignificance
motif4.motif0.00338672
Barx1Absent
Pattern NameHomerSignificance
motif4.motif0.0297692
Hoxa7Absent
Pattern NameHomerSignificance
motif4.motif0.0318238
Pou1f1Absent
Pattern NameHomerSignificance
motif4.motif0.015784100000000002
Lhx4Absent
Pattern NameHomerSignificance
motif4.motif0.00255907
NoboxAbsent
Pattern NameHomerSignificance
motif4.motif0.010700200000000002
Hnf1aAbsent
Pattern NameHomerSignificance
motif4.motif0.043028500000000004
SeboxAbsent
Pattern NameHomerSignificance
motif4.motif0.00169998
Dlx1Absent
Pattern NameHomerSignificance
motif4.motif0.0339106
Pax6Absent
Pattern NameHomerSignificance
motif4.motif0.00115417
Arid3bAbsent
Pattern NameHomerSignificance
motif4.motif0.020972099999999997
Dlx3Absent
Pattern NameHomerSignificance
motif4.motif0.040943099999999996
IsxAbsent
Pattern NameHomerSignificance
motif4.motif0.010700200000000002
Lbx2Absent
Pattern NameHomerSignificance
motif4.motif0.00169998
Vsx1Absent
Pattern NameHomerSignificance
motif4.motif0.00338672
HlxAbsent
Pattern NameHomerSignificance
motif4.motif0.011743700000000001
Pou3f2Absent
Pattern NameHomerSignificance
motif4.motif0.00524457
NotoAbsent
Pattern NameHomerSignificance
motif4.motif0.00185558
Vax2Absent
Pattern NameHomerSignificance
motif4.motif0.00173469
Isl1Absent
Pattern NameHomerSignificance
motif4.motif0.0454716
Vax1Absent
Pattern NameHomerSignificance
motif4.motif0.00217553
En2Absent
Pattern NameHomerSignificance
motif4.motif0.00568055
Pax4Absent
Pattern NameHomerSignificance
motif4.motif0.00285575
Gbx1Absent
Pattern NameHomerSignificance
motif4.motif0.00568055
Dlx4Absent
Pattern NameHomerSignificance
motif4.motif0.0213048
Lhx2Absent
Pattern NameHomerSignificance
motif4.motif0.00255907
Msx2Absent
Pattern NameHomerSignificance
motif4.motif0.0112821
Isl2Absent
Pattern NameHomerSignificance
motif4.motif0.0316942
Vsx2Absent
Pattern NameHomerSignificance
motif4.motif0.00115417
Hoxa3Absent
Pattern NameHomerSignificance
motif4.motif0.00466978
Hoxc10Absent
Pattern NameHomerSignificance
motif4.motif0.026696800000000003
Hoxc6Absent
Pattern NameHomerSignificance
motif4.motif0.00726693
Lhx8Absent
Pattern NameHomerSignificance
motif4.motif0.00368349
Gbx2Absent
Pattern NameHomerSignificance
motif4.motif0.00534556
Alx3Absent
Pattern NameHomerSignificance
motif4.motif0.00225673
Prrx2Absent
Pattern NameHomerSignificance
motif4.motif0.00603834
Lhx9Absent
Pattern NameHomerSignificance
motif4.motif0.00115417
Evx1Absent
Pattern NameHomerSignificance
motif4.motif0.00225673
Pou3f4Absent
Pattern NameHomerSignificance
motif4.motif0.0141815
Barhl2Absent
Pattern NameHomerSignificance
motif4.motif0.010700200000000002
Nkx1-1Absent
Pattern NameHomerSignificance
motif4.motif0.00338672
Pou2f3Absent
Pattern NameHomerSignificance
motif4.motif0.00454769
Pou4f3Absent
Pattern NameHomerSignificance
motif4.motif0.013784600000000001
Pdx1Absent
Pattern NameHomerSignificance
motif4.motif0.016796900000000003
Alx4Absent
Pattern NameHomerSignificance
motif4.motif0.023838400000000003
Evx2Absent
Pattern NameHomerSignificance
motif4.motif0.011743700000000001
Lmx1bAbsent
Pattern NameHomerSignificance
motif4.motif0.00502004
Pou2f2Absent
Pattern NameHomerSignificance
motif4.motif0.00568055
Msx3Absent
Pattern NameHomerSignificance
motif4.motif0.010700200000000002
Alx1Absent
Pattern NameHomerSignificance
motif4.motif0.012365600000000001
Duxbl1Absent
Pattern NameHomerSignificance
motif4.motif0.0318238
Prdm1Absent
Pattern NameHomerSignificance
motif21.motif0.0112851
Dbx1Absent
Pattern NameHomerSignificance
motif4.motif0.0112821
Rhox6Absent
Pattern NameHomerSignificance
motif4.motif0.00115417
ArxAbsent
Pattern NameHomerSignificance
motif4.motif0.0112161
Hoxa4Absent
Pattern NameHomerSignificance
motif4.motif0.0318238
Nkx6-1Absent
Pattern NameHomerSignificance
motif4.motif0.0112821
Hoxd3Absent
Pattern NameHomerSignificance
motif4.motif0.00454769
Hoxc9Absent
Pattern NameHomerSignificance
motif4.motif0.0261881
Hoxb6Absent
Pattern NameHomerSignificance
motif4.motif0.044449300000000004
Barx2Absent
Pattern NameHomerSignificance
motif4.motif0.043028500000000004
BsxAbsent
Pattern NameHomerSignificance
motif4.motif0.013832299999999999
Pou2f1Absent
Pattern NameHomerSignificance
motif4.motif0.016796900000000003
Esx1Absent
Pattern NameHomerSignificance
motif4.motif0.00338672
Mnx1Absent
Pattern NameHomerSignificance
motif4.motif0.00466978
Dlx5Absent
Pattern NameHomerSignificance
motif4.motif0.0142631
Dbx2Absent
Pattern NameHomerSignificance
motif4.motif0.0174228
Hoxa1Absent
Pattern NameHomerSignificance
motif4.motif0.00173124
Nkx1-2Absent
Pattern NameHomerSignificance
motif4.motif0.00255907
Nkx6-3Absent
Pattern NameHomerSignificance
motif4.motif0.00770688
Hoxb5Absent
Pattern NameHomerSignificance
motif4.motif0.00770688
Lhx3Absent
Pattern NameHomerSignificance
motif4.motif0.031565300000000004
Emx2Absent
Pattern NameHomerSignificance
motif4.motif0.00115417
Hoxa2Absent
Pattern NameHomerSignificance
motif4.motif0.00338672
Shox2Absent
Pattern NameHomerSignificance
motif4.motif0.00173124
Pou3f1Absent
Pattern NameHomerSignificance
motif4.motif0.015784100000000002
Barhl1Absent
Pattern NameHomerSignificance
motif4.motif0.012731000000000001
Lmx1aAbsent
Pattern NameHomerSignificance
motif4.motif0.00454769
Meox1Absent
Pattern NameHomerSignificance
motif4.motif0.00711118
Hmbox1Absent
Pattern NameHomerSignificance
motif4.motif0.0339106
In [ ]: