TITLE: GSEA
AUTHORS: Karina Jhingan

[DESCRIPTION]
This is a GSEA and GSVA analysis on time series data that creates barplots showing how the enrichment score varies over the series of time

[STEPS]
SECTION: Load Libraries
2. uncomment installs if needed
 

SECTION: Introduction
1. This pipeline is based off of http://yulab-smu.top/biomedical-knowledge-mining-book/universal-api.html
SECTION: Load &amp; Tidy Data
3. reading in log fold change data (this was a excel sheet saved as a csv where column 1 is gene names and column 2 is the log fold change of the naive sample compared to the 24 hour time point sample (+0.1 to avoid dividing by 0)

 

SECTION: Gene set (Term to Gene)
9. in the category option you can change to either: H, C1,C2, C3...C7
 

SECTION: Gene set (Term to Gene)
10. This code is if you want to combine gene sets and run analysis on multiple at once
 


SECTION: GSEA
12. GSEA
 

SECTION: GSEA
14. Save dataframe
 

SECTION: GSEA
13. Filtering Results, adjust p.adjust as necessary
 

SECTION: Visualizations (Optional)
15. Dot Plot
All example visual images are from the 24 hour data.
Documentation: https://www.rdocumentation.org/packages/enrichplot/versions/1.13.1.994/topics/dotplot
adjust showCategory depending on how many categories you want to appear in your dotplot
 


 


SECTION: Load &amp; Tidy Data
4. Assign the log fold change data to a vector as GSEA needs the data as a vector where each value is named by gene.

 

SECTION: Load &amp; Tidy Data
5. Name the vector

 
Data should now be in this format:

IL2RA     IL24     GZMB     IFNG      LIF     NRN1

9.294876 8.206818 8.176261 8.109863 7.973691 7.867302
SECTION: Load &amp; Tidy Data
6. Omit any NA values

 

SECTION: Load &amp; Tidy Data
7. If data is not already sorted: sort the list in decreasing order (required for clusterProfiler)

 

SECTION: Load &amp; Tidy Data
8. Choose Organism

 

SECTION: Visualizations (Optional)
16. Enrichment Map
use pariwise_termsim to quiet errors

 

 

SECTION: Visualizations (Optional)
17. Category Netplot
categorySize can be either 'pvalue' or 'geneNum'

 

 

SECTION: Visualizations (Optional)
18. Ridge Plot

 

 

SECTION: Visualizations (Optional)
19. GSEA Plot
get geneSetID number from Excel sheet of output of gse (-1 for header) (i.e Hallmark, C7,etc) to input for
index for  description and geneSetID
 

 

 

 

 If you want to plot multiple gsea plots at a time adjust the number in geneSetID.

 

 

SECTION: GSVA
20. Complete the above steps for all timepoints compared to the control, in our experiment we had naive 0 (naive), 24, 48, and 72 hour as timepoints, and used naive as the control time point so I ran the above section 3 times (naive vs 24, naive vs 48, naive vs 72). 


 


SECTION: Gene set (Term to Gene)
11. Custom Gene Sets (Optional):
To run custom gene sets, create a csv where the first column is the gene name and the second column is the gene symbol

Load the Gene set:
 

And combine with the rest of the gene sets:
 

Double check the gene sets were combined properly
 

SECTION: GSVA
21. Top 10 genes (up and down regulated)
Sort by ascending order
 

Get top 10 down-regulated

 

SECTION: GSVA
22. Sort by descending order
 

Get top 10 up-regulated genes

 

SECTION: GSVA
23. Combine to get top 10 up and down regulated gene in 1 file

 

 

SECTION: GSVA
24. Bar plot
Do this for each of the following 20 genes in the top 10 list: (I changed fill color to red brick for the downregulated genes)

Here we are finding the data row for each of the given 20 genes and creating an individual bar plot for each gene