Volcano Plot of Differential Gene Expression Results

A common way to visualize the results of a DGE analysis.

Plotting Guide Setup

Shared setup for all plotting guides.

# OS-independent path management.
from os import environ
from pathlib import Path
import numpy as np
import GSForge as gsf
import holoviews as hv
hv.extension('bokeh')

OSF_PATH = Path(environ.get("GSFORGE_DEMO_DATA", default="~/GSForge_demo_data/")).expanduser().joinpath("osfstorage", "oryza_sativa")
GEM_PATH = OSF_PATH.joinpath("AnnotatedGEMs", "oryza_sativa_hisat2_raw.nc")
TOUR_DGE = OSF_PATH.joinpath("GeneSetCollections", "DEG_gene_sets")
agem = gsf.AnnotatedGEM(GEM_PATH)
agem
<GSForge.AnnotatedGEM>
Name: Oryza Sativa
Selected GEM Variable: 'counts'
    Gene   66338
    Sample 475
deg_gsc = gsf.GeneSetCollection.from_folder(
    gem=agem, target_dir=TOUR_DGE, name="DGE Results")
deg_gsc
<GSForge.GeneSetCollection>
DGE Results
GeneSets (9 total): Support Count
    edgeR_filter: 31864
    '0_+_treatment:genotype'__treatment[DROUGHT]: 8710
    '0_+_treatment:genotype'__treatment[RECOV_HEAT]: 7918
    '0_+_treatment:genotype'__treatment[RECOV_DROUGHT]: 6531
    '0_+_treatment:genotype'__treatment[HEAT]: 3068
    ... and 4 more.

Select a particular result set of interest

deg_gs = deg_gsc.gene_sets["'0 + treatment:genotype'__treatment[HEAT]"]
deg_gs
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_5816/2103114488.py in <module>
----> 1 deg_gs = deg_gsc.gene_sets["'0 + treatment:genotype'__treatment[HEAT]"]
      2 deg_gs

~/virtualenv/python3.7.1/lib/python3.7/site-packages/GSForge/models/_GeneSetCollection.py in __getitem__(self, item)
     53 
     54     def __getitem__(self, item):
---> 55         return self.data[item]
     56 
     57     def __setitem__(self, key, gene_set):

KeyError: "'0 + treatment:genotype'__treatment[HEAT]"

View the data stored within this GeneSet result

deg_gs.data

Create a Volcano Plot

gsf.plots.results.Volcano(deg_gs)