%%R
library(conflicted)
conflict_prefer("Position", "base")
library(dplyr)
library(ggplot2)
library(ggpubr)
library(ggbeeswarm)
library(edgeR)
library(magrittr)
options(max.print=100)
options(repr.matrix.max.cols=50, repr.matrix.max.rows=6)
R[write to console]: [conflicted] Will prefer base::Position over any other package
R[write to console]: Loading required package: magrittr
R[write to console]: Loading required package: limma
sc.pl.umap(
adata,
color=["cell_type", "cluster", "ENTPD1", "FOXP3", "CD4"],
legend_loc="on data",
size=10,
cmap="magma",
ncols=2,
)
/home/sturm/scratch/projects/2020/kortekaas2020_paper/work/conda/run_notebook-b99176dfb05e0522988294512373169f/lib/python3.7/site-packages/IPython/core/pylabtools.py:128: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
fig.canvas.print_figure(bytes_io, **kw)
We perform unsupervised clustering at high resolution and manually pick the clusters expressing NKG2a.
sc.pl.umap(
adata,
color=["leiden", "ENTPD1"],
legend_loc="on data",
size=10,
ncols=2,
cmap="magma",
)
/home/sturm/scratch/projects/2020/kortekaas2020_paper/work/conda/run_notebook-b99176dfb05e0522988294512373169f/lib/python3.7/site-packages/IPython/core/pylabtools.py:128: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
fig.canvas.print_figure(bytes_io, **kw)
sc.pl.umap(
adata,
color=["cd39_status", "ENTPD1"],
size=10,
cmap="magma",
legend_loc="on data",
ncols=2,
)
... storing 'cd39_status' as categorical
%%R
adata = adata0[, colData(adata0)$cd39_status != "na"]
colData(adata)$cd39_status %<>% droplevels()
design = model.matrix(~0 + cd39_status + patient + n_genes + mt_frac, data=colData(adata))
contrasts = makeContrasts(
cd4_cd8 = cd39_statusCD4 - cd39_statusCD8,
cd4_treg = cd39_statusCD4 - cd39_statusTreg,
cd8_treg = cd39_statusCD8 - cd39_statusTreg,
levels = colnames(design)
)
save(adata, design, contrasts, file=paste0(de_dir, '/cd39_status.rda'), compress=FALSE)