Grouped Gene CovarianceΒΆ

Here we group samples by an annotation category, then plot the gene means against one another.

Plotting Guide Setup

A 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")
NORMED_GEM_PATH = OSF_PATH.joinpath("AnnotatedGEMs", "oryza_sativa_hisat2_normed.nc")
TOUR_BORUTA = OSF_PATH.joinpath("GeneSetCollections", "tour_boruta")
agem = gsf.AnnotatedGEM(NORMED_GEM_PATH)
agem
<GSForge.AnnotatedGEM>
Name: Oryza Sativa
Selected GEM Variable: 'counts'
    Gene   66338
    Sample 475
gsc = gsf.GeneSetCollection.from_folder(
    gem=agem, target_dir=TOUR_BORUTA, name="Boruta Results")
gsc
<GSForge.GeneSetCollection>
Boruta Results
GeneSets (2 total): Support Count
    Boruta_treatment: 771
    Boruta_genotype: 663

View Annotation Group CovarianceΒΆ

gsf.plots.gem.GroupedGeneCovariance(
    agem, group_variable="treatment", 
    x_group_label="CONTROL", y_group_label="HEAT",
    count_transform=lambda counts: np.log10(counts + 0.25))