This project contains a Python script used to calculate enrichment scores for genes based on five different datasets. The enrichment scores represent the significance of the genes across different biological conditions or contexts.
The following Python libraries are required:
pandas
gseapy
matplotlib
os
numpy
seaborn
scipy
sys
The datasets utilized in this project are significant enrichment files with FDR <= 0.05, including:
- Compendium
- Embryo Development
- Post-embryonic Development
- Cell Types
- Tissues
Each dataset needs to be pre-processed and stored in CSV format.
- Ensure all dependencies are installed.
- Place the datasets in appropriate paths.
- Run the Python script.
Import the necessary modules required for reading datasets, performing computations, and plotting.
import pandas as pd
import gseapy as gp
import matplotlib.pyplot as plt
import os
import numpy as np
import seaborn as sns
from scipy import stats as st
Establish the base directory containing the datasets.
Base_dir='/data/nandas/AllDatasets'
os.chdir(Base_dir)
Load the CSV datasets into Pandas DataFrames.
Compendium=pd.read_csv("Path to Compendium Dataset", index_col=0)
EmbDev=pd.read_csv("Path to Embryo Development Dataset", index_col=0)
...
Pre-process the DataFrames for calculating common gene-pathway pairs.
Compendium.reset_index(inplace=True)
Compendium.set_index(['WormBase','Term'],inplace=True)
...
Identify the common gene-pathway pairs across all datasets.
compemb=list(set(Compendium.index).intersection(set(EmbDev.index)))
...
Score['score']=float(-2)
...
Compute the enrichment scores for each gene-pathway pair.
for genepathway in Score.index:
count=0
if genepathway in Compendium.index:
count=count+1
...
Score.loc[genepathway,'score']=count
Save the calculated scores to a CSV file.
Score.to_csv("EnrichmentScoreAllDatasetsGeneID_052223.csv")
The result is a CSV file containing the enrichment scores for all gene-pathway pairs derived from the analysis of the datasets.
Ensure to adapt the file paths and names according to your local environment and dataset locations. A detailed description of each dataset, its format, and any prerequisite processing steps should be outlined. Any potential enhancements or improvements for the script can be addressed subsequently, and contributions for refining the script are welcomed.
For any issues, questions, or suggestions, please use the repository's issue tracker or submit a pull request.