<jupyter_start><jupyter_text>Gene Set Enrichment AnalysisWe use this notebook to show that the small sample lymphocyte proteomics data is in fact representative of lymphocytes specifically.<jupyter_code>import load_data
data = load_data.load_FragPipe(version='July_noMBR_FP', contains=[])<jupyter_output><empty_output><jupyter_text>Here we use a function from load_data to get the names, both the gene name code and verbose headers. We then add these to the quantification data.<jupyter_code>names = load_data.load_fasta()
names
data['Names'] = names.apply(lambda n: str(n).split('_HUMAN')[0])
data['Header'] = names.apply(lambda n: str(n).split('_HUMAN')[1])<jupyter_output><empty_output><jupyter_text>Now we can run Gene Set Enrichment Analysis (GSEA) on the proteins identified.<jupyter_code>import gseapy as gp
from gseapy.plot import barplot, dotplot
import matplotlib.pyplot as plt

genesets = [
    #'WikiPathways_2019_Human',  #
    #'BioPlanet_2019',   
    'ProteomicsDB_2020',    
    #'CCLE_Proteomics_2020', #says Hematopoetic and Lymphoid Tissues
    #'GO_Molecular_Function_2018',
]<jupyter_output><empty_output><jupyter_text>We use the ProteomicsDB_2020 genesets, which compare our samples to documented lineages. The following plots show that the lymphocytes we measured are highly similar to several lymphoblastoid cell lines. Bones share a similarity as well, due to XXX<jupyter_code>from numpy import nan
import data_utils

cell_types = ["cells"]#others could be specified, but here I want these generally.

    
for t in cell_types:
    for gset in genesets:
        #print(gene_list)
        enr = gp.enrichr(gene_list=list(data.Names.dropna()), 
                       description="Lymphocytes",
                       gene_sets=gset,
                       outdir='/data/test/enrichr'
                    )

        #as table:
        print(gset)
        display(enr.res2d[['Term','Adjusted P-value']][0:20])
        enr.res2d[['Term','Adjusted P-value']][0:20].to_csv( 'data/{0}.tsv'.format(gset), sep='\t')

        #as barplot
        #plt.rcParams['font.size'] = 25

        #plt.subplots_adjust(left=3, right=4,hspace=None)
        #barplot(enr.res2d, top_term=25, figsize=(12, 10))#, title=gset,)
        #plt.savefig('data/{0}_6_FP.png'.format(gset), bbox_inches='tight', dpi=400)
        #plt.show()
#supernatant_blanks=data['Blank_3','Blank_4','Blank_5']<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11584609019445594, 'fraction_numerical': 0.022341745966073644, 'mean_word_length': 4.14468085106383, 'pattern_counts': {'":': 0, '<': 17, '<?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': '114660', 'license': 'RSA-MD', 'n_tokens_mistral': 880, 'n_tokens_neox': 790, 'n_words': 191, 'path': 'GSEA.ipynb', 'repo_name': 'PayneLab/Lymphocytes2', 'size': '2417'}