Samplewise Distributions¶
Plotting Guide Setup
In [1]:
import os
import numpy as np
import holoviews as hv
hv.extension(
'bokeh',
'matplotlib'
)
import matplotlib.pyplot as plt
%matplotlib inline
import GSForge as gsf
Declare used paths
In [2]:
# OS-independent path management.
from os import fspath, environ
from pathlib import Path
In [3]:
OSF_PATH = Path(environ.get("GSFORGE_DEMO_DATA", default="~/GSForge_demo_data")).expanduser()
AGEM_PATH = OSF_PATH.joinpath("osfstorage", "rice.nc")
BOR_COLL_PATH = OSF_PATH.joinpath("osfstorage", "boruta_gene_sets")
assert AGEM_PATH.exists()
Load an AnnotatedGEM
In [4]:
agem = gsf.AnnotatedGEM(AGEM_PATH)
agem
Out[4]:
In [5]:
gsc = gsf.GeneSetCollection.from_folder(gem=agem, target_dir=BOR_COLL_PATH,
name="Boruta Results")
gsc
Out[5]:
Creating a Sample-wise Distribution plot¶
In [6]:
gsf.get_data(agem,annotation_variables="Treatment" )
Out[6]:
In [7]:
fig, ax = plt.subplots(figsize=(10, 7))
gsf.plots.SampleWiseDistribution(agem, ax=ax, annotation_variables="Treatment",
count_transform=lambda counts: np.log2(counts.where(counts > 0)))
Out[7]:
In [8]:
fig, ax = plt.subplots(figsize=(10, 7))
gsf.plots.SampleWiseDistribution(agem, ax=ax, annotation_variables="Genotype",
count_transform=lambda counts: np.log2(counts.where(counts > 0)))
Out[8]: