library(conflicted)
conflict_prefer("Position", "base")
library(dplyr)
conflict_prefer("filter", "dplyr")
conflict_prefer("select", "dplyr")
library(ggplot2)
library(ggpubr)
library(ggbeeswarm)
library(readr)
library(tidyr)
library(reticulate)
library(clusterProfiler)
library(foreach)
library(doMC)
library(org.Hs.eg.db)
library(cowplot)
library(stringr)
library(kableExtra)
library(EnhancedVolcano)
knitr::knit_engines$set(python = reticulate::eng_python)
reticulate::py_available(TRUE)
## [1] TRUE
# bug in rstudio/reticulate:
matplotlib <- import("matplotlib")
matplotlib$use("Agg", force = TRUE)
registerDoMC(cores=16)
## /home/sturm/scratch/projects/2020/kortekaas2020_paper/work/conda/vanderburg_oropharyngeal_cancer-ca9006a72cd4c32ca83708ebea1b2975/lib/python3.7/site-packages/dask/config.py:161: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
## data = yaml.load(f.read()) or {}
import matplotlib.pyplot as plt
import matplotlib
import sys
import seaborn as sns
sys.path.extend(("lib", "../lib"))
from jupytertools import *
fix_logging(sc.settings)
matplotlib.rcParams.update({"figure.autolayout": True, "figure.max_open_warning": 0})
adata = sc.read_h5ad(r.params['input_file'])
How to read the plot: cd4_cd8
shows genes that are differentially expressed between cells in the CD4 and CD8 cluster. Blue: Enriched in CD8, under-represented in CD4; Orange: Enriched in CD4, uner-represented in CD8. Analogous for the other two comparisons.
## Joining, by = "cluster"
## [[1]]
##
## [[2]]
##
## [[3]]
## GridSpec(2, 5, height_ratios=[0, 10.5], width_ratios=[5.6, 0, 0.2, 0.5, 0.25])
##
## /data/scratch/sturm/scratch/projects/2020/kortekaas2020_paper/work/conda/vanderburg_oropharyngeal_cancer-ca9006a72cd4c32ca83708ebea1b2975/lib/R/library/reticulate/python/rpytools/call.py:13: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
## res = rpycall.call_r_function(f, *args, **kwargs)
## [<matplotlib.axes._subplots.AxesSubplot object at 0x2b704d346fd0>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d2eee48>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d40d898>]
sc.pl.stacked_violin(adata_cd39, groupby="cd39_status",
var_names=genes, swap_axes=True, figsize=(5, 12), use_raw=True, save="_wide.svg")
## saving figure to file figures/stacked_violin_wide.svg
## [<matplotlib.axes._subplots.AxesSubplot object at 0x2b704d525c50>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d7c28d0>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d8809b0>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d89f748>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d8d8828>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d912860>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d94a5f8>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d985780>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d9a5a58>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704d9f95f8>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704da1d978>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704da75518>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704daaaf60>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704db18780>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704dad6ac8>, <matplotlib.axes._subplots.AxesSubplot object at 0x2b704db569e8>]