<jupyter_start><jupyter_text>explore coding variant overlap between scz meta study and our paper<jupyter_code>import glob,os
import pandas as pd
import mygene
import seaborn as sns
import matplotlib.pyplot as plt
mg = mygene.MyGeneInfo()
# # polygenic genesets
# gene_files = glob.glob('D_mpraanalyze_barcode_allelic/egene_gtex_psychencode/*txt')
# gene_files
scz_genes = pd.read_table('D_mpraanalyze_barcode_allelic/egene_gtex_psychencode/SCZ.txt', header=None).iloc[:,0].values
len(scz_genes)<jupyter_output><empty_output><jupyter_text>singh data<jupyter_code>%%time
singh_df = pd.read_csv('coding_variants/meta_results_2021_04_22_12_33_17_sing.csv')#.fillna(0)
symbols = [x.get('symbol','') for x in mg.getgenes(singh_df.Gene, fields='name,symbol,entrezgene,taxid')]
singh_df['symbol'] = symbols
print(singh_df.shape)

singh_df[:5]
singh_df_filt = singh_df[singh_df['Q meta']<0.05]

print(singh_df_filt.shape)

# singh_df_filt[:5]
singh_df_filt.symbol.values
singh_df.to_csv('coding_variants/singh_wsym.csv')
singh_df_filt.to_csv('coding_variants/singh_wsym_fdr05.csv')
print(len(scz_genes))
print(len(set(singh_df.symbol).intersection(scz_genes)))
singh_df_scz = singh_df[singh_df.symbol.isin(scz_genes)]
sns.lineplot(data=singh_df.reset_index(), x='index', y='Q meta',color='black')

sns.scatterplot(data=singh_df_scz.reset_index(), x='index', y='Q meta')
def label_point(x, y, val, ax):
    a = pd.concat({'x': x, 'y': y, 'val': val}, axis=1)
    for i, point in a.iterrows():
        ax.text(point['x']+.02, point['y'], str(point['val']))

singh_df_scz_filt = singh_df_scz.reset_index()
singh_df_scz_filt = singh_df_scz_filt[singh_df_scz_filt['Q meta']<.55]
label_point(singh_df_scz_filt['index'],
            singh_df_scz_filt['Q meta'], 
            singh_df_scz_filt['symbol'], plt.gca())  
plt.show()
singh_df_scz.reset_index().(x='index',y='Q meta')<jupyter_output><empty_output><jupyter_text>from ripke 2020<jupyter_code>ripke_2020 = pd.read_excel('/Users/mguo123/Google Drive/1_khavari/papers/tables/Supplementary Table 20 - Prioritised Genes.xlsx',sheet_name='ST20 all criteria')
ripke_2020[:5]
ripke_2020.sum(axis=0)
ripke_2020 = ripke_2020[ripke_2020.Prioritised>0]
ripke_2020.shape
set(ripke_2020['Symbol.ID']).intersection(scz_genes)<jupyter_output><empty_output><jupyter_text>laramie<jupyter_code>known_genes_df = pd.read_excel('coding_variants/Schizophrenia_gene_list_2_24_20_FINAL.xlsx',sheet_name='schizophrenia_list_2_24_20')
known_genes_df
set(known_genes_df.Gene_symbol).intersection(set(scz_genes))
print('DAGLA' in scz_genes)
coding_variant_genes = ['AKT1','C4A','CACNA1G','DAGLA','MAGI2','MTHFR','STAG1','SV2A','XPO7','ZNF823','R3HDM2','PTPRF','KDM4A','TCF20']
print(len(coding_variant_genes))
for x in sorted(coding_variant_genes):
    print(x, x in scz_genes)<jupyter_output>14
AKT1 True
C4A True
CACNA1G False
DAGLA False
KDM4A False
MAGI2 False
MTHFR True
PTPRF False
R3HDM2 False
STAG1 False
SV2A True
TCF20 False
XPO7 False
ZNF823 True
{'fraction_non_alphanumeric': 0.14276094276094276, 'fraction_numerical': 0.03939393939393939, 'mean_word_length': 8.709150326797385, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 17, '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': '308630', 'license': 'MIT', 'n_tokens_mistral': 1368, 'n_tokens_neox': 1264, 'n_words': 166, 'path': '16_coding_variants.ipynb', 'repo_name': 'mguo123/psych_mpra', 'size': '2970'}