Figure 6

Read data, functions and packages

source("R/ReadPackages.R")
source("R/Functions.R")
source("R/ReadData.R")
source("R/ThemesColors.R")
source("R/Helpers.R")

Part 1

Frequencies

df_freq_treg <- df_comb %>% 
  add_prop(vars = c("PatientID", "Entity", "IdentI"), group.vars = 1) %>% 
  fill_zeros(values_from = "Prop", names_from = "IdentI") %>% 
  filter(IdentI %in% c(6,11))

pvalues <- df_freq_treg %>% 
  group_by(IdentI) %>% 
  wilcox_test(data=., formula =  Prop ~ Entity, comparisons = list(c("FL", "rLN"), c("MZL", "rLN"))) %>% 
  select(IdentI, Entity=group1, p) %>% 
  mutate(p_s=format(p, scientific = TRUE, digits=1)) %>% 
  mutate(p_f=case_when(p > 0.05 ~ "NA",
                           p==0.05 ~ "0.05",
                           p < 0.05 & p > 0.001 ~ as.character(round(p, 3)),
                           p==0.001 ~ "0.001",
                           p < 0.001 ~ p_s)) 

p1 <- 
  df_freq_treg %>% 
  filter(IdentI %in% c(6)) %>% 
  ggplot(aes(x=Entity, y=100*Prop))+
  geom_boxplot(width=0.5, outlier.alpha = 0, size=0.25)+
  ggbeeswarm::geom_beeswarm(size=0.75, shape=21, stroke=0.25, cex = 2.25, aes(fill=Entity))+
  geom_text(inherit.aes = F, data = pvalues %>% filter(IdentI==6) %>% mutate(Y=c(38,45)),
            aes(x=Entity, y=Y, label=p_f), size=2.5)+
  scale_fill_brewer(palette = "Paired", limits=c("DLBCL", "MCL", "FL", "MZL", "rLN"))+
  ggtitle(expression('T'[FH]))+
  scale_y_continuous(limits = c(0,60), name="% of total T-cells (CITE-seq)")+
  scale_x_discrete(limits=c("rLN", "DLBCL", "MCL", "FL", "MZL"))+
  mytheme_1+
  theme(legend.position = "none",
        strip.background = element_rect(color=NA),
        axis.title.x = element_blank(),
        panel.border = element_rect(size=0.5),
        plot.title = element_text(vjust = -1, color=colors_umap_cl[["6"]]),
        axis.text.x = element_text(angle=45, hjust = 1),
        panel.background = element_rect(fill=NA),
        plot.margin = unit(c(0,0.1,0,0.25), "cm"))+
  labs(tag = "A")

p2 <- 
  df_freq_treg %>% 
  filter(IdentI %in% c(11)) %>% 
  ggplot(aes(x=Entity, y=100*Prop))+
  geom_boxplot(width=0.5, outlier.alpha = 0, size=0.25)+
  ggbeeswarm::geom_beeswarm(size=0.75, shape=21, stroke=0.25, cex = 2.25, aes(fill=Entity))+
  geom_text(inherit.aes = F, data = pvalues %>% filter(IdentI==11) %>% mutate(Y=c(16,17.5)),
            aes(x=Entity, y=Y, label=p_f), size=2.5)+
  scale_fill_brewer(palette = "Paired", limits=c("DLBCL", "MCL", "FL", "MZL", "rLN"))+
  ggtitle(expression('T'[REG]~'EM'[2]))+
  scale_y_continuous(limits = c(0,18.25), name="% of total T-cells (CITE-seq)")+
  scale_x_discrete(limits=c("rLN", "DLBCL", "MCL", "FL", "MZL"))+
  mytheme_1+
  theme(strip.background = element_rect(color=NA),
        plot.title = element_text(vjust = -1, color=colors_umap_cl[["11"]]),
        axis.text.x = element_text(angle=45, hjust = 1),
        panel.border = element_rect(size=0.5),
        axis.title = element_blank(),
        panel.background = element_rect(fill=NA),
        plot.margin = unit(c(0,0.25,0,0.1), "cm"))

Surface proteins

proteins_selected <- c("CD69"="CD69", 
                       "CD25"="CD25", 
                       "ICOS"="CD278", 
                       "CD134"="CD134", 
                       "CD161"="CD161", 
                       "CCR4"="CD194", 
                       "CCR5"="CD195", 
                       "CXCR3"="CD183", 
                       "CXCR5"="CD185", 
                       "PD1"="CD279", 
                       "CD38"="CD38", 
                       "CD39"="CD39", 
                       "TIGIT"="TIGIT")

p3 <- 
  left_join(percentageADT, meanADT) %>% 
  filter(IdentI %in% c(6, 8, 11, 15, 13), Epitope %in% proteins_selected) %>% 
  ggplot(aes(x=Epitope, y=IdentI, size=100*Prop, fill=Expression))+
  geom_point(shape=21, stroke=0.1, color="grey45")+ 
  scale_size_continuous(range=c(0, 4), name="% pos. cells", limits=c(0, 100))+
  scale_fill_gradientn(name="Expression", colours = brewer.pal(5, "BuGn"), limits=c(0,1))+
  scale_y_discrete(limits=rev(as.character(c(6, 8, 13, 15, 11))), 
                   labels=parse(text=rev(labels_cl_parsed[5:9]))
                   )+
  scale_x_discrete(limits=unname(proteins_selected), labels=names(proteins_selected))+
  ggtitle("Protein level")+
  coord_cartesian(clip = "off")+
  theme_bw()+
  theme(axis.title = element_blank(),
        legend.position = "right",
        axis.text.x = element_text(angle = 45, hjust = 1),
        axis.text.y = element_blank(),
        axis.text = element_text(size=7),
        axis.ticks.y = element_blank(),
        legend.text = element_text(size = 7, color="black"),
        legend.title = element_text(size = 7, color="black", vjust = 0.5),
        legend.box.margin=margin(-10,-10,-8,-8),
        legend.key.height = unit(0.3, "cm"),
        legend.key.width = unit(0.3, "cm"),
        panel.border = element_rect(size=0.25),
        plot.margin = unit(c(0,0.5,0,0.5), "cm"),
        plot.tag = element_text(margin =  unit(c(0,1,0,0), "cm")),
        plot.title = element_text(size = 7, color="black", vjust = -1, hjust = 0.5, face = "bold"),
        panel.grid = element_blank())+
  labs(tag = "B")

for(i in 5:9) {
  
  p3 <- p3+
    annotation_custom(grob = rectGrob(gp = gpar(fill=colors_umap_cl[as.character(cluster_order)[i]], col="white")), 
                    ymin = rev(c(seq(0.5, 4.5, 1)+0.25))[i-4], 
                    ymax = rev(c(seq(1.5, 5.5, 1)-0.25))[i-4],
                    xmin = 0, xmax = -0.75)+
    annotation_custom(grob = textGrob(label = labels_cl[[i]], rot = 0, hjust = 1, gp = gpar(cex=0.6)), 
                      ymin = rev(c(seq(0.5, 4.5, 1)+0.25))[i-4], 
                      ymax = rev(c(seq(1.5, 5.5, 1)-0.25))[i-4],
                    xmin = -1, xmax = -1)
}

Assemble plot

p1+p2+p3+plot_layout(widths = c(1,1,1.45))

ggsave(width = 18.5, height = 5.8, units = "cm", filename = "Figure6_p1.pdf")

Part 2

Differentially expressed genes

height.label <- 0.94
position.label <- 1.1
Idents(Combined_T) <- "IdentI"

df_markers1115 <- FindMarkers(Combined_T, ident.1 = 11, ident.2 = c(15), test.use = "roc", assay = "integratedRNA") %>% 
  rownames_to_column("Feature") %>% mutate(Assay="Gene")

labels <- c("KLF2", "IKZF3", "IL21", "ASCL2", "IKZF2", "FOXP3", "CXCL13")

df_tmp <- df_markers1115 %>% mutate(Label=ifelse(Feature %in% labels, Feature, NA)) %>% 
  mutate(Label=gsub(Label, pattern = ".", fixed = T, replacement = ""))

df_tmp1 <- df_tmp %>% filter(avg_log2FC<0)
df_tmp2 <- df_tmp %>% filter(avg_log2FC>0)

p4 <- 
  ggplot()+
  geom_point(data=df_tmp1, aes(x=avg_log2FC, y=power), alpha=ifelse(!is.na(df_tmp1$Label), 1, 0.25), stroke=0, size=1.25)+
  geom_point(data=df_tmp2, aes(x=avg_log2FC, y=power), alpha=ifelse(!is.na(df_tmp2$Label), 1, 0.25), stroke=0, size=1.25)+
  ggrepel::geom_text_repel(data=df_tmp1, aes(x=avg_log2FC, y=power, label=Label), show.legend = F, size=2.5, segment.size=0.25, xlim = c(-1.25, -1.75))+
  ggrepel::geom_text_repel(data=df_tmp2, aes(x=avg_log2FC, y=power, label=Label), show.legend = F, size=2.5, segment.size=0.25, xlim = c(1.3, 1.5))+
  geom_vline(xintercept = 0, linetype="dashed", size=0.25)+
  scale_y_continuous(breaks = c(0.2, 0.4, 0.6, 0.8), limits=c(0.1, 0.85), name="2 x abs(AUC-0.5)")+
  scale_x_continuous(name=expression('log'[2]~'fold change'), limits = c(-2.2, 2.2), expand = c(0,0))+
  annotation_custom(grob = textGrob(label = expression('T'[REG]~'EM'[1]), hjust = 0.5, gp = gpar(cex=0.6, fontface="bold", col=colors_umap_cl["15"])), 
                    xmin = -position.label, xmax = -position.label,
                    ymin = height.label, ymax = height.label)+
  annotation_custom(grob = textGrob(label = expression('T'[REG]~'EM'[2]), hjust = 0.5, gp = gpar(cex=0.6, fontface="bold", col=colors_umap_cl["11"])),
                    xmin = position.label, xmax = position.label,
                    ymin = height.label, ymax = height.label)+
  mytheme_1+
  coord_cartesian(clip = "off")+
  theme(legend.position = c(0.17, 0.15),
        legend.key.height = unit(units="cm", 0.3),
        legend.box.spacing = unit(units="cm", 0.01),
        legend.text = element_text(size=7),
        panel.border = element_rect(size=0.25),
        plot.margin = unit(c(0,0.25,0,0), "cm"),
        legend.background = element_rect(fill = NA),
        legend.box.margin=margin(-20,-20,-20,-20),
        legend.key.width = unit(units="cm", 0.1))+
    labs(tag = "C")

Shared clonotypes

df_clonotypes_shared <- 
  left_join(DFtotal_5prime %>% filter(!is.na(raw_clonotype_id)) %>% 
            select(Barcode_fulla=Barcode_full, PatientID, refUMAP_1a=refUMAP_1, refUMAP_2a=refUMAP_2, IdentIa=IdentI, raw_clonotype_id) %>% distinct(),
          DFtotal_5prime %>% filter(!is.na(raw_clonotype_id)) %>% 
            select(Barcode_fullb=Barcode_full, PatientID, refUMAP_1b=refUMAP_1, refUMAP_2b=refUMAP_2, IdentIb=IdentI, raw_clonotype_id) %>% distinct()
          ) %>% 
  filter(Barcode_fulla!=Barcode_fullb) %>% 
  filter(IdentIa!=IdentIb)

df_subset <- 
  df_clonotypes_shared %>% 
  add_entity() %>% 
  filter(IdentIb==11) %>% 
  filter(refUMAP_1b<1, refUMAP_2b>4)

label6 <- paste0(100*round(nrow(df_subset %>% filter(IdentIa==6))/nrow(df_subset), 3), " %")
label14 <- paste0(100*round(nrow(df_subset %>% filter(IdentIa==14))/nrow(df_subset), 3), " %")
label5 <- paste0(100*round(nrow(df_subset %>% filter(IdentIa==5))/nrow(df_subset), 3), " %")

p5 <- ggplot()+
  geom_point_rast(data=DFtotal_5prime,
                  aes(x=refUMAP_1, y=refUMAP_2, fill=IdentI), size=0.25, 
                  alpha=ifelse(DFtotal_5prime$IdentI==11, 0.75, 0.05), stroke=0, shape=21)+
  geom_curve(data= df_subset, 
             aes(x=refUMAP_1a, y=refUMAP_2a, xend=refUMAP_1b, yend=refUMAP_2b, color=IdentIa,
                 group=paste(raw_clonotype_id, PatientID)), curvature = -0.4, size=0.1, alpha=0.4)+
  geom_text(inherit.aes = F, aes(x=-0.75, y=8.5, label=label6), color=colors_umap_cl[["6"]], size=2.5)+
  geom_text(inherit.aes = F, aes(x=4.5, y=6.75, label=label14), color=colors_umap_cl[["14"]], size=2.5)+
  geom_text(inherit.aes = F, aes(x=8, y=1, label=label5), color=colors_umap_cl[["5"]], size=2.5)+
  scale_fill_manual(values = colors_umap_cl, guide="none")+
  scale_color_manual(values = colors_umap_cl, guide="none")+
  coord_cartesian(clip = "off")+
  labs(
    x="refUMAP-1",
    y="refUMAP-2",
    title="Paired clonotypes of <span style='color:#08306B'>T<sub>REG</sub> EM<sub>2</sub></span>")+
  mytheme_1+
  theme(panel.border = element_rect(size=0.25),
        plot.title = element_textbox_simple(size = 7, width = NULL, padding = margin(1.25, 0, 1, 0), 
                                            lineheight = 1.25, halign=0.5, face = "plain"),
        plot.margin = unit(c(0,0.25,0,0), units = "cm"))+
  labs(tag = "D")

Association with FL grade

p6 <- df_freq %>% 
  left_join(., df_meta %>% select(PatientID, FL_Grade, Entity) %>% distinct, by="PatientID") %>% 
  filter(Population==11, Entity=="FL") %>% 
  ggplot(aes(x=FL_Grade, y=RNA))+
  geom_boxplot(size=0.25, width=0.3, outlier.alpha = 0)+
  ggbeeswarm::geom_beeswarm(size=0.8, shape=21, stroke=0.25, cex = 2.75, fill="grey65")+
  stat_compare_means(comparisons = list(c("1/2", "3A")), vjust = -0.35, label.y = c(16.75),
                     size=2.5, tip.length = 0.02, bracket.size = 0.25)+
  ggtitle(expression('T'[REG]~'EM'[2]))+
  xlab("Grade")+
  ylim(0,18.25)+
  ylab("% of total T-cells")+
  mytheme_1+
  theme(legend.position = "none",
        strip.background = element_rect(color=NA),
        panel.border = element_rect(size=0.5),
        plot.title = element_text(vjust = -1, color=colors_umap_cl[["11"]]),
        panel.background = element_rect(fill=NA),
        plot.margin = unit(c(0,0.25,0,0.25), "cm"))+
    labs(tag = "E")

p7 <- df_freq %>% 
  left_join(., df_meta %>% select(PatientID, FL_Grade, Entity) %>% distinct, by="PatientID") %>% 
  filter(Population==6, Entity=="FL") %>% 
  ggplot(aes(x=FL_Grade, y=RNA))+
  geom_boxplot(size=0.25, width=0.3, outlier.size = 1, outlier.alpha = 0, outlier.shape = 21, outlier.fill = "grey70")+
  ggbeeswarm::geom_beeswarm(size=0.8, shape=21, stroke=0.25, cex = 2.75, fill="grey65")+
  stat_compare_means(comparisons = list(c("1/2", "3A")), vjust = -0.35, label.y = c(59.5),
                     size=2.5, tip.length = 0.02, bracket.size = 0.25)+
  ggtitle(expression('T'[FH]))+
  ylim(0,65)+
  xlab("Grade")+
  ylab("% of total T-cells")+
  mytheme_1+
  theme(legend.position = "none",
        strip.background = element_rect(color=NA),
        panel.border = element_rect(size=0.5),
        plot.title = element_text(vjust = -1, color=colors_umap_cl[["6"]]),
        panel.background = element_rect(fill=NA),
        plot.margin = unit(c(0,0.25,0,0.25), "cm"))+
    labs(tag = "F")

Assemble plot

p4+p5+p6+p7+plot_layout(widths = c(1.05,1,0.3,0.3))

#ggsave(width = 18.5, height = 6.5, units = "cm", filename = "Figure6_p2.pdf")

Session info

sessionInfo()
## R version 4.1.2 (2021-11-01)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Rocky Linux 8.8 (Green Obsidian)
## 
## Matrix products: default
## BLAS/LAPACK: /g/easybuild/x86_64/Rocky/8/haswell/software/FlexiBLAS/3.0.4-GCC-11.2.0/lib64/libflexiblas.so.3.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] grid      stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] pamr_1.56.1        cluster_2.1.2      glmnet_4.1-2       Matrix_1.5-1       immunarch_0.7.0    data.table_1.14.2 
##  [7] dtplyr_1.2.2       rmdformats_1.0.4   ggplotify_0.1.0    ggraph_2.0.6       igraph_1.3.5       ggrastr_1.0.1     
## [13] ggtext_0.1.1       ggalluvial_0.12.3  maxstat_0.7-25     survival_3.2-13    survminer_0.4.9    ggridges_0.5.3    
## [19] cowplot_1.1.1      R.utils_2.11.0     R.oo_1.24.0        R.methodsS3_1.8.1  readxl_1.4.1       caret_6.0-90      
## [25] lattice_0.20-45    patchwork_1.1.2    rstatix_0.7.0      ggpubr_0.4.0       ggrepel_0.9.1      matrixStats_0.61.0
## [31] scales_1.2.1       RColorBrewer_1.1-3 viridis_0.6.2      viridisLite_0.4.1  forcats_0.5.1      stringr_1.4.1     
## [37] dplyr_1.0.10       purrr_0.3.4        readr_2.1.2        tidyr_1.2.1        tibble_3.1.8       ggplot2_3.3.6     
## [43] tidyverse_1.3.1    SeuratObject_4.0.4 Seurat_4.1.0       knitr_1.40        
## 
## loaded via a namespace (and not attached):
##   [1] scattermore_0.8       prabclus_2.3-2        ModelMetrics_1.2.2.2  exactRankTests_0.8-34 ragg_1.2.1           
##   [6] bit64_4.0.5           irlba_2.3.5           rpart_4.1-15          doParallel_1.0.17     generics_0.1.3       
##  [11] RANN_2.6.1            future_1.23.0         bit_4.0.4             tzdb_0.3.0            rlist_0.4.6.2        
##  [16] spatstat.data_2.1-2   xml2_1.3.2            lubridate_1.8.0       httpuv_1.6.6          assertthat_0.2.1     
##  [21] gower_0.2.2           xfun_0.33             hms_1.1.2             jquerylib_0.1.4       evaluate_0.16        
##  [26] promises_1.2.0.1      DEoptimR_1.0-11       fansi_1.0.3           dbplyr_2.1.1          km.ci_0.5-2          
##  [31] DBI_1.1.2             htmlwidgets_1.5.4     spatstat.geom_2.3-2   stringdist_0.9.8      stats4_4.1.2         
##  [36] ellipsis_0.3.2        backports_1.4.1       bookdown_0.29         markdown_1.1          deldir_1.0-6         
##  [41] vctrs_0.4.2           Cairo_1.5-12.2        ROCR_1.0-11           abind_1.4-5           cachem_1.0.6         
##  [46] withr_2.5.0           ggforce_0.4.0         robustbase_0.95-0     vroom_1.5.7           sctransform_0.3.3    
##  [51] mclust_5.4.10         goftest_1.2-3         ape_5.6-2             lazyeval_0.2.2        crayon_1.5.2         
##  [56] labeling_0.4.2        recipes_0.1.17        pkgconfig_2.0.3       tweenr_2.0.2          nlme_3.1-153         
##  [61] vipor_0.4.5           nnet_7.3-16           rlang_1.0.6           globals_0.14.0        diptest_0.76-0       
##  [66] lifecycle_1.0.2       miniUI_0.1.1.1        modelr_0.1.8          cellranger_1.1.0      polyclip_1.10-0      
##  [71] lmtest_0.9-39         phangorn_2.10.0       ggseqlogo_0.1         KMsurv_0.1-5          carData_3.0-5        
##  [76] zoo_1.8-9             reprex_2.0.1          beeswarm_0.4.0        GlobalOptions_0.1.2   pheatmap_1.0.12      
##  [81] png_0.1-7             KernSmooth_2.23-20    pROC_1.18.0           shape_1.4.6           parallelly_1.30.0    
##  [86] spatstat.random_2.1-0 gridGraphics_0.5-1    ggsignif_0.6.3        magrittr_2.0.3        plyr_1.8.7           
##  [91] ica_1.0-2             compiler_4.1.2        factoextra_1.0.7      fitdistrplus_1.1-6    cli_3.4.1            
##  [96] listenv_0.8.0         pbapply_1.5-0         MASS_7.3-54           mgcv_1.8-38           tidyselect_1.1.2     
## [101] stringi_1.7.8         textshaping_0.3.6     highr_0.9             yaml_2.3.5            survMisc_0.5.5       
## [106] sass_0.4.2            fastmatch_1.1-3       tools_4.1.2           future.apply_1.8.1    parallel_4.1.2       
## [111] circlize_0.4.15       rstudioapi_0.13       uuid_1.1-0            foreach_1.5.2         gridExtra_2.3        
## [116] prodlim_2019.11.13    farver_2.1.1          Rtsne_0.16            digest_0.6.29         shiny_1.7.2          
## [121] lava_1.6.10           quadprog_1.5-8        fpc_2.2-9             Rcpp_1.0.9            gridtext_0.1.4       
## [126] car_3.1-0             broom_1.0.1           later_1.3.0           RcppAnnoy_0.0.19      httr_1.4.2           
## [131] kernlab_0.9-31        colorspace_2.0-3      rvest_1.0.2           fs_1.5.2              tensor_1.5           
## [136] reticulate_1.24       splines_4.1.2         uwot_0.1.11           yulab.utils_0.0.4     spatstat.utils_2.3-0 
## [141] graphlayouts_0.8.2    xgboost_1.4.1.1       shinythemes_1.2.0     flexmix_2.3-18        systemfonts_1.0.4    
## [146] plotly_4.10.0         xtable_1.8-4          jsonlite_1.8.0        tidygraph_1.2.2       timeDate_3043.102    
## [151] UpSetR_1.4.0          modeltools_0.2-23     ipred_0.9-12          R6_2.5.1              pillar_1.8.1         
## [156] htmltools_0.5.3       mime_0.12             glue_1.6.1            fastmap_1.1.0         class_7.3-19         
## [161] codetools_0.2-18      mvtnorm_1.1-3         utf8_1.2.2            bslib_0.4.0           spatstat.sparse_2.1-0
## [166] ggbeeswarm_0.6.0      leiden_0.3.9          rmarkdown_2.17        munsell_0.5.0         iterators_1.0.14     
## [171] haven_2.4.3           reshape2_1.4.4        gtable_0.3.1          spatstat.core_2.4-0