<jupyter_start><jupyter_text>do sig domains have more pathogenic vars?<jupyter_code>import pandas
%matplotlib inline
def eval_enrichment(f, var_type):
    df = pandas.read_csv(f, delimiter='\t')
    sig = df.apply(lambda row: row[var_type + '_qval'] < .1 and row[var_type + '_fg_gtr'], axis=1)
    not_sig = df.apply(lambda row: row[var_type + '_qval'] > .2, axis=1)
    sig_exac = df.apply(lambda row: row[var_type + '_qval'] < .1 and not row[var_type + '_fg_gtr'], axis=1)
    
    g_sig = df[sig].groupby('clin_class').size().reset_index().rename(columns={0:'size'})
    path = sum(g_sig[ (g_sig.clin_class=='LIKELY_PATHOGENIC') | (g_sig.clin_class=='PATHOGENIC') ]['size'])
    ben = sum(g_sig[ (g_sig.clin_class=='LIKELY_BENIGN') | (g_sig.clin_class=='BENIGN') ]['size'])
    print('fg', path, ben, path/(path+ben))
    
    g_sig_exac = df[sig_exac].groupby('clin_class').size().reset_index().rename(columns={0:'size'})
    path = sum(g_sig_exac[ (g_sig_exac.clin_class=='LIKELY_PATHOGENIC') | (g_sig_exac.clin_class=='PATHOGENIC') ]['size'])
    ben = sum(g_sig_exac[ (g_sig_exac.clin_class=='LIKELY_BENIGN') | (g_sig_exac.clin_class=='BENIGN') ]['size'])
    print('exac enriched', path, ben, path/(path+ben))
    
    g_ns = df[not_sig].groupby('clin_class').size().reset_index().rename(columns={0:'size'})
    path = sum(g_ns[ (g_ns.clin_class=='LIKELY_PATHOGENIC') | (g_ns.clin_class=='PATHOGENIC') ]['size'])
    ben = sum(g_ns[ (g_ns.clin_class=='LIKELY_BENIGN') | (g_ns.clin_class=='BENIGN') ]['size'])
    print('not enriched', path, ben, path/(path+ben))
f = '../data/interim/EPIv6.eff.dbnsfp.anno.hHack.splitPfam.mis.dat'
var_type = 'mis'
eval_enrichment(f, var_type)
print('//')

f = '../data/interim/EPIv6.eff.dbnsfp.anno.hHack.splitPfam.all.dat'
var_type = 'all'
eval_enrichment(f, var_type)
print('//')

f = '../data/interim/EPIv6.eff.dbnsfp.anno.hHack.splitPfam.lof.dat'
var_type = 'lof'
eval_enrichment(f, var_type)
sig = df.apply(lambda row: row['missense_qval'] < .01 and row['missense_fg_gtr'], axis=1)
not_sig = df.apply(lambda row: row['missense_qval'] > .2, axis=1)
sig_exac = df.apply(lambda row: row['missense_qval'] < .01 and not row['missense_fg_gtr'], axis=1)<jupyter_output><empty_output><jupyter_text>enriched domains<jupyter_code>g_sig = df[sig].groupby('clin_class').size().reset_index().rename(columns={0:'size'})
path = sum(g_sig[ (g_sig.clin_class=='LIKELY_PATHOGENIC') | (g_sig.clin_class=='PATHOGENIC') ]['size'])
ben = sum(g_sig[ (g_sig.clin_class=='LIKELY_BENIGN') | (g_sig.clin_class=='BENIGN') ]['size'])
print(path, ben, path/(path+ben))<jupyter_output>105 18 0.853658536585<jupyter_text>exac enriched domains<jupyter_code>g_sig_exac = df[sig_exac].groupby('clin_class').size().reset_index().rename(columns={0:'size'})
path = sum(g_sig_exac[ (g_sig_exac.clin_class=='LIKELY_PATHOGENIC') | (g_sig_exac.clin_class=='PATHOGENIC') ]['size'])
ben = sum(g_sig_exac[ (g_sig_exac.clin_class=='LIKELY_BENIGN') | (g_sig_exac.clin_class=='BENIGN') ]['size'])
print(path, ben, path/(path+ben))<jupyter_output>12651 26780 0.320838933834<jupyter_text>non enriched domains<jupyter_code>g_ns = df[not_sig].groupby('clin_class').size().reset_index().rename(columns={0:'size'})
path = sum(g_ns[ (g_ns.clin_class=='LIKELY_PATHOGENIC') | (g_ns.clin_class=='PATHOGENIC') ]['size'])
ben = sum(g_ns[ (g_ns.clin_class=='LIKELY_BENIGN') | (g_ns.clin_class=='BENIGN') ]['size'])
print(path, ben, path/(path+ben))<jupyter_output>6553 13719 0.323253749013
{'fraction_non_alphanumeric': 0.2023021582733813, 'fraction_numerical': 0.02474820143884892, 'mean_word_length': 6.972477064220183, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '521867', 'license': 'MIT', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1476, 'n_words': 190, 'path': 'notebooks/pathogenic-domains-new.ipynb', 'repo_name': 'samesense/mahdi_epi', 'size': '3475'}