4. Covid19 data immune selection

Table of Contents

  • 1  per-sample filtering

    • 1.1  sample 1

    • 1.2  sample 2

    • 1.3  sample 3

    • 1.4  sample 5

    • 1.5  sample 6

    • 1.6  sample 7

    • 1.7  sample 8

    • 1.8  sample 9

    • 1.9  sample 12

    • 1.10  sample 13

    • 1.11  per-sample reclustering after filtering

  • 2  integration

    • 2.1  harmony

    • 2.2  drop non-immune cells

    • 2.3  reclustering after dropping

    • 2.4  split by batch

  • 3  per-sample annotation

    • 3.1  HC3

      • 3.1.1  DC

      • 3.1.2  Mac

      • 3.1.3  T

    • 3.2  HC4

      • 3.2.1  DC

      • 3.2.2  Mac

      • 3.2.3  T

    • 3.3  M1

      • 3.3.1  DC

      • 3.3.2  Mac

      • 3.3.3  T

    • 3.4  M2

      • 3.4.1  DC

      • 3.4.2  Mac

      • 3.4.3  T

    • 3.5  S1

      • 3.5.1  DC

      • 3.5.2  T

      • 3.5.3  Mac

    • 3.6  S2

      • 3.6.1  DC

      • 3.6.2  Mac

      • 3.6.3  T

    • 3.7  S3

      • 3.7.1  T

      • 3.7.2  DC

      • 3.7.3  Mac

    • 3.8  S4

      • 3.8.1  DC

      • 3.8.2  Mac

      • 3.8.3  T

    • 3.9  S5

      • 3.9.1  DC

      • 3.9.2  Mac

      • 3.9.3  T

    • 3.10  S6

      • 3.10.1  DC

      • 3.10.2  Mac

      • 3.10.3  T

library(tictoc)
library(Seurat)
library(Nebulosa)
tic()
load(file = 'nCoV.list.qc.rda')
toc()
92.059 sec elapsed
library(Seurat)
library(dplyr)
library(ggpubr)
o<-function(w,h) options(repr.plot.width=w, repr.plot.height=h)
Attaching package: ‘dplyr’


The following objects are masked from ‘package:stats’:

    filter, lag


The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union


Loading required package: ggplot2
manymanycolors=c('#e6194b', '#3cb44b', '#ffe119', '#4363d8', '#f58231', '#911eb4', '#46f0f0', '#f032e6', '#bcf60c', '#fabebe', '#008080', '#e6beff', '#9a6324', '#fffac8', '#800000', '#aaffc3', '#808000', '#ffd8b1', '#000075', '#808080', '#4f34ff', '#f340F0')

per-sample filtering

sample 1

i=1
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_6_0.png output_6_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 15)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 18)

sample 2

i=2
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_9_0.png output_9_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 10)

sample 3

i=3
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_12_0.png output_12_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 17)

sample 5

i=5
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_15_0.png output_15_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 14)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 16)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 19)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 21)

sample 6

i=6
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_18_0.png output_18_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 4)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 5)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 10)

sample 7

i=7
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_21_0.png output_21_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 1)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 7)

sample 8

i=8
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_24_0.png output_24_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 9)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 7)

sample 9

i=9
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_27_0.png output_27_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 13)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 15)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 17)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 19)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 21)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 10)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 18)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 20)

sample 12

i=12
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
output_30_0.png output_30_1.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 12)
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 7)

sample 13

i=13
o(10,10)

DimPlot(nCoV.list[[i]], label=T,repel=T, group.by="RNA_snn_res.1.2")&NoLegend()&
    theme(axis.line = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks=element_blank()
         )

o(5*5, 5*3)
FeaturePlot(nCoV.list[[i]],
            features = c("PTPRC","COL1A1","EPCAM","PECAM1","CD3D",
                         'ITGAM','ITGAX',"CD68",'S100A9',"FCGR3B",
                         'CD79A','CD4','CD8A','IL7R','CCR7',
                         "CD44","IL2RA",'ITGAE','SELL','CD69'),
            ncol=5
)&theme(axis.line = element_blank(),
        axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks=element_blank()
)
Warning message in FeaturePlot(nCoV.list[[i]], features = c("PTPRC", "COL1A1", "EPCAM", :
“All cells have the same value (0) of FCGR3B.”
output_34_1.png output_34_2.png
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 0 )
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 2 )
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 4 )
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 6 )
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 5 )
nCoV.list[[i]] <- subset(nCoV.list[[i]] , RNA_snn_res.1.2 != 7)

per-sample reclustering after filtering

nCoV.selected <- nCoV.list[c(1,2,3,5,6,7,8,9,12,13)]
nCoV.selected
$M1
An object of class Seurat
25916 features across 3368 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$M2
An object of class Seurat
25916 features across 2952 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S2
An object of class Seurat
25916 features across 9839 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S1
An object of class Seurat
25916 features across 11018 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S3
An object of class Seurat
25916 features across 855 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S4
An object of class Seurat
25916 features across 1321 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S5
An object of class Seurat
25916 features across 1807 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S6
An object of class Seurat
25916 features across 2151 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$HC3
An object of class Seurat
25916 features across 2168 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$HC4
An object of class Seurat
25916 features across 1243 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap
library(tictoc)
tic()
save(nCoV.selected,
     file = 'nCoV.imm.rda',
     compress = T, compression_level = 9)
toc()
x=nCoV.list[[1]]

masked.genes<-c(
    c(grep("^RPL", rownames(x), value = T),grep("^RPS", rownames(x), value = T)),

    grep("^MT-", rownames(x), value = T),

    c(grep("^IFI", rownames(x), value = T),grep("^ISG", rownames(x), value = T)),

    grep("^SMC[0-9]*", rownames(x), value = T),

    grep("^MCM[0-9]*", rownames(x), value = T),

    c(grep("^TUBA", rownames(x), value = T),
      grep("^TUBB", rownames(x), value = T),
      grep("^TUBD[0-9]", rownames(x), value = T),
      grep("^TUBE[0-9]", rownames(x), value = T),
      grep("^TUBG[0-9]", rownames(x), value = T)
    ),

    c(Seurat::cc.genes.updated.2019$s.genes,
      Seurat::cc.genes.updated.2019$g2m.genes
    ),

    c("H1-0","H1-1","H1-10","H1-12P","H1-2","H1-3","H1-4","H1-5","H1-6","H1-7","H1-8",
    "H1-9P","H2AB1","H2AB2","H2AB3","H2AC1","H2AC10P","H2AC11","H2AC12","H2AC13","H2AC14",
    "H2AC15","H2AC16","H2AC17","H2AC18","H2AC19","H2AC20","H2AC21","H2AC2P","H2AC3P","H2AC4",
    "H2AC5P","H2AC6","H2AC7","H2AC8","H2AC9P","H2AJ","H2AL1MP","H2AL1Q","H2AL3",
    "H2AP","H2AQ1P","H2AW","H2AX","H2AZ1","H2AZ2","MACROH2A1","MACROH2A2","H2BC1","H2BC10",
    "H2BC11","H2BC12","H2BC13","H2BC14","H2BC15","H2BC16P","H2BC17","H2BC18",
    "H2BC19P","H2BC20P","H2BC21","H2BC2P","H2BC3","H2BC4","H2BC5","H2BC6","H2BC7","H2BC8",
    "H2BC9","H2BK1","H2BL1P","H2BN1","H2BC12L","H2BU1","H2BU2P","H2BW1","H2BW2",
    "H2BW3P","H2BW4P","H3-7","H3-3A","H3-3B","H3-4","H3-5","H3C1","H3C10","H3C11","H3C12",
    "H3C13","H3C14","H3C15","H3C2","H3C3","H3C4","H3C5P","H3C6","H3C7","H3C8",
    "H3C9P","H3Y1","H3Y2","CENPA","H4-16","H4C1","H4C10P","H4C11","H4C12","H4C13","H4C14",
    "H4C15","H4C2","H4C3","H4C4","H4C5","H4C6","H4C7","H4C8","H4C9"),
    grep("^HIST", rownames(x), value=T)
)
Error in eval(expr, envir, enclos): object 'nCoV.list' not found
Traceback:
# normalize and identify variable features for each dataset independently
nCoV.list <- lapply(X = nCoV.selected, FUN = function(x) {
    DefaultAssay(x)<-'RNA'
    x <- NormalizeData(x, verbose = F)
    x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000, verbose = F)
    hvg = VariableFeatures(x)
    goi = setdiff(hvg,masked.genes)
    print(length(goi))

    x <- ScaleData(x, features = goi, verbose = F)
    x <- RunPCA(object = x, features = VariableFeatures(x), npcs = 50, verbose = F)
    x <- FindNeighbors(x, reduction = "pca", dims = 1:30, verbose = F)
    x <- RunUMAP(object=x,reduction = "pca", dims = 1:30, verbose = F)
    x <- FindClusters(object=x, resolution = c(0.7,0.9,1.2),verbose = F)

    x
})
[1] 1916
Warning message:
“The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
This message will be shown once per session”
[1] 1921
[1] 1905
[1] 1909
[1] 1949
[1] 1923
[1] 1926
[1] 1917
[1] 1918
[1] 1918
names(nCoV.list)
  1. 'M1'
  2. 'M2'
  3. 'S2'
  4. 'S1'
  5. 'S3'
  6. 'S4'
  7. 'S5'
  8. 'S6'
  9. 'HC3'
  10. 'HC4'
nCoV.list<-nCoV.list[c("HC3","HC4","M1","M2","S1","S2","S3","S4","S5","S6")]
nCoV.list
$HC3
An object of class Seurat
25916 features across 2168 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$HC4
An object of class Seurat
25916 features across 1243 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$M1
An object of class Seurat
25916 features across 3368 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$M2
An object of class Seurat
25916 features across 2952 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S1
An object of class Seurat
25916 features across 11018 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S2
An object of class Seurat
25916 features across 9839 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S3
An object of class Seurat
25916 features across 855 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S4
An object of class Seurat
25916 features across 1321 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S5
An object of class Seurat
25916 features across 1807 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap

$S6
An object of class Seurat
25916 features across 2151 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 2 dimensional reductions calculated: pca, umap
immune.combined <- merge(x=nCoV.list[['HC3']], y=nCoV.list[c("HC4","M1","M2","S1","S2","S3","S4","S5","S6")] )
immune.combined@meta.data$RNA_snn_res.0.7 <- paste(
    immune.combined@meta.data$sample_new,
    immune.combined@meta.data$RNA_snn_res.0.7,sep='_')

immune.combined@meta.data$RNA_snn_res.0.9 <- paste(
    immune.combined@meta.data$sample_new,
    immune.combined@meta.data$RNA_snn_res.0.9,sep='_')

immune.combined@meta.data$RNA_snn_res.1.2 <- paste(
    immune.combined@meta.data$sample_new,
    immune.combined@meta.data$RNA_snn_res.1.2,sep='_')
immune.combined[[]]
A data.frame: 36722 × 28
orig.identnCount_RNAnFeature_RNAgrouppercent.mtIDsamplesample_newsample_new_olddiseaseRNA_snn_res.0.7RNA_snn_res.0.9RNA_snn_res.1.2cxds_score.xbcds_score.xhybrid_score.xpercent.dissocxds_score.ybcds_score.yhybrid_score.y
<chr><dbl><int><chr><dbl><chr><chr><chr><chr><chr><chr><chr><chr><dbl><dbl><dbl><dbl><dbl><dbl><dbl>
AAACCCACAGCTACAT-1_12C100 31231376HC9.446045AAACCCACAGCTACAT-1_12C100HC3HC3NHC3_5 HC3_5 HC3_6 52.26712570.0181825700.078501911.569004 52.26712570.0181825700.08047192
AAACCCATCCCATTCG-1_12C100 23411104HC6.450235AAACCCATCCCATTCG-1_12C100HC3HC3NHC3_10HC3_10HC3_11 90.75147350.0114391340.117643632.605724 90.75147350.0114391340.12096609
AAACGAAGTCGCACAC-1_12C100127673409HC5.381061AAACGAAGTCGCACAC-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 1.26793280.1027612910.103083932.725777 1.26793280.1027612910.10366351
AAACGAAGTCTATGAC-1_12C100 21981094HC9.053685AAACGAAGTCTATGAC-1_12C100HC3HC3NHC3_8 HC3_8 HC3_9 52.09802000.0654565620.126080181.819836 52.09802000.0654565620.12829521
AAACGAAGTGTAGTGG-1_12C100 34131265HC8.731321AAACGAAGTGTAGTGG-1_12C100HC3HC3NHC3_2 HC3_2 HC3_2 0.15829430.0233403050.021487391.845883 0.15829430.0233403050.02160504
AAACGCTGTCACGTGC-1_12C100 1622 857HC9.186190AAACGCTGTCACGTGC-1_12C100HC3HC3NHC3_8 HC3_8 HC3_9 1.06795350.0250033490.024254541.541307 1.06795350.0250033490.02441384
AAACGCTGTTGGAGGT-1_12C100166493661HC6.438825AAACGCTGTTGGAGGT-1_12C100HC3HC3NHC3_1 HC3_1 HC3_0 3.37893490.2863859830.291195822.889062 3.37893490.2863859830.29282700
AAAGAACTCTAGAACC-1_12C100248264510HC5.329090AAAGAACTCTAGAACC-1_12C100HC3HC3NHC3_1 HC3_1 HC3_0 586.57484410.5774034261.281772282.775316586.57484410.5774034261.30598739
AAAGAACTCTTTCTAG-1_12C100 50661666HC5.882353AAAGAACTCTTTCTAG-1_12C100HC3HC3NHC3_1 HC3_1 HC3_0 161.61282960.0075413890.198325591.421240161.61282960.0075413890.20418357
AAAGGATTCCGCACTT-1_12C100173713845HC9.556157AAAGGATTCCGCACTT-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 7.43176820.3384704890.348677882.527201 7.43176820.3384704890.35073194
AAAGGGCAGGATACAT-1_12C100195283680HC7.128226AAAGGGCAGGATACAT-1_12C100HC3HC3NHC3_9 HC3_9 HC3_10 6.36891330.2645358150.272682263.052028 6.36891330.2645358150.27430523
AAAGGGCGTTGAATCC-1_12C100228683876HC8.938254AAAGGGCGTTGAATCC-1_12C100HC3HC3NHC3_1 HC3_1 HC3_0 425.33053220.0273406430.533264112.015917425.33053220.0273406430.54874052
AAAGGTAGTACTTCCC-1_12C100 95303343HC5.729276AAAGGTAGTACTTCCC-1_12C100HC3HC3NHC3_2 HC3_2 HC3_2 583.56065980.0227123110.717541981.469045583.56065980.0227123110.73870174
AAAGGTAGTCGTAATC-1_12C100 1751 896HC5.653912AAAGGTAGTCGTAATC-1_12C100HC3HC3NHC3_3 HC3_4 HC3_5 23.47897650.0190897380.045040471.599086 23.47897650.0190897380.04597681
AAAGTCCCAGCACAGA-1_12C100171353355HC6.104465AAAGTCCCAGCACAGA-1_12C100HC3HC3NHC3_1 HC3_1 HC3_0 3.55414650.0747354180.077488112.299387 3.55414650.0747354180.07800129
AAAGTCCTCATCGTAG-1_12C100130873329HC8.833193AAAGTCCTCATCGTAG-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 2.37234870.0206078030.021369612.353481 2.37234870.0206078030.02155262
AAAGTCCTCTGGCTGG-1_12C100 97923346HC5.912990AAAGTCCTCTGGCTGG-1_12C100HC3HC3NHC3_2 HC3_2 HC3_2 9.20345960.1671641770.177652932.675654 9.20345960.1671641770.17886089
AAAGTGAAGGCCCAAA-1_12C100172953413HC9.291703AAAGTGAAGGCCCAAA-1_12C100HC3HC3NHC3_1 HC3_1 HC3_0 687.02149530.0454404990.864064732.307025687.02149530.0454404990.88907744
AAAGTGACAATTGAAG-1_12C100204153851HC8.959099AAAGTGACAATTGAAG-1_12C100HC3HC3NHC3_0 HC3_0 HC3_3 730.69679320.4349547031.309906212.233652730.69679320.4349547031.33856362
AAAGTGATCTTGCAAG-1_12C100 78832747HC8.106051AAAGTGATCTTGCAAG-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 0.88759510.0164560470.015400331.940885 0.88759510.0164560470.01550772
AAATGGACAAGAGATT-1_12C100131203274HC4.565549AAATGGACAAGAGATT-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 488.47758580.0265984220.607923091.920732488.47758580.0265984220.62567351
AAATGGATCATCCTGC-1_12C100 35981374HC2.473596AAATGGATCATCCTGC-1_12C100HC3HC3NHC3_5 HC3_5 HC3_6 43.86221170.0050624140.055204261.778766 43.86221170.0050624140.05680137
AACAAAGAGACTCCGC-1_12C100177833760HC7.715234AACAAAGAGACTCCGC-1_12C100HC3HC3NHC3_1 HC3_1 HC3_0 481.23041290.1316383180.705433311.428330481.23041290.1316383180.72348029
AACAAAGCACTGGCGT-1_12C100154623727HC8.103738AACAAAGCACTGGCGT-1_12C100HC3HC3NHC3_0 HC3_2 HC3_2 7.50855160.2147276250.223701662.218342 7.50855160.2147276250.22510115
AACAACCTCAGCAATC-1_12C100190864021HC6.774599AACAACCTCAGCAATC-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 728.53980390.2585650381.129051902.017185728.53980390.2585650381.15669449
AACACACAGATTGACA-1_12C100173093707HC6.695939AACACACAGATTGACA-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 723.57013630.2157254371.079818873.200647723.57013630.2157254371.10705461
AACACACAGCTACAAA-1_12C100174633850HC4.850255AACACACAGCTACAAA-1_12C100HC3HC3NHC3_1 HC3_1 HC3_0 593.64973280.1493372470.857571032.989177593.64973280.1493372470.87976740
AACAGGGAGGAGTCTG-1_12C100167123693HC9.071326AACAGGGAGGAGTCTG-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 708.72060320.0401591100.884639503.111537708.72060320.0401591100.91040692
AACAGGGAGGTAGTCG-1_12C100159053343HC6.186734AACAGGGAGGTAGTCG-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 0.82241590.2990428510.300935271.930211 0.82241590.2990428510.30254146
AACAGGGAGGTTAGTA-1_12C100153623079HC6.203619AACAGGGAGGTTAGTA-1_12C100HC3HC3NHC3_0 HC3_0 HC3_1 704.62878940.0264690850.865916512.362974704.62878940.0264690850.89146360
TTTACTGGTTGTGGAG-1_9C152 2008 903S7.8187251TTTACTGGTTGTGGAG-1_9C152S6C5YS6_1S6_1 S6_2 24117.8770.0051571320.098949152.9880478 24117.8770.0051571320.13018670
TTTACTGTCCCTCAGT-1_9C152111602571S5.8333333TTTACTGTCCCTCAGT-1_9C152S6C5YS6_1S6_7 S6_8 110364.2790.8829303981.319075442.6433692110364.2790.8829303981.47042592
TTTATGCAGATATGCA-1_9C152287214280S6.2602277TTTATGCAGATATGCA-1_9C152S6C5YS6_6S6_6 S6_7 26920.2010.0386806350.143610941.7165140 26920.2010.0386806350.17879909
TTTATGCAGCGCTTAT-1_9C152 1270 502S8.7401575TTTATGCAGCGCTTAT-1_9C152S6C5YS6_4S6_4 S6_4 30941.5300.0129810120.133680391.4960630 30941.5300.0129810120.17383131
TTTATGCAGCGTAATA-1_9C152 91342281S4.7952704TTTATGCAGCGTAATA-1_9C152S6C5YS6_1S6_7 S6_8 78360.1610.2974489930.605800072.5290125 78360.1610.2974489930.71009343
TTTATGCAGTCAATAG-1_9C152 2047 883S9.6238398TTTATGCAGTCAATAG-1_9C152S6C5YS6_0S6_0 S6_0 31584.8900.0143905440.137628804.5920860 31584.8900.0143905440.17862654
TTTATGCAGTTCCACA-1_9C152 46831392S6.1712577TTTATGCAGTTCCACA-1_9C152S6C5YS6_0S6_0 S6_0 61904.7690.2127429100.456015082.9041213 61904.7690.2127429100.53818358
TTTATGCCACATCCGG-1_9C152 38602076S8.0310881TTTATGCCACATCCGG-1_9C152S6C5YS6_5S6_5 S6_5 19544.1040.0224895370.098311602.4093264 19544.1040.0224895370.12379073
TTTATGCGTAGAAAGG-1_9C152 1731 840S5.1415367TTTATGCGTAGAAAGG-1_9C152S6C5YS6_1S6_1 S6_2 52885.9340.0378911230.245122024.5060659 52885.9340.0378911230.31393533
TTTATGCGTCAGTGGA-1_9C152 1975 941S0.4050633TTTATGCGTCAGTGGA-1_9C152S6C5YS6_7S6_9 S6_10 20486.6060.0051409590.084626021.7721519 20486.6060.0051409590.11115992
TTTATGCGTCGACTGC-1_9C152 2300 537S7.5217391TTTATGCGTCGACTGC-1_9C152S6C5YS6_6S6_6 S6_7 11652.7540.0021544270.046826151.0000000 11652.7540.0021544270.06188922
TTTATGCTCGCACTCT-1_9C152 1649 618S6.9739236TTTATGCTCGCACTCT-1_9C152S6C5YS6_4S6_4 S6_4 43422.5530.0234181450.193322051.2734991 43422.5530.0234181450.24973919
TTTCCTCAGAGACTTA-1_9C152 40281769S3.8728898TTTCCTCAGAGACTTA-1_9C152S6C5YS6_2S6_2 S6_1 12783.3670.1633740070.212968472.5571003 12783.3670.1633740070.23103885
TTTCCTCAGATCTGAA-1_9C152 1354 660S6.4992614TTTCCTCAGATCTGAA-1_9C152S6C5YS6_0S6_0 S6_0 33422.7210.0061883140.136643662.0679468 33422.7210.0061883140.17994339
TTTCCTCAGGATGGAA-1_9C152 27061062S5.4323725TTTCCTCAGGATGGAA-1_9C152S6C5YS6_0S6_0 S6_0 56867.2700.0186215010.241482572.9933481 56867.2700.0186215010.31526839
TTTCCTCCAGCTCCGA-1_9C152 66122491S5.5353902TTTCCTCCAGCTCCGA-1_9C152S6C5YS6_5S6_5 S6_5 49703.9180.3289331790.524472422.1324864 49703.9180.3289331790.59194942
TTTCCTCCAGGTCTCG-1_9C152 1951 834S7.3808303TTTCCTCCAGGTCTCG-1_9C152S6C5YS6_7S6_9 S6_10 11282.8350.0329338650.076237531.0251153 11282.8350.0329338650.09111601
TTTGCGCAGACTACAA-1_9C152224784601S5.8323694TTTGCGCAGACTACAA-1_9C152S6C5YS6_8S6_10S6_11134542.7060.2912119330.820899563.0073850134542.7060.2912119330.99790499
TTTGCGCTCCAGGGCT-1_9C152 1624 510S9.6674877TTTGCGCTCCAGGGCT-1_9C152S6C5YS6_4S6_4 S6_4 10035.6200.0036543580.041959060.8004926 10035.6200.0036543580.05494186
TTTGCGCTCTAACCGA-1_9C152 47891978S3.3409898TTTGCGCTCTAACCGA-1_9C152S6C5YS6_2S6_2 S6_1 9009.9940.0582159680.092638251.7957820 9009.9940.0582159680.10481473
TTTGGTTAGATCCCGC-1_9C152116122679S3.1174647TTTGGTTAGATCCCGC-1_9C152S6C5YS6_1S6_1 S6_6 120643.7810.3049311040.779897942.7988288120643.7810.3049311040.93903175
TTTGGTTAGCACCGTC-1_9C152 25911160S5.9050560TTTGGTTAGCACCGTC-1_9C152S6C5YS6_0S6_0 S6_0 39725.9140.0119887260.167294982.5086839 39725.9140.0119887260.21881458
TTTGGTTAGTCTCCTC-1_9C152 1878 923S6.4430245TTTGGTTAGTCTCCTC-1_9C152S6C5YS6_0S6_0 S6_0 37526.8980.0161761160.162830592.7689031 37526.8980.0161761160.21154194
TTTGGTTCACGAGAGT-1_9C152 60632097S4.1398648TTTGGTTCACGAGAGT-1_9C152S6C5YS6_0S6_0 S6_0 118655.3930.6714893581.139686652.2596075118655.3930.6714893581.29975291
TTTGGTTCACTATCTT-1_9C152 75362640S6.0509554TTTGGTTCACTATCTT-1_9C152S6C5YS6_5S6_5 S6_5 26398.7320.0532449740.156163033.0254777 26398.7320.0532449740.19081511
TTTGGTTCATCGGGTC-1_9C152 41041450S7.6267057TTTGGTTCATCGGGTC-1_9C152S6C5YS6_1S6_7 S6_8 67002.6460.1020863060.365122332.3635478 67002.6460.1020863060.45283499
TTTGGTTGTCTCTCTG-1_9C152 39161451S9.0653728TTTGGTTGTCTCTCTG-1_9C152S6C5YS6_1S6_0 S6_2 66699.3590.2143631280.476530303.1664964 66699.3590.2143631280.56492460
TTTGTCACAACACCCG-1_9C152 1347 556S9.3541203TTTGTCACAACACCCG-1_9C152S6C5YS6_4S6_4 S6_4 21219.3270.0112206860.093610261.6332591 21219.3270.0112206860.12115142
TTTGTCAGTCTGCAAT-1_9C152212743373S4.7663815TTTGTCAGTCTGCAAT-1_9C152S6C5YS6_3S6_3 S6_3 33608.8360.0379045640.169185291.1939457 33608.8360.0379045640.21302962
TTTGTCAGTGTTGGGA-1_9C152 43011705S6.4868635TTTGTCAGTGTTGGGA-1_9C152S6C5YS6_0S6_0 S6_0 98058.2580.4889237880.875439842.4180423 98058.2580.4889237881.00708003

integration

rm(nCoV.list)
gc()
A matrix: 2 × 6 of type dbl
used(Mb)gc trigger(Mb)max used(Mb)
Ncells 3173438 169.5 5685265 303.7 5685265 303.7
Vcells366427848727956.3534009229640741.7442421342033754.1
rm(nCoV.selected)
gc()
A matrix: 2 × 6 of type dbl
used(Mb)gc trigger(Mb)max used(Mb)
Ncells 3172482 169.5 5685265 303.7 5685265 303.7
Vcells251872363719216.4534009229640741.7442421342033754.1

harmony

library(harmony)
DefaultAssay(immune.combined)<-'RNA'
immune.combined %>% Seurat::NormalizeData(verbose = FALSE) %>%
FindVariableFeatures(selection.method = "vst", nfeatures = 2000) %>%
ScaleData(verbose = FALSE, features = rownames(immune.combined)) -> immune.combined

hvg = VariableFeatures(immune.combined)
goi = setdiff(hvg,masked.genes)

immune.combined <- RunPCA(object = immune.combined, features =goi,
                          npcs = 50, verbose = FALSE)
Loading required package: Rcpp
length(goi)
1921
immune.combined
An object of class Seurat
25916 features across 36722 samples within 2 assays
Active assay: RNA (23916 features, 2000 variable features)
 1 other assay present: integrated
 1 dimensional reduction calculated: pca
o(10,10)
immune.combined <- RunHarmony(
    object = immune.combined,
    group.by.vars= "sample_new",
    theta =3,  # larger theta make more diverse clusters
    lambda=2, # smaller lambda make integration more aggressive
    max.iter.harmony=100,
    max.iter.cluster=50,
    epsilon.cluster=-Inf, # don't stop early
    plot_convergence = TRUE

)
Harmony 1/100

Harmony 2/100

Harmony 3/100

Harmony 4/100

Harmony 5/100

Harmony 6/100

Harmony 7/100

Harmony 8/100

Harmony 9/100

Harmony 10/100

Harmony 11/100

Harmony 12/100

Harmony 13/100

Harmony 14/100

Harmony 15/100

Harmony 16/100

Harmony 17/100

Harmony 18/100

Harmony converged after 18 iterations

Warning message:
“Invalid name supplied, making object name syntactically valid. New object name is Seurat..ProjectDim.RNA.harmony; see ?make.names for more details on syntax validity”
output_56_1.png
immune.combined <- RunUMAP(immune.combined,reduction = "harmony", verbose=F, dims = 1:20)

immune.combined <- FindNeighbors(immune.combined, reduction = "harmony",
                                 graph.name ='harmony_snn', dims = 1:20, verbose=F)

immune.combined <- FindClusters(immune.combined, graph.name = 'harmony_snn',
                                algorithm=2,
                                n.start = 10, n.iter=100, random.seed=42,
                                resolution = c(0.1,0.3,0.5,0.7,0.9,1.2,1.5), verbose=F)
Only one graph name supplied, storing nearest-neighbor graph only
o(9,8)
DimPlot(immune.combined, group.by = 'harmony_snn_res.0.3', label=T, repel=T)
output_58_0.png
Idents(immune.combined)<- 'harmony_snn_res.0.3'
deg.0.3<-FindAllMarkers(immune.combined, only.pos = T,
                        logfc.threshold = 1, return.thresh = 0.001, min.pct = 0.3,
                        features = VariableFeatures(immune.combined))
Calculating cluster 0

Calculating cluster 1

Calculating cluster 10

Calculating cluster 2

Calculating cluster 3

Calculating cluster 4

Calculating cluster 5

Calculating cluster 6

Calculating cluster 7

Calculating cluster 8

Calculating cluster 9
deg.0.3 %>% filter(p_val_adj<0.01) %>% arrange(cluster,desc(avg_log2FC)) %>%
 group_by(cluster) %>% top_n(n = 10, wt = avg_log2FC) %>% pull(gene) %>% unique -> deg.viz

o(10,20)
DotPlot(immune.combined, features = rev(deg.viz)) &coord_flip()
output_60_0.png

drop non-immune cells

immune.combined <- subset(immune.combined, harmony_snn_res.0.3!=8 )

reclustering after dropping

immune.list <- SplitObject(immune.combined, split.by = "sample_new")
for (i in 1:length(immune.list)) {
    immune.list[[i]] <- NormalizeData(immune.list[[i]], verbose = FALSE)
    immune.list[[i]] <- FindVariableFeatures(immune.list[[i]], selection.method = "vst",
        nfeatures = 2000, verbose = FALSE)
}
integration.features <- SelectIntegrationFeatures(object.list = immune.list, nfeatures = 2000)
x=immune.combined

masked.genes<-c(
    c(grep("^RPL", rownames(x), value = T),grep("^RPS", rownames(x), value = T)),

    grep("^MT-", rownames(x), value = T),

    c(grep("^IFI", rownames(x), value = T),grep("^ISG", rownames(x), value = T)),

    grep("^SMC[0-9]*", rownames(x), value = T),

    grep("^MCM[0-9]*", rownames(x), value = T),

    c(grep("^TUBA", rownames(x), value = T),
      grep("^TUBB", rownames(x), value = T),
      grep("^TUBD[0-9]", rownames(x), value = T),
      grep("^TUBE[0-9]", rownames(x), value = T),
      grep("^TUBG[0-9]", rownames(x), value = T)
    ),

    c(Seurat::cc.genes.updated.2019$s.genes,
      Seurat::cc.genes.updated.2019$g2m.genes
    ),

    c("H1-0","H1-1","H1-10","H1-12P","H1-2","H1-3","H1-4","H1-5","H1-6","H1-7","H1-8",
    "H1-9P","H2AB1","H2AB2","H2AB3","H2AC1","H2AC10P","H2AC11","H2AC12","H2AC13","H2AC14",
    "H2AC15","H2AC16","H2AC17","H2AC18","H2AC19","H2AC20","H2AC21","H2AC2P","H2AC3P","H2AC4",
    "H2AC5P","H2AC6","H2AC7","H2AC8","H2AC9P","H2AJ","H2AL1MP","H2AL1Q","H2AL3",
    "H2AP","H2AQ1P","H2AW","H2AX","H2AZ1","H2AZ2","MACROH2A1","MACROH2A2","H2BC1","H2BC10",
    "H2BC11","H2BC12","H2BC13","H2BC14","H2BC15","H2BC16P","H2BC17","H2BC18",
    "H2BC19P","H2BC20P","H2BC21","H2BC2P","H2BC3","H2BC4","H2BC5","H2BC6","H2BC7","H2BC8",
    "H2BC9","H2BK1","H2BL1P","H2BN1","H2BC12L","H2BU1","H2BU2P","H2BW1","H2BW2",
    "H2BW3P","H2BW4P","H3-7","H3-3A","H3-3B","H3-4","H3-5","H3C1","H3C10","H3C11","H3C12",
    "H3C13","H3C14","H3C15","H3C2","H3C3","H3C4","H3C5P","H3C6","H3C7","H3C8",
    "H3C9P","H3Y1","H3Y2","CENPA","H4-16","H4C1","H4C10P","H4C11","H4C12","H4C13","H4C14",
    "H4C15","H4C2","H4C3","H4C4","H4C5","H4C6","H4C7","H4C8","H4C9"),
    grep("^HIST", rownames(x), value=T)
)
integration.features <- setdiff(integration.features, masked.genes)
integration.anchors <- FindIntegrationAnchors(
    object.list = immune.list,
    anchor.features = integration.features,
    verbose = FALSE
)

immune.combined <- IntegrateData(anchorset = integration.anchors,
                                 verbose = FALSE)
DefaultAssay(immune.combined) <- "integrated"

immune.combined<-ScaleData(immune.combined, verbose = FALSE)
immune.combined<-RunPCA(immune.combined, npcs = 30, verbose = FALSE)
immune.combined<-RunUMAP(immune.combined, reduction = "pca", dims = 1:30, verbose = FALSE)
DefaultAssay(immune.combined) <- "integrated"
immune.combined<-FindNeighbors(immune.combined, verbose = F,dims = 1:30)
immune.combined<-FindClusters(immune.combined, resolution = c(0.3,0.5,0.7,0.9,1.2),verbose = F)
DimPlot(immune.combined, group.by='integrated_snn_res.0.3', label=T)
output_72_0.png
o(5*5, 5*3)
FeaturePlot(immune.combined, ncol=5,
features = c('CD3E','CD68','NKG7','CD4','CD8A',
             'TRAC','MS4A1','MS4A2','IGHG4','CD1C',
             'LILRA4','LAMP3','CD68','ITGAM','ITGAX')
)&theme(legend.position=c(0.8,0.8))&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_73_0.png
Idents(immune.combined)<-'integrated_snn_res.0.3'
immune.combined= RenameIdents(immune.combined,
             '6'='NK','12'='Mast',
             '2'='T CD4', '3'='T CD8', '5'='T',
             '0'='Mye','1'='Mye','4'='Mye','10'='Mye','8'='Mye',
             '9'='DC','11'='B','7'='Plasma'
            )
Idents(immune.combined) -> immune.combined[['integrated_ann']]
o(8,8)
DimPlot(immune.combined, group.by='integrated_ann')
output_76_0.png

split by batch

immune.list= SplitObject(immune.combined, split.by = 'sample_new')
names(immune.list)
  1. 'HC3'
  2. 'HC4'
  3. 'M1'
  4. 'M2'
  5. 'S1'
  6. 'S2'
  7. 'S3'
  8. 'S4'
  9. 'S5'
  10. 'S6'
for (i in 1:length(immune.list)) {
    DefaultAssay(immune.list[[i]]) <- 'RNA'
    immune.list[[i]] <- NormalizeData(immune.list[[i]], verbose = FALSE)
    immune.list[[i]] <- FindVariableFeatures(immune.list[[i]],
                                             selection.method = "vst",
                                             nfeatures = 2000, verbose = FALSE)
    immune.list[[i]] <- ScaleData(immune.list[[i]],
                                  features = VariableFeatures(immune.list[[i]]),
                                  verbose = F)
    immune.list[[i]] <- RunPCA(immune.list[[i]],npcs = 30, features = VariableFeatures(immune.list[[i]]), verbose = F)
    immune.list[[i]] <- RunUMAP(immune.list[[i]], dims = 1:30, verbose = F)
    immune.list[[i]] <- FindNeighbors(immune.list[[i]], dims = 1:30, verbose = F)
    immune.list[[i]] <- FindClusters(immune.list[[i]], dims = 1:30,resolution = c(0.1,0.3,0.5,0.7,0.9), verbose = F)

}
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”
Warning message:
“The following arguments are not used: dims”

per-sample annotation

HC3

# context switching
sample_name='HC3'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.7'

o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
output_83_0.png
# adopt integrated_ann first
seu@meta.data[, "persample_ann"] = as.character(seu@meta.data[, "integrated_ann"] )

DC

# DC markers
o(5*5, 5*3)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
            features = c('CST3','FCER1A','ITGAX',# pan DC
                         'LAMP3','CLEC9A',#cDC1
                         "CD1C",'HLA-DQA1',"PLD4",# cDC2
                         'LILRA4','LILRB4','IRF8','CCR7', #pDC
                         'CCL17','CLEC10A'#moDC
                        )
           )&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)

# 6 is cDC2
output_86_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.7==6))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC2'

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',#
'CCL18','PLTP','CD209','F13A1',#
'FABP4','RBP4','PPARG','MARCO', #
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1', #
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of ANGPTL4.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of MMP7.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of TIMP3.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of CXCL12.”
output_89_1.png
cell.sel = Cells(subset(seu, persample_ann=="Mye"))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, persample_ann=="T")) # wrong integration
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'
o(7,7)
DimPlot(seu, group.by='persample_ann', label=T)
output_91_0.png

T

# T cell markers
o(5*5, 5*6)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2','TRGC1','TRDC',
             "CD4",'CD8A','CD8B','RORC','FOXP3',
             'PRF1','GZMK','ID2','RORC','GATA3',
             'ZBTB16','IL7R','TBX21','NKG7','GNLY','EOMES','KLRB1',
             'TOX',"TOX2",'CXCR5','FCGR3B','CD68',
            'MT2A','CST7','HOPX','GZMM','KLRD1','KLRC2','KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_93_0.png
seu = FindSubCluster(seu, cluster="8",
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.7",  resolution = 1, algorithm = 1)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 80
Number of edges: 1953

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.2591
Number of communities: 3
Elapsed time: 0 seconds
group.by= 'RNA_snn_res.0.7'

o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
output_95_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.7=='8_2'))
seu@meta.data[cell.sel, "persample_ann"] = 'NK'

cell.sel = Cells(subset(seu, RNA_snn_res.0.7=='8_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'gdT'

cell.sel = Cells(subset(seu, RNA_snn_res.0.7=='8_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD8 cytotoxic T'

cell.sel = Cells(subset(seu, RNA_snn_res.0.7=='10'))
seu@meta.data[cell.sel, "persample_ann"] = 'NKT'
o(6,6)
DimPlot(seu, group.by='persample_ann', label=T)
output_97_0.png
sample_name
'HC3'
seu -> immune.list[[sample_name]]
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='8_1')
deg
A data.frame: 2227 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
TRDC1.839313e-1094.12959330.6470.0094.398902e-105
KRT81 3.658862e-501.29609270.2350.002 8.750534e-46
KLRD1 3.983541e-433.12431870.9410.071 9.527036e-39
KLRC2 3.357422e-392.82245030.7650.049 8.029610e-35
CD7 2.278602e-312.87858611.0000.111 5.449504e-27
XCL1 1.751611e-302.05974600.3530.013 4.189152e-26
ZNF683 1.425206e-251.68742490.6470.052 3.408522e-21
HOPX 2.550239e-252.36622590.8240.091 6.099152e-21
LINC01871 2.664493e-252.04197940.7650.076 6.372401e-21
KLRC1 6.528127e-242.96170890.7650.086 1.561267e-19
CCL5 7.207062e-243.31771141.0000.163 1.723641e-19
XCL2 6.118473e-221.76729230.4710.033 1.463294e-17
NKG7 1.475598e-202.33617710.8240.112 3.529039e-16
CD2 4.783042e-192.10885321.0000.171 1.143912e-14
GZMA 1.605923e-182.59840640.7650.107 3.840726e-14
CD3E 2.032856e-182.15126330.9410.162 4.861779e-14
KLRC4 2.782834e-181.15131410.2940.015 6.655426e-14
CCL4 2.310507e-172.40481400.7060.093 5.525808e-13
DMTN 2.349652e-170.77868610.1760.006 5.619427e-13
TRBC2 4.118310e-172.21460720.8240.133 9.849350e-13
AL109955.1 6.570097e-170.55748240.1180.002 1.571304e-12
ZNF853 8.032495e-170.57156610.1180.002 1.921051e-12
CD3D 9.561515e-172.72844451.0000.253 2.286732e-12
IL32 1.050927e-162.22382710.9410.171 2.513396e-12
CD3G 1.203798e-162.37745260.9410.199 2.879004e-12
CD96 1.813760e-161.74343390.5880.069 4.337790e-12
IKZF3 1.814254e-161.66266390.6470.083 4.338970e-12
GZMB 2.127995e-161.93070530.5880.068 5.089312e-12
GZMH 2.474445e-161.28214000.4120.033 5.917883e-12
CXCR3 7.771255e-161.75529470.4710.047 1.858573e-11
AKT10.98887360.56848790.2350.2991
MRPS220.98897260.57662570.1760.2151
PRPF310.98910480.52899350.2350.3021
PRPF38A0.98932310.67832540.2350.3051
CEBPZOS0.98971720.62302460.2940.4101
PHF110.99073430.77658310.2940.4051
MNAT10.99098540.58863250.1180.1311
SH3BP10.99279570.60313090.2940.3981
NOP140.99314800.46470510.1180.1331
KDM4C0.99328020.60761110.1760.2131
CCDC1260.99471330.38895980.1180.1321
HCFC20.99474500.52324090.1180.1331
PHC30.99613170.60846830.2940.3971
ZNF6550.99638180.64295290.3530.5241
TMEM1810.99672920.51485730.1760.2101
RNGTT0.99683750.43481300.1180.1331
PET1170.99683750.38142860.1180.1331
TMEM2670.99708790.37521580.1180.1311
MYCBP0.99761150.60602580.1760.2131
DDX270.99789520.74709430.2350.3011
MRPL480.99803750.49035770.1760.2101
FAM3A0.99804250.51114150.1760.2121
SPN0.99843960.92346620.4710.7861
SEPT90.99884710.96246080.3530.5201
ZC3H180.99890790.48918980.1760.2091
GLIPR10.99921600.27372840.4710.7321
SBF10.99973450.32607960.1180.1301
ZNF6050.99973610.34759130.1180.1321
NOP580.99980750.54866830.2350.2961
FOXJ31.00000000.55954410.1760.2131
deg%>% filter(pct.1>0.5)%>% arrange(desc(avg_log2FC))
A data.frame: 541 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
RNASE1 7.587222e-912.4912130.5040.042 1.814560e-86
MARCKS4.348613e-1242.4478830.8540.1111.040014e-119
CTSB 3.472279e-481.9708510.9920.809 8.304303e-44
FPR3 1.038331e-641.8722090.9510.428 2.483273e-60
C15orf48 1.971680e-081.8562680.6590.518 4.715470e-04
LGMN 1.839163e-551.7769680.5930.124 4.398543e-51
CTSL 1.655449e-051.7506850.7720.711 3.959173e-01
SOD2 6.726376e-111.7083850.6420.432 1.608680e-06
A2M 1.530249e-551.7042840.7970.266 3.659743e-51
SGK1 1.060017e-271.6277340.8050.495 2.535138e-23
MS4A6A 4.294375e-291.6257720.8130.490 1.027043e-24
MAFB 3.133365e-511.6024170.8540.358 7.493756e-47
TIMP1 2.238040e-081.5953110.7640.664 5.352497e-04
FGL2 3.458207e-461.5623220.7240.217 8.270648e-42
TMEM176B 5.851589e-771.4758760.7560.145 1.399466e-72
PMP22 1.056506e-811.4721760.7890.160 2.526741e-77
ZFP36L1 6.775244e-361.4139370.8940.468 1.620367e-31
LGALS1 2.060088e-421.3751541.0000.878 4.926908e-38
CD14 2.474328e-241.3571160.8540.601 5.917602e-20
GPNMB 3.849302e-141.3550890.9020.757 9.205992e-10
NPC2 6.904184e-441.3473471.0000.824 1.651205e-39
NEAT1 5.164746e-281.3431760.9840.940 1.235201e-23
CSF1R 2.139745e-331.3086030.8210.455 5.117413e-29
TMEM176A 3.710693e-881.3070350.6750.091 8.874495e-84
HIF1A 3.266683e-301.2761330.7320.348 7.812600e-26
TYMP 9.253753e-391.2584391.0000.853 2.213128e-34
TGFBI 1.700822e-291.2059180.8540.575 4.067687e-25
IER3 1.613880e-351.2022320.5930.174 3.859755e-31
PLA2G7 1.456169e-641.1512340.5200.074 3.482574e-60
KCTD12 8.749512e-321.1415220.9270.682 2.092533e-27
UPP17.613135e-030.26453070.7890.7231.0000000000
HLA-E4.844946e-070.26438890.9840.9610.0115871728
RPS6KA37.482350e-060.26388200.6670.5270.1789478818
HCLS12.542558e-050.26366970.7970.7110.6080780865
HSPA1B3.568896e-020.26269660.5120.4271.0000000000
CTNNB18.606003e-020.26180240.8700.7921.0000000000
FYB11.447037e-080.26154200.8370.7170.0003460734
FAM120A5.301785e-040.26057180.7070.6651.0000000000
ATP6V0D17.257155e-030.25905070.8700.7851.0000000000
LRP16.550845e-030.25865370.7720.7101.0000000000
PIK3AP11.906010e-030.25749110.5690.4981.0000000000
SCAMP23.942718e-030.25724980.6020.5611.0000000000
NDFIP14.934907e-050.25715150.7800.6841.0000000000
SRGN4.258241e-010.25589260.9920.9361.0000000000
AZIN11.115899e-040.25584830.5610.4461.0000000000
C5AR11.082796e-010.25553270.6020.6071.0000000000
TMBIM11.029257e-030.25548950.5770.4881.0000000000
SERINC12.605987e-030.25546930.7800.7091.0000000000
GRK26.228355e-040.25391990.6830.5881.0000000000
RASGEF1B4.858185e-020.25382850.6590.6151.0000000000
NONO3.257847e-040.25361140.6750.5901.0000000000
PRKAR1A2.256688e-040.25297330.8050.7271.0000000000
COTL12.218551e-020.25278230.9510.8701.0000000000
PTPN22.038384e-050.25229800.5930.4580.4875000367
WASHC42.959135e-040.25163600.7240.6331.0000000000
IVNS1ABP2.111707e-010.25092980.5770.5731.0000000000
PRDX31.373105e-040.25077810.7400.6771.0000000000
NUFIP21.795124e-030.25029610.6830.6281.0000000000
PSMD12.037263e-030.25018610.5200.4451.0000000000
SLC31A24.177946e-030.25003360.6020.5461.0000000000

HC4

# context switching
sample_name='HC4'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'

Idents(seu)<-group.by
seu= FindSubCluster(seu, cluster="4",
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.5, algorithm = 1)
Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='8',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.9, algorithm = 1)
Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='7',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.9, algorithm = 1)
Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='5',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.9, algorithm = 1)

o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 79
Number of edges: 1773

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6277
Number of communities: 2
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 25
Number of edges: 300

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.1113
Number of communities: 2
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 26
Number of edges: 325

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.1168
Number of communities: 2
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 57
Number of edges: 981

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.3327
Number of communities: 3
Elapsed time: 0 seconds
output_103_1.png
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='8_1', ident.2='8_0')
deg
A data.frame: 1882 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
LAMP31.486080e-063.34110911.0000.0000.03554109
CXCL101.486080e-062.84060581.0000.0000.03554109
TMEM131L1.486080e-061.19922541.0000.0000.03554109
IRF41.486080e-061.44802051.0000.0000.03554109
FSCN11.486080e-064.15475051.0000.0000.03554109
MTSS11.486080e-061.84491881.0000.0000.03554109
NMRK11.486080e-061.66015521.0000.0000.03554109
IL321.486080e-063.50702841.0000.0000.03554109
CCR71.486080e-064.96349201.0000.0000.03554109
MARCKS2.076844e-053.08363091.0000.0450.49669796
NFKB22.076844e-051.64029141.0000.0450.49669796
TRAFD12.076844e-051.83454781.0000.0450.49669796
TBC1D42.076844e-051.84864281.0000.0450.49669796
MGLL3.699350e-052.33990921.0000.0450.88473653
TNFRSF1B1.007985e-041.07228021.0000.0911.00000000
HLX1.007985e-041.67032391.0000.0911.00000000
COPB21.007985e-041.08375001.0000.0911.00000000
RASSF41.007985e-042.39903971.0000.0911.00000000
IL4I11.007985e-042.98574551.0000.0911.00000000
C22orf391.007985e-041.31109231.0000.0911.00000000
S1PR11.335349e-040.89839630.6670.0001.00000000
LAD11.335349e-042.11839570.6670.0001.00000000
TBC1D81.335349e-041.47586410.6670.0001.00000000
NRP21.335349e-041.26432620.6670.0001.00000000
MREG1.335349e-041.23225010.6670.0001.00000000
SFMBT11.335349e-040.85692520.6670.0001.00000000
PALLD1.335349e-041.50300300.6670.0001.00000000
ANKRD33B1.335349e-040.93897100.6670.0001.00000000
IL7R1.335349e-041.75702570.6670.0001.00000000
SMIM131.335349e-040.85692520.6670.0001.00000000
RTF10.80778780.42899120.3330.3641
GAA0.80778780.26873710.3330.3641
RTF20.80778780.28433690.3330.3641
PPP1R14A0.80778781.79589090.3330.3641
ORMDL20.82896630.26770900.3330.6361
MT-ND10.83440100.41045781.0001.0001
PLEK0.86499650.89753890.6670.6821
CREG10.88738780.35539760.3330.4091
MBNL10.88738780.90208710.3330.4091
TMEM2480.88738780.34382930.3330.4091
RAB8B0.88738780.50868800.3330.4091
TMEM970.88738780.51023180.3330.4091
SERPINA10.89422330.37803940.3330.5451
FLT30.89569170.75484890.3330.5911
LGALS90.90010170.33948491.0000.8641
ANXA20.90017820.32464471.0000.9551
PPDPF0.93225450.89304260.6670.6821
TFF30.96235110.26522160.3330.4091
GCA0.96328350.42683780.3330.4551
METTL90.96328350.56718980.3330.4551
FLOT20.96328350.26585520.3330.4551
MPC20.96464870.26473320.3330.5451
FIS10.96464870.36089980.3330.5451
PHPT10.96464870.42974900.3330.5451
SYF21.00000000.34200990.6670.7731
DENND1B1.00000000.38803150.3330.5001
CAPG1.00000000.86060610.3330.5001
RAMP11.00000001.56978410.3330.5001
OGFRL11.00000000.37373070.3330.4551
PMPCB1.00000000.63038580.3330.5001
# adopt integrated_ann first
seu@meta.data[, "persample_ann"] = as.character(seu@meta.data[, "integrated_ann"] )

DC

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','CLEC9A','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)

#8_0 is cDC1
#8_1 is also cDC1 (LAMP3+)
output_107_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC1'


cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC1'
# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_109_0.png
# pDC
p=Nebulosa::plot_density(seu,c('CLEC4C','IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)

# 7_1 is pDC
output_110_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='7_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'pDC'
# moDC
p=Nebulosa::plot_density(seu,c('CD14','CD1A','CD1C','FCER1A','CD1E'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)

# 5_1 is moDC
output_112_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'moDC'
# DC markers
o(5*5, 5*4)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
            features = c('CST3','FCER1A','ITGAX',# pan DC
                         'LAMP3','CLEC9A',#cDC1
                         "CD1C",'HLA-DQA1',"PLD4",# cDC2
                         'LILRA4','LILRB4','IRF8','CCR7', #pDC
                         'CCL17','CD163','CD14','FCER1A','CD1A','MRC1'#moDC
                        )
           )&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_114_0.png

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of ANGPTL4.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of MMP7.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of CXCL12.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of IGSF21.”
output_116_1.png
cell.sel = Cells(subset(seu, persample_ann=='Mye'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='11'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

T

# Treg
p=Nebulosa::plot_density(seu,c('CD3E','CD4','FOXP3'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_119_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='9'))
seu@meta.data[cell.sel, "persample_ann"] = 'Treg'
# CD8T
p=Nebulosa::plot_density(seu,c('CD3E','CD8A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_121_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD8 cytotoxic T'
gene_name= "SELL"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CCR7"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD28"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD44"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "IL2RA"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD69"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence
# Tcm
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7','CD28'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_124_0.png
# Tem
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7_lo','CD28'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_125_0.png
# Trm
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7_lo','ITGAE','CD69'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_126_0.png
# Naive T
p=Nebulosa::plot_density(seu,c('CD3E','CCR7','SELL',"IL2RG",'IL7R',
                               'CD44_lo','IL2RA_lo','CD69_lo'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*2)
p+plot_layout(ncol = 6)
output_127_0.png
# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_128_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='1'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD4 T'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD4 T'
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_130_0.png
sample_name
'HC4'
seu -> immune.list[[sample_name]]

M1

# context switching
sample_name='M1'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'

Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='8',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.5, algorithm = 1)

o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 144
Number of edges: 3299

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.7271
Number of communities: 3
Elapsed time: 0 seconds
output_134_1.png
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='11')
deg
A data.frame: 1579 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
KIR3DL2 0.000000e+002.17861660.7540.010 0.000000e+00
KIR2DL47.685209e-1751.91907360.7050.0251.837995e-170
KLRC31.529893e-1431.66335490.7380.0343.658891e-139
TRBV5-52.112813e-1393.02890440.4920.0145.053004e-135
SPRY29.378084e-1270.99215560.3770.0082.242863e-122
TRAV256.896820e-1172.00378330.4430.0141.649443e-112
FCRL66.902333e-1121.70008090.7050.0461.650762e-107
LINC024461.032828e-1113.28928720.8690.0752.470111e-107
NCR12.124001e-1020.90029650.4100.014 5.079762e-98
KLRC22.754229e-1011.09673240.4750.020 6.587015e-97
IFNG 3.047808e-961.58624650.5410.029 7.289137e-92
KLRC1 3.563628e-932.87845050.9840.126 8.522774e-89
ADRB1 5.369798e-830.50390730.2130.003 1.284241e-78
DRAIC 6.229063e-800.58373370.1800.002 1.489743e-75
CD160 7.357007e-750.97162110.3280.012 1.759502e-70
KIR2DL1 3.456413e-740.35055730.1640.002 8.266358e-70
KLRD1 3.171592e-712.20335470.9510.145 7.585178e-67
CAPN12 2.573811e-640.99347550.4750.034 6.155526e-60
SCUBE1 3.370731e-620.71670250.2790.011 8.061439e-58
GPR25 1.599348e-611.78198960.8200.117 3.825002e-57
HOPX 1.267855e-572.63470990.9510.206 3.032201e-53
ZNF683 2.341302e-552.22925510.8200.134 5.599458e-51
STYK1 1.076758e-530.56683200.2620.011 2.575175e-49
CD7 3.397787e-532.76373160.9840.265 8.126147e-49
DAPK2 3.525029e-520.96671800.4430.037 8.430458e-48
TRBV12-4 4.112478e-502.82662720.2790.015 9.835403e-46
CCL5 1.865935e-493.03440241.0000.347 4.462571e-45
CLNK 2.443463e-490.78354520.2950.017 5.843787e-45
SIRPG 2.734644e-481.07402050.4750.047 6.540174e-44
TIGIT 4.644428e-481.53001630.6230.083 1.110761e-43
EIF4G30.88785340.28856560.2460.2921
ARFGEF10.89086250.25393400.2790.3581
MOSPD30.89157360.28340910.2460.2941
NOB10.89168080.26729590.2460.3061
ZRANB20.89447360.30371540.4750.6681
RAE10.90021710.25320870.1970.2221
SUPT6H0.90505410.34451440.3110.3841
TSPAN170.90795540.29179750.1480.1751
INPP5F0.91203300.27008330.1640.1831
KPNA40.92260170.27492240.3280.4221
PRPF38A0.93060650.25638150.2790.3551
SLC25A320.93098160.32560830.2460.2901
CERS20.93123470.27983720.2620.3181
GIGYF20.93239670.27236750.2620.3311
SF3B30.94244170.26345040.2790.3341
GPS20.94986730.29582020.2460.2991
CALCOCO10.95245690.26333170.2950.3871
LCMT10.95327970.31338210.3110.3991
ICE10.95936370.28747440.3110.3871
HIF1AN0.96025180.26930530.2130.2491
FOXN20.96368800.25647590.3280.4151
COPB20.96451160.29078650.3770.4941
SMC50.96466970.28347780.2790.3401
PTPRJ0.97530700.34920270.2790.3491
PSENEN0.97602210.27364220.3610.4861
PCF110.98277110.26749320.3440.4421
LTBP30.99354870.26815300.1800.2131
ITCH0.99357280.27287800.2620.3281
DMAP10.99583750.25970090.2130.2541
CDK130.99776420.26618890.2620.3241
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='12')
deg
A data.frame: 1748 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
KIF2C 0.000000e+001.17561040.6750.004 0.000000e+00
ASPM 0.000000e+002.29445590.8000.004 0.000000e+00
RRM2 0.000000e+001.45864860.7250.001 0.000000e+00
NCAPH 0.000000e+001.18230670.7750.007 0.000000e+00
CKAP2L 0.000000e+001.26364630.7750.005 0.000000e+00
SPC25 0.000000e+000.76619320.5500.001 0.000000e+00
HJURP 0.000000e+000.99331270.5750.000 0.000000e+00
MND1 0.000000e+001.13127300.6750.005 0.000000e+00
HIST1H3B 0.000000e+001.71448750.5500.000 0.000000e+00
HIST1H3C 0.000000e+001.88819870.5500.002 0.000000e+00
E2F8 0.000000e+000.80695180.4500.000 0.000000e+00
FAM111B 0.000000e+001.34877020.5500.002 0.000000e+00
MKI67 0.000000e+002.88730810.9500.010 0.000000e+00
FOXM1 0.000000e+000.78906750.6750.001 0.000000e+00
DLGAP5 0.000000e+001.25346870.6250.001 0.000000e+00
PKMYT1 0.000000e+001.22207610.6750.002 0.000000e+00
AURKB 0.000000e+001.22785470.7000.004 0.000000e+00
TOP2A 0.000000e+002.08924300.8750.006 0.000000e+00
BIRC5 0.000000e+001.78966020.7750.002 0.000000e+00
UBE2C 0.000000e+002.50203450.8500.005 0.000000e+00
UHRF1 0.000000e+001.38467170.7000.005 0.000000e+00
GTSE1 0.000000e+001.35175170.7250.002 0.000000e+00
PCLAF1.243897e-3041.43319090.7500.0072.974905e-300
ANLN1.209459e-3010.75822070.5750.0032.892542e-297
DIAPH39.136409e-2870.68419520.5250.0022.185063e-282
HIST1H3G1.002493e-2861.04882530.4750.0012.397561e-282
CCNA22.029321e-2861.79971240.8250.0114.853325e-282
CDCA31.409632e-2811.30137400.7000.0073.371275e-277
CDCA56.624292e-2751.11815550.6500.0061.584266e-270
HIST1H1B3.870409e-2702.38226080.7000.0089.256470e-266
TRIAP10.071433050.25595780.4750.3961
IPO70.072385710.34642080.5000.4431
PNPT10.073696730.33405460.6750.6251
IMPDH10.074077550.33159270.4750.3961
HNRNPH30.074124380.25423570.7250.6291
ERLEC10.080238600.36758750.7000.5641
CASP70.083624300.28776060.4000.3171
TARBP10.092543280.29483950.3000.2091
TSG1010.095617190.25325950.6250.5221
PKM0.102643820.34236920.9500.8311
MT-ND40.104808020.36585940.9500.8371
ITGB10.107907810.43135610.7750.7501
YTHDC20.119194970.25250550.3250.2471
ENTPD10.149367890.29931960.2750.2121
RDX0.151778060.30305740.4000.3711
UBA70.176640170.27617170.4750.4171
RSRC10.182614790.31938640.4500.3951
LYAR0.189741050.27050670.5250.4801
UBE2J10.192170760.32882770.5500.5141
IBTK0.201718590.28038210.4250.3821
PHPT10.205449180.29364160.8000.7091
MAT2A0.207565840.27453340.6250.5921
ABI30.238758290.28834570.6750.5911
CLN60.240755880.27285460.2500.2021
ID30.251459140.27858420.3250.2711
WDFY10.258166930.26583220.5000.4571
ATF10.293106080.27544230.3000.2541
SLC25A260.345364380.26171540.2500.2101
TRGV70.784234510.36065470.1000.1221
NOC3L0.981340100.31913810.3000.3391
# adopt integrated_ann first
seu@meta.data[, "persample_ann"] = as.character(seu@meta.data[, "integrated_ann"] )
o(10,10)

DimPlot(seu,
        group.by='RNA_snn_res.0.9',label=T,  cols=manymanycolors)
output_138_0.png

DC

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','CLEC9A','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_140_0.png
# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_141_0.png
# pDC
p=Nebulosa::plot_density(seu,c('CLEC4C','IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_142_0.png
# moDC
p=Nebulosa::plot_density(seu,c('CD14','CD1C','FCER1A','CD1E'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_143_0.png
# DC markers
o(5*5, 5*4)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
            features = c('CST3','FCER1A','ITGAX',# pan DC
                         'LAMP3','CLEC9A',#cDC1
                         "CD1C",'HLA-DQA1',"PLD4",# cDC2
                         'LILRA4','LILRB4','IRF8','CCR7', #pDC
                         'CCL17','CD163','CD14','FCER1A','CD1A','MRC1'#moDC
                        )
           )&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CST3", :
“All cells have the same value (0) of CD1A.”
output_144_1.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC1'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_2'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC1'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC2'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='13'))
seu@meta.data[cell.sel, "persample_ann"] = 'pDC'

Mac

o(8,8)
FeaturePlot(seu,features = 'S100A12',order=T)
output_149_0.png
# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_150_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='0'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='1'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='7'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='6'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='9'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_152_0.png

T

# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1','KLRB1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_154_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='10'))
seu@meta.data[cell.sel, "persample_ann"] = 'NK'
# Treg
p=Nebulosa::plot_density(seu,c('CD3E','CD4','FOXP3'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_156_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='15'))
seu@meta.data[cell.sel, "persample_ann"] = 'Treg'
# CD8T
p=Nebulosa::plot_density(seu,c('CD3E','CD8A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_158_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD8 T'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='3'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD8 T'
gene_name= "SELL"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CCR7"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD28"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD44"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "IL2RA"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD69"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence
# Tcm
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7','CD28'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_161_0.png
# Tem
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7_lo','CD28'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_162_0.png
# Trm
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7_lo','ITGAE','CD69'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_163_0.png
# Naive T
p=Nebulosa::plot_density(seu,c('CD3E','CCR7','SELL',"IL2RG",'IL7R',
                               'CD44_lo','IL2RA_lo','CD69_lo'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*2)
p+plot_layout(ncol = 6)
output_164_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD4 T'
o(10,10)
DimPlot(seu, group.by='persample_ann', label=T)
output_166_0.png
seu =subset(seu, persample_ann!='T')
o(5,5)
DimPlot(seu, group.by='persample_ann', label=T)
output_168_0.png
sample_name
'M1'
seu -> immune.list[[sample_name]]

M2

# context switching
sample_name='M2'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'

Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='2',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.6, algorithm = 1)

Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='8',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.3, algorithm = 1)


o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 343
Number of edges: 11264

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6580
Number of communities: 4
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 89
Number of edges: 2252

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.7087
Number of communities: 2
Elapsed time: 0 seconds
output_172_1.png

DC

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','CLEC9A','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_174_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC1'
# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_176_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2_2'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC2'
# pDC
p=Nebulosa::plot_density(seu,c('CLEC4C','IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)

# 11 is pDC
output_178_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='11'))
seu@meta.data[cell.sel, "persample_ann"] = 'pDC'
# moDC
p=Nebulosa::plot_density(seu,c('CD14','CD1A','CD1C','FCER1A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)

# 5_1 is moDC
output_180_0.png
# DC markers
o(5*5, 5*4)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
            features = c('CST3','FCER1A','ITGAX',# pan DC
                         'LAMP3','CLEC9A',#cDC1
                         "CD1C",'HLA-DQA1',"PLD4",# cDC2
                         'LILRA4','LILRB4','IRF8','CCR7', #pDC
                         'CCL17','CD163','CD14','FCER1A','CD1A','MRC1'#moDC
                        )
           )&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_182_0.png

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_184_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='0'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='1'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2_3'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='7'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

T

# Treg
p=Nebulosa::plot_density(seu,c('CD3E','CD4','FOXP3'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_187_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='12'))
seu@meta.data[cell.sel, "persample_ann"] = 'Treg'
o(8,7);DimPlot(seu, group.by='RNA_snn_res.0.9', label=T, repel=T, pt.size=0.1)
output_189_0.png
# CD8T
p=Nebulosa::plot_density(seu,c('CD3E','CD8A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_190_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD8 cytotoxic T'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='6'))
seu@meta.data[cell.sel, "persample_ann"] = 'CD8 cytotoxic T'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'NK'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'gdT'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='9'))
seu@meta.data[cell.sel, "persample_ann"] = 'gdT'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='10'))
seu@meta.data[cell.sel, "persample_ann"] = 'T cycling'
gene_name= "SELL"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CCR7"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD28"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD44"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "IL2RA"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence

gene_name= "CD69"
penalty = 4
expr    = seu@assays$RNA@data[gene_name,]
absence = exp(-expr*penalty)
seu@meta.data[, paste(gene_name,'lo',sep='_')] = absence
# Tcm
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7','CD28'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_197_0.png
# Tem
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7_lo','CD28'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_198_0.png
# Trm
p=Nebulosa::plot_density(seu,c('SELL_lo','CD44','CCR7_lo','ITGAE','CD69'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_199_0.png
# Naive T
p=Nebulosa::plot_density(seu,c('CD3E','CCR7','SELL',"IL2RG",'IL7R',
                               'CD44_lo','IL2RA_lo','CD69_lo'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*2)
p+plot_layout(ncol = 6)
output_200_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='3'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD4'
# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_202_0.png
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_203_0.png
sample_name
'M2'
seu -> immune.list[[sample_name]]

S1

# context switching
sample_name='S1'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'

Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='13',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.6, algorithm = 1)

Idents(seu) <- group.by
seu=FindSubCluster(seu, cluster='7',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.3, algorithm = 1)
Idents(seu) <- group.by
seu=FindSubCluster(seu, cluster='8',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.3, algorithm = 1)
Idents(seu) <- group.by
seu=FindSubCluster(seu, cluster='9',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.6, algorithm = 1)

o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5, cols=manymanycolors),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 59
Number of edges: 1324

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.4189
Number of communities: 2
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 506
Number of edges: 19986

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.8011
Number of communities: 2
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 306
Number of edges: 6459

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.7849
Number of communities: 3
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 188
Number of edges: 6357

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6383
Number of communities: 2
Elapsed time: 0 seconds
output_207_1.png
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='10')
deg
A data.frame: 635 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
PPP1R14A 0.000000e+001.38609380.2280.002 0.000000e+00
RAMP11.771237e-2230.88065620.1790.0024.236090e-219
CCR71.398171e-2151.69167400.3270.0123.343866e-211
CST72.355882e-2032.81962220.8020.0925.634328e-199
FLT31.009736e-1930.76339650.1790.0032.414885e-189
CALCRL1.160217e-1400.77501710.1540.0042.774774e-136
CLECL14.778446e-1281.35855890.4320.0401.142813e-123
CLEC9A6.639978e-1230.83276810.1170.0021.588017e-118
CD1C1.240497e-1180.70745240.1230.0032.966772e-114
SPIB8.564295e-1130.42720580.1110.0022.048237e-108
TSPAN131.800130e-1070.75149040.1420.0044.305191e-103
NR4A38.130870e-1072.18799980.6300.1051.944579e-102
PPA1 2.487502e-992.32655310.8520.234 5.949110e-95
NAPSA 9.628646e-980.81837010.2780.021 2.302787e-93
PKIB 1.211395e-930.95194110.1670.007 2.897172e-89
LAMP3 1.681934e-921.49737740.3830.042 4.022513e-88
SLC7A11 3.276422e-920.84107330.2160.013 7.835890e-88
CD74 5.829569e-811.83310871.0000.979 1.394200e-76
PLD4 8.757507e-810.66220970.2040.013 2.094445e-76
HLA-DPA1 9.610619e-772.12838950.9940.838 2.298476e-72
HLA-DQA1 5.000631e-742.32516150.9810.578 1.195951e-69
HLA-DQB1 3.415336e-712.18929170.9630.631 8.168117e-67
HLA-DPB1 2.748996e-692.11049860.9810.734 6.574499e-65
MCOLN2 1.115486e-680.95229980.3020.035 2.667797e-64
S100B 7.161458e-681.73450590.2280.020 1.712734e-63
GPR183 1.318950e-651.81143480.6980.197 3.154400e-61
SERPINF1 2.122574e-650.71179110.1910.015 5.076347e-61
HLA-DRA 1.079023e-641.48033081.0000.925 2.580592e-60
SPINT2 2.067103e-631.27162870.5000.100 4.943684e-59
HLA-DRB1 1.134360e-551.55007850.9940.899 2.712936e-51
EIF5A0.0014615010.25232580.3640.2511
NUDT210.0022671450.25630240.2100.1271
RIPK20.0022717230.25704100.3770.2721
CTSH0.0023322760.32723700.5250.3891
ARFGAP30.0024421040.29002720.3770.2631
TNFSF13B0.0027791280.38280210.7840.7641
TTC30.0029011690.28127900.1670.0971
GPBP10.0029459970.28715550.4380.3171
GTF2B0.0030513150.27773460.3890.2771
BATF30.0030726040.26516120.1600.0931
HIVEP10.0031926950.25164750.1790.1071
REV3L0.0038494440.35787000.1170.0631
RASGRP30.0040608560.26591650.1730.1031
ATRX0.0042355290.29306510.2960.2041
SRSF100.0043674010.25969440.3460.2451
MOB1A0.0043944630.28414300.7040.5901
MTRNR2L120.0045584150.44990880.5860.4771
RAB310.0051877740.25040690.6360.5341
SEC14L10.0061463120.30747610.3210.2341
ARID1B0.0074560750.25325070.1910.1211
IL7R0.0080693670.43707040.2780.1971
SMC60.0095048770.37185050.1300.0761
A2M0.0138314550.41761590.1540.0971
ENPP20.0141844980.25718530.1790.1171
CPVL0.0157720360.40066980.2960.2191
ROCK10.0165259520.30057880.3700.2851
MPC20.0194651110.26712670.1540.1011
CCL4L20.0373203840.40970750.4440.5391
CXCL100.1255031610.27646560.7960.7501
MRPS60.5443911030.25353960.2350.2141
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='13_0')
deg
A data.frame: 1143 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
AFF3 0.000000e+001.21158570.2200.000 0.000000e+00
MS4A1 0.000000e+003.74311530.7560.003 0.000000e+00
LINC02397 0.000000e+001.06326170.2440.000 0.000000e+00
IGHG2 0.000000e+001.28812850.2200.000 0.000000e+00
CD19 0.000000e+001.85107010.3410.002 0.000000e+00
TNFRSF13B 0.000000e+001.32575180.2930.001 0.000000e+00
CD79A 0.000000e+003.31118570.7560.002 0.000000e+00
VPREB3 0.000000e+001.46661570.2440.000 0.000000e+00
TCL1A5.278945e-3000.84026170.1460.0001.262512e-295
FCRL57.120031e-2421.41007430.2440.0011.702827e-237
AICDA7.452311e-2380.79601200.1710.0001.782295e-233
IGHA22.369602e-2043.06850510.2200.0015.667140e-200
IGKC7.818693e-1962.15525640.4630.0081.869919e-191
AC104699.13.749182e-1900.71621950.1710.0018.966545e-186
BANK11.025332e-1841.76052030.3900.0062.452185e-180
FAM177B1.250574e-1820.82329540.1220.0002.990872e-178
IGKV3-111.975303e-1822.69906140.1220.0004.724136e-178
FCRLA4.677210e-1381.09317310.2200.0021.118601e-133
FAM30A1.054888e-1210.57214020.1220.0012.522869e-117
SPIB3.390754e-1141.24020580.2200.0038.109328e-110
COBLL11.833266e-1090.84234470.1710.0024.384438e-105
IGHM4.471128e-1081.64181200.3660.0101.069315e-103
PAX5 1.674020e-991.70321220.3660.010 4.003587e-95
TLR10 2.765995e-971.09552620.2200.004 6.615154e-93
BCAS4 2.177607e-961.27953840.2680.006 5.207965e-92
PKIG 2.248644e-920.84844170.1950.003 5.377856e-88
POU2AF1 2.549768e-920.89424480.1950.003 6.098025e-88
PAWR 2.390783e-910.83934890.1220.001 5.717798e-87
CPNE5 9.771284e-890.79768150.1710.002 2.336900e-84
IGHA1 3.226581e-875.06595070.3900.014 7.716690e-83
WBP110.87848850.30232140.1460.1481
SRP540.88249980.25431750.1950.2001
MRPS340.88427760.29213820.1220.1241
MDH20.88637750.25272310.1950.2151
LMAN10.88704310.29139150.1460.1561
MRPL540.88867070.27290180.2440.2591
SYNRG0.88927950.28227260.1220.1221
CYCS0.89242290.31009140.3170.3521
PRKAR1A0.89257520.28952730.2680.2911
ITPA0.90004580.28399730.0980.1081
PTBP30.90532890.28478440.2440.2591
CDC400.90848880.33014330.1220.1271
SLC38A100.90981170.25332070.1220.1211
SP140L0.93000220.30734020.1460.1521
KLF20.93637920.51397820.3410.4131
IMPA10.93993410.27773910.0980.1011
C22orf390.94340740.46170120.1220.1261
MFSD100.94465360.34307830.1220.1311
RAD210.94671650.36006320.2200.2351
IK0.95177850.28360800.1950.2231
PHB0.95453960.26209560.1710.1771
YIPF40.96172870.26573720.1220.1301
HEBP20.96389750.25221160.1220.1291
BIN20.96823380.39600810.1220.1251
NIPBL0.98028390.36129510.1710.1871
HIST1H1E0.98533310.28640330.1220.1311
UTRN0.98736070.31820800.1950.2141
STMP10.99011390.30105910.2930.3361
ZSWIM70.99708980.31831000.0980.1061
BBX0.99962460.39387590.1460.1551
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='13_1')
deg
A data.frame: 1371 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
FCRL5 0.000000e+001.18819360.4440.001 0.000000e+00
IGKC 0.000000e+007.82312290.8890.008 0.000000e+00
JCHAIN 0.000000e+006.74054270.9440.006 0.000000e+00
PKHD1L1 0.000000e+000.68669120.2220.000 0.000000e+00
POU2AF1 0.000000e+002.03261000.5560.003 0.000000e+00
IGHA2 0.000000e+005.08358640.5560.001 0.000000e+00
AC012236.1 0.000000e+001.59071900.3890.000 0.000000e+00
TNFRSF17 0.000000e+001.55103590.5000.000 0.000000e+00
IGLL5 0.000000e+003.91905400.5560.001 0.000000e+00
LINC019261.043143e-2660.32807610.1110.0002.494780e-262
BVES-AS11.043143e-2660.74581550.1110.0002.494780e-262
AC007569.15.378706e-2660.88652560.2220.0001.286371e-261
FCRL21.750770e-2550.93027520.2780.0014.187142e-251
MZB11.029777e-2513.21719500.6670.0062.462815e-247
IGHV4-345.123408e-2397.52250240.5000.0031.225314e-234
DERL39.545504e-2182.03712760.4440.0032.282903e-213
JSRP11.280165e-2071.08102510.2780.0013.061643e-203
IGHA11.563382e-2057.85721940.8890.0143.738983e-201
CPNE51.058052e-2021.17778270.3890.0022.530437e-198
IGKV3D-112.892416e-1781.79930920.1110.0006.917502e-174
IGKV1D-393.354562e-1780.31810030.1110.0008.022770e-174
MEF2B6.923225e-1640.51754820.2220.0011.655758e-159
TNFRSF13B4.568852e-1580.93141970.2780.0011.092687e-153
IGKV3-112.427840e-1506.78208650.1670.0005.806423e-146
AC104699.14.629948e-1420.72652430.2220.0011.107298e-137
IGKV3D-205.311957e-1341.87565090.1110.0001.270408e-129
GLDC5.615501e-1340.38427390.1110.0001.343003e-129
IGHV3-235.615501e-1341.50257220.1110.0001.343003e-129
CCR104.538863e-1331.15491530.2780.0021.085515e-128
CD79A1.122913e-1191.49197310.3890.0042.685558e-115
LARP40.52839490.25097290.1670.1231
PSME30.53135830.26710170.1670.1231
SELENOF0.53263780.25615850.3890.3501
GLRX20.53632040.26086220.2220.1591
HMGN20.54772800.38001250.6110.6041
ZNF220.57800300.46733630.1110.0781
COX140.57898040.31935040.2780.2311
CARD60.59248710.26468820.1110.0801
CRYBG10.61603510.25799120.2220.1701
UBE2W0.62499130.35638000.1110.0851
IST10.63293680.30591140.2220.1941
LUC7L20.63394380.30718570.1110.0851
MTRNR2L80.63469780.44501030.1110.0871
SETX0.63615290.33350270.2780.2431
EEF1B20.64946880.54730600.5000.5341
PPP1R15A0.64972000.31964230.5560.5201
TRIM330.66044630.42887450.2220.1861
MALAT10.69299810.43365761.0000.9991
PSMD20.78747230.25328330.1670.1511
CHCHD10.79487850.30064260.1670.1571
PSMC60.81203580.44124370.2220.2161
CCT20.83275200.27688120.1670.1931
GAPDH0.84192100.25822460.8890.9321
GLO10.85108260.39459170.1110.1351
MOSPD20.88617150.46062230.1110.1061
LUCAT10.89451240.26009940.1110.1091
RNF1380.89596360.26353420.1110.1331
UTP60.89842910.31706110.1110.1111
SELPLG0.90478580.48073030.2220.2411
ECPAS0.98103460.27172880.1110.1241
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='13_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'B'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='13_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'Plasma'

DC

# pDC
p=Nebulosa::plot_density(seu,c('IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','CLEC9A','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)


# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_213_0.png output_213_1.png output_213_2.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='10'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC1'

T

# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_216_0.png
# Treg
p=Nebulosa::plot_density(seu,c('CD3E','CD4','FOXP3'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()

o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_217_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='7_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD4'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD4'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='7_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_2'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='11'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'gdT'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='9_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'gdT'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='9_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'gdT'

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_222_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='0'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='1'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='3'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='6'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='12'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_224_0.png
seu -> immune.list[[sample_name]]

S2

# context switching
sample_name='S2'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'

Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='16',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.6, algorithm = 1)

Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='10',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.2, algorithm = 1)


o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5, cols=manymanycolors),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 88
Number of edges: 1758

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6406
Number of communities: 2
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 249
Number of edges: 7040

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.8000
Number of communities: 1
Elapsed time: 0 seconds
output_227_1.png
# adopt integrated_ann first
seu@meta.data[, "persample_ann"] = as.character(seu@meta.data[, "integrated_ann"] )
o(5*5, 5*3)
FeaturePlot(seu, ncol=5,
features = c('CD3E','CD68','NKG7','CD4','CD8A',
             'TRAC','MS4A1','MS4A2','IGHG4','CD1C',
             'LILRA4','LAMP3','CD68','ITGAM','ITGAX')
)&theme(legend.position=c(0.8,0.8))&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_229_0.png

DC

# pDC
p=Nebulosa::plot_density(seu,c('IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','CLEC9A','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)


# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_231_0.png output_231_1.png output_231_2.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='16_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC1'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='16_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'pDC'

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_234_0.png
cell.sel = Cells(subset(seu, persample_ann=='Mye'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

T

# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_237_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='11'))
seu@meta.data[cell.sel, "persample_ann"] = 'NK'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='17'))
seu@meta.data[cell.sel, "persample_ann"] = 'NK'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='13'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_240_0.png
seu -> immune.list[[sample_name]]

S3

# context switching
sample_name='S3'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'

o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5, cols=manymanycolors),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
output_243_0.png
o(10,5)
FeaturePlot(seu, pt.size=0.1, features = c('CXCR2','FCGR3B'))
output_244_0.png
# adopt integrated_ann first
seu@meta.data[, "persample_ann"] = as.character(seu@meta.data[, "integrated_ann"] )
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='0'))
seu@meta.data[cell.sel, "persample_ann"] = 'Neu'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='1'))
seu@meta.data[cell.sel, "persample_ann"] = 'Neu'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='6'))
seu@meta.data[cell.sel, "persample_ann"] = 'Neu'
1
1
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1=c('0','1','6'), ident.2=c('2','3','4','5'))
deg
A data.frame: 732 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
IFITM25.804710e-1163.90109600.9830.8821.388254e-111
H3F3A8.075636e-1072.56582890.9890.8821.931369e-102
IFITM32.948642e-1032.14786940.9940.978 7.051973e-99
H3F3B7.633565e-1022.42037570.9970.947 1.825643e-97
NAMPT 6.027546e-982.57737160.9750.812 1.441548e-93
FCGR3B 2.895525e-954.32139190.8080.106 6.924938e-91
IFITM1 2.945446e-852.63437620.9770.865 7.044328e-81
NEAT1 1.885165e-841.79676720.9920.836 4.508561e-80
SRGN 9.004459e-811.86114040.9720.957 2.153506e-76
CARD16 5.790015e-762.39232710.9130.725 1.384740e-71
SAT1 2.631055e-722.06466600.9940.998 6.292430e-68
S100A8 2.265413e-683.24078890.9240.611 5.417961e-64
LITAF 6.258092e-672.01140090.9100.841 1.496685e-62
HCAR3 1.700792e-664.13611800.6420.087 4.067614e-62
TAOK1 8.235967e-641.34449901.0000.988 1.969714e-59
ANP32A 1.540944e-633.24807190.7610.343 3.685322e-59
HLA-C 2.109675e-631.03098400.9920.986 5.045500e-59
S100A9 2.444295e-622.54091150.9180.732 5.845775e-58
CSF3R 3.184975e-593.24549660.7440.348 7.617186e-55
FPR1 2.008789e-582.71787190.7490.326 4.804220e-54
MXD1 6.786446e-572.60812470.7830.476 1.623046e-52
HLA-E 4.568255e-561.20812700.9770.952 1.092544e-51
G0S2 2.787460e-532.67294350.7690.324 6.666489e-49
B2M 7.264078e-520.68154841.0000.998 1.737277e-47
RNF213 7.952964e-511.61871860.8990.809 1.902031e-46
IFIT3 9.238463e-491.93023880.9100.829 2.209471e-44
IFIT2 3.064961e-462.45653070.8760.783 7.330160e-42
HCAR2 4.730504e-463.20521170.4900.060 1.131347e-41
ISG20 1.728222e-441.80543010.8680.742 4.133216e-40
PLEK 3.096812e-441.79795360.8870.821 7.406337e-40
TBC1D70.73474280.91588640.2000.2321
PIM30.73529750.41681750.4730.7131
SLC20A10.74097011.00137080.2140.2801
ZNF2920.74692310.57041030.0960.1141
OAS10.74733710.27991510.5180.7851
RBCK10.75275270.95520650.3130.4521
MCL10.75998160.47680130.4560.7101
CLEC4A0.77006500.69645730.1150.1211
BATF20.77937550.60062010.1040.1231
FCGR3A0.78626300.72851760.3610.5121
LYSMD20.79815060.85523690.2930.4151
WIPF10.81365280.77728680.3720.5721
ARID4B0.83987261.03279840.3070.4201
GNG100.84198700.86363960.1940.2291
NFE2L20.85046260.53347890.4960.7511
LILRB30.88510050.85688380.3610.5171
GBP30.89298551.18146200.2450.3211
AC116366.30.89810180.91706570.2030.2441
AL645608.80.90260630.67226610.0960.1091
IGSF60.90385170.70396210.4540.6711
IRF20.90520590.73530760.3830.5631
DDAH20.91136491.00052300.2790.3821
GBP20.92742090.70208010.4000.5751
SP1000.94118850.67511310.4030.6281
HELB0.94660450.65742900.0930.1041
AIM20.94976960.82017390.1520.1791
SAMSN10.96144600.53623010.4200.5891
ZNFX10.97194980.80523030.3630.5391
TFEC0.97835530.70307950.4060.6141
TIMM100.99413550.89522880.1490.1741

T

# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD3D", :
“All cells have the same value (0) of FOXP3.”
output_250_1.png

DC

# pDC
p=Nebulosa::plot_density(seu,c('IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)


# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_253_0.png output_253_1.png output_253_2.png
o(5,5)
FeaturePlot(seu, features='ITGAX')
output_254_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='3'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4'))
seu@meta.data[cell.sel, "persample_ann"] = 'cDC1'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_256_0.png

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of MMP7.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of RBP4.”
output_258_1.png
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_259_0.png
sample_name
'S3'
seu -> immune.list[[sample_name]]

S4

# context switching
sample_name='S4'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'


Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='4',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.5, algorithm = 1)
Idents(seu)<-group.by
seu=FindSubCluster(seu, cluster='5',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.5, algorithm = 1)


o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5, cols=manymanycolors),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 115
Number of edges: 3298

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.5600
Number of communities: 2
Elapsed time: 0 seconds
output_263_1.png
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='5_1')
deg
A data.frame: 1874 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
SKA14.529413e-1841.06167950.680.0011.083254e-179
CDCA22.247430e-1400.80817100.560.0025.374953e-136
ASPM2.347815e-1350.94334700.600.0035.615035e-131
DEPDC1B3.030864e-1350.96665700.600.0037.248614e-131
MYBL21.725129e-1331.27245590.640.0054.125818e-129
GTSE12.940315e-1281.08856970.600.0047.032057e-124
RRM21.173571e-1161.37165020.640.0072.806712e-112
CENPM1.739824e-1141.57212720.840.0184.160964e-110
MKI672.385092e-1102.12711770.680.0105.704186e-106
TOP2A1.137415e-1091.61449420.680.0102.720242e-105
BIRC58.019417e-1031.46681630.720.014 1.917924e-98
CKAP2L2.381192e-1010.75109600.520.005 5.694859e-97
AURKB 3.183241e-960.73400590.520.005 7.613038e-92
DLGAP5 1.050986e-950.78172850.400.002 2.513539e-91
CD70 2.967132e-951.33768310.680.013 7.096193e-91
FCRL5 5.122265e-930.76132620.360.001 1.225041e-88
DERL3 1.832524e-921.66841610.440.003 4.382665e-88
CDCA5 3.309408e-920.72003750.440.003 7.914779e-88
TNFRSF17 4.278925e-920.59695240.320.000 1.023348e-87
CCNA2 5.926273e-921.24148400.520.006 1.417327e-87
CDC20 4.114442e-880.94352580.400.002 9.840099e-84
POU2AF1 1.122809e-861.67894640.440.004 2.685310e-82
FOXM1 1.275044e-860.68607140.480.005 3.049394e-82
CENPA 4.605660e-860.89604990.560.009 1.101490e-81
IGLL5 1.752393e-841.42348490.360.002 4.191024e-80
KIFC1 2.635741e-831.03874870.600.012 6.303638e-79
MZB1 4.328649e-833.74475900.560.010 1.035240e-78
FANCI 1.313591e-820.95831660.600.012 3.141584e-78
TRIP13 3.017287e-820.64828320.480.006 7.216144e-78
KIF11 3.660979e-820.71682490.480.006 8.755598e-78
NSL10.10173480.44484580.320.1951
COA50.10448470.25096370.320.1881
ARMCX60.10875740.30241350.360.2171
PCBP20.11318690.37749380.760.6111
SF3A30.11587520.26824490.320.2131
VPS290.11634710.25494490.760.5441
BRD70.13610300.25794460.360.2371
ARF40.14652650.29668680.560.4571
ILK0.14792350.25357750.560.4431
SERP10.14825600.42065830.880.8541
C19orf470.16317180.40593870.120.0551
SEC61G0.16958960.33268620.880.7901
AKIP10.18994560.27859410.240.1581
ACTG10.21084240.42656361.000.9721
UBE2J10.21303100.64216380.560.5541
C9orf780.21780270.29524280.400.3251
FKBP1A0.22655580.39983290.920.8131
OTULINL0.22708770.33976600.240.1741
ABCG10.24063360.27588770.320.2231
NDUFB20.27107200.30227080.920.7731
MTRNR2L120.27514240.31999790.960.9451
CFL10.27669740.26966411.000.9641
RPN10.33359250.26497640.760.6131
WDR410.36493070.31867310.240.1651
HSPA50.37372410.25017610.800.6571
PFN10.38725590.32202431.000.9911
COTL10.48218160.49977670.800.9011
GART0.48278160.30154760.240.1931
MYH90.52728700.35185940.640.6101
DNAAF10.56253481.99903970.120.0901
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='5_2')
deg
A data.frame: 2673 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
KLRC31.323678e-1472.48059000.600.0023.165708e-143
FGFBP21.683789e-1102.79328350.500.0024.026950e-106
KLRD12.554944e-1013.50949490.950.026 6.110404e-97
KRT867.472939e-1011.49613420.350.000 1.787228e-96
TRDC 2.868893e-891.75402100.450.003 6.861245e-85
FEZ1 3.153624e-881.30401810.350.001 7.542207e-84
SH2D1B 1.186928e-861.38407620.300.000 2.838657e-82
KIR2DL3 1.186928e-861.57564750.300.000 2.838657e-82
KIR2DL1 1.819076e-721.46072410.250.000 4.350503e-68
GNLY 2.729442e-684.96846190.850.034 6.527733e-64
GZMH 2.672236e-642.89596030.800.031 6.390919e-60
KLRC2 3.868288e-641.38145700.350.003 9.251397e-60
FCRL3 2.707115e-580.83304990.200.000 6.474336e-54
GZMB 1.138927e-513.92736590.900.053 2.723858e-47
PRF1 1.117044e-483.88536740.900.061 2.671523e-44
KLRF1 3.005528e-471.72237020.350.006 7.188020e-43
KRT81 3.957962e-441.05138760.150.000 9.465862e-40
TRBC1 5.527776e-442.87823480.700.039 1.322023e-39
CCL5 1.630512e-414.30336391.000.100 3.899532e-37
PPP2R2B 3.312914e-411.09791930.350.008 7.923165e-37
AKAP5 2.501702e-401.08926020.250.003 5.983070e-36
CD247 2.514634e-392.95261250.850.070 6.014000e-35
CST7 6.412558e-393.67756501.000.110 1.533627e-34
CTSW 8.077229e-372.82108650.700.049 1.931750e-32
IL2RB 6.076622e-362.37204740.700.050 1.453285e-31
NKG7 5.555415e-354.88617871.000.135 1.328633e-30
TGFBR3 1.308066e-301.19252790.300.009 3.128371e-26
HOPX 4.428423e-303.02216050.650.053 1.059102e-25
NR5A2 5.834930e-300.35991260.100.000 1.395482e-25
LINC00092 5.834930e-300.60377430.100.000 1.395482e-25
SMAD20.98520880.38506120.200.2441
EIF4B0.98637120.52978030.300.3771
WDFY10.98802980.35543800.250.3021
NPIPB40.98816360.43509710.100.1091
TPST20.98917920.31070000.250.3011
FAM133B0.99056820.39599520.250.2941
POLG0.99064530.29693530.150.1731
CIC0.99087810.50193400.100.1111
PURA0.99174680.27056330.100.1111
HDDC20.99205580.32475930.150.1721
MBTPS10.99261550.34096110.100.1111
ARMC100.99458640.36812050.200.2371
STAT5B0.99520720.33242320.100.1111
SIRT70.99531410.49081460.150.1721
C14orf1190.99563160.28060370.250.3051
COPS80.99563470.27748430.150.1691
SNHG120.99638890.30402910.150.1721
CIAPIN10.99695000.43669130.100.1111
NBPF260.99782150.34437160.100.1111
CDC260.99809190.28004440.300.3771
RSRC20.99811650.55586110.300.3941
COPS7B0.99868890.25569480.100.1101
PGRMC20.99868890.31746460.100.1101
CDK50.99869290.35520610.100.1111
EWSR10.99902230.40958530.450.6131
PPP2R5E0.99902910.26559920.200.2271
GPBP1L10.99968450.49961240.200.2431
GUSB1.00000000.32651220.350.4511
PHB21.00000000.53022820.300.3901
AMZ21.00000000.31040690.200.2341
# adopt integrated_ann first
seu@meta.data[, "persample_ann"] = as.character(seu@meta.data[, "integrated_ann"] )
o(6,6)
FeaturePlot(seu, features = 'CD19')
FeaturePlot(seu, features = 'CD79A')
FeaturePlot(seu, features = 'JCHAIN')
output_268_0.png output_268_1.png output_268_2.png
o(10,5)
FeaturePlot(seu, pt.size=0.1, features = c('CXCR2','FCGR3B'))
output_269_0.png

DC

# pDC
p=Nebulosa::plot_density(seu,c('IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','CLEC9A','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)


# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_271_0.png output_271_1.png output_271_2.png
# DC markers
o(5*5, 5*4)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
            features = c('CST3','FCER1A','ITGAX',# pan DC
                         'LAMP3','CLEC9A',#cDC1
                         "CD1C",'HLA-DQA1',"PLD4",# cDC2
                         'LILRA4','LILRB4','IRF8','CCR7', #pDC
                         'CCL17','CD163','CD14','FCER1A','CD1A','MRC1'#moDC
                        )
           )&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CST3", :
“All cells have the same value (0) of FCER1A.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CST3", :
“All cells have the same value (0) of FCER1A.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CST3", :
“All cells have the same value (0) of CD1A.”
output_272_1.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4'))
seu@meta.data[cell.sel, "persample_ann"] = 'DC'

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_275_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='0'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='1'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='3'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='7'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

T

# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_278_0.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5_2'))
seu@meta.data[cell.sel, "persample_ann"] = 'NKT'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'T cycling'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='6'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD4'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'
cell.sel = Cells(subset(seu, integrated_ann=='Mast'))
seu@meta.data[cell.sel, "persample_ann"] = 'Mast'
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_283_0.png
sample_name
'S4'
seu -> immune.list[[sample_name]]

S5

# context switching
sample_name='S5'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'

Idents(seu)<-group.by
seu = FindSubCluster(seu, cluster='4',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.5, algorithm = 1)
Idents(seu)<-group.by
seu = FindSubCluster(seu, cluster='7',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.7, algorithm = 1)
Idents(seu)<-group.by
seu = FindSubCluster(seu, cluster='6',
                      graph.name="RNA_snn",
                      subcluster.name = "RNA_snn_res.0.9",  resolution = 0.9, algorithm = 1)


o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5, cols=manymanycolors),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 196
Number of edges: 5303

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6935
Number of communities: 3
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 71
Number of edges: 985

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.5600
Number of communities: 3
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 94
Number of edges: 2292

Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.4148
Number of communities: 3
Elapsed time: 0 seconds
output_287_1.png
# adopt integrated_ann first
seu@meta.data[, "persample_ann"] = as.character(seu@meta.data[, "integrated_ann"] )

DC

# pDC
p=Nebulosa::plot_density(seu,c('IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','CLEC9A','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)


# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_290_0.png output_290_1.png output_290_2.png
FeaturePlot(seu, features = 'FCGR3B')
FeaturePlot(seu, features = 'S100A9')
FeaturePlot(seu, features = 'CXCR2')
output_292_0.png output_292_1.png output_292_2.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='7_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'Neu'

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of CHIT1.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of IGSF21.”
output_295_1.png
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='0'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='2'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='3'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='8'))
seu@meta.data[cell.sel, "persample_ann"] = 'macrophage'

T

# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_298_0.png
Idents(seu) <- group.by
deg = FindMarkers(seu,assay='RNA',slot='data',only.pos=T, ident.1='4_2')
deg
A data.frame: 1708 × 5
p_valavg_log2FCpct.1pct.2p_val_adj
<dbl><dbl><dbl><dbl><dbl>
SH2D1B5.986470e-1861.86588070.5310.0011.431724e-181
KIR2DL43.871644e-1082.66738050.5940.0129.259425e-104
XCL12.311232e-1002.67213210.5620.012 5.527542e-96
KLRC3 1.863274e-812.11553520.5000.012 4.456206e-77
GNLY 6.024831e-785.26710010.9060.060 1.440899e-73
NCAM1 1.084144e-630.93144260.1880.001 2.592840e-59
KIR2DL3 3.194074e-620.88409950.1560.000 7.638948e-58
KLRD1 3.194807e-483.17867860.8440.093 7.640701e-44
KLRF1 2.374153e-461.27130250.2190.003 5.678025e-42
PDE6G 1.812971e-430.96318500.2500.006 4.335902e-39
XCL2 7.199752e-432.55964370.4380.023 1.721893e-38
KLRC2 8.394278e-431.26787210.3120.010 2.007576e-38
KIR3DL2 2.158059e-290.92219750.1880.005 5.161215e-25
KLRC1 4.113460e-281.87265040.4380.037 9.837751e-24
GZMB 1.714989e-272.37938730.6880.098 4.101568e-23
CD7 2.924975e-272.34905120.9380.215 6.995371e-23
TNFRSF18 1.371294e-261.45793630.4060.034 3.279587e-22
C1orf21 3.195872e-241.34597810.3750.032 7.643247e-20
TMIGD2 1.544410e-221.30306440.3120.024 3.693612e-18
PRCD 3.064550e-220.60110540.1250.003 7.329179e-18
TRGV9 4.441467e-201.12637170.2810.021 1.062221e-15
SPRY1 2.763883e-191.26990180.3120.028 6.610104e-15
DUSP2 9.619282e-192.27196610.7810.212 2.300548e-14
CTSW 5.465748e-181.60777950.5940.111 1.307188e-13
SYTL3 6.022462e-182.01921290.6880.162 1.440332e-13
HOPX 1.240548e-171.80133280.5310.092 2.966895e-13
EOMES 1.358912e-171.10134480.2810.025 3.249973e-13
FGFBP2 2.931011e-171.63396550.2190.015 7.009805e-13
NKG7 5.847903e-172.73240650.8120.262 1.398584e-12
ADGRG1 1.698893e-150.60319090.1250.005 4.063071e-11
IMP30.94861520.35465520.2190.2411
ANXA70.95094650.33054410.2500.3011
RAB9A0.95117920.29342010.2810.3181
PARP100.95182980.32226780.4060.4901
PIK3R50.95227790.26510830.2500.3071
CARD190.95399680.29576950.2500.2951
SLC35B10.95644820.25312310.1880.2111
PIGP0.95707540.39028560.0940.1051
DPM20.96206360.26313520.1560.1711
B3GAT30.96487460.25143490.2190.2461
ALKBH50.96547000.26591480.0940.1051
UBAP2L0.96606650.41849270.1560.1721
FURIN0.96624710.39945060.2190.2551
PPP1R70.96664390.29415230.1880.2111
DAP30.96877810.25365560.2190.2481
ALOX5AP0.97007310.55452460.4690.5421
CHCHD10.97220730.56857800.1880.2191
EBPL0.97661310.28151810.1250.1331
SH3GL10.97849360.31086030.1250.1411
RNF40.98088260.33462710.1250.1351
ATP2A30.98103090.34021090.1560.1671
PSTPIP10.98124320.29075580.1250.1331
RAD210.98284920.29187060.2500.2861
STAT60.98305880.46171700.2810.3351
VEZF10.98324460.27895080.1250.1361
FBXL150.98862190.29541530.1560.1751
TMEM126B0.99185700.35377460.1560.1711
UBXN40.99457280.30206800.3750.4401
DERL10.99674760.54551450.2500.2881
COPZ10.99790470.27551840.2810.3471
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='1'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD4'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='6_2'))
seu@meta.data[cell.sel, "persample_ann"] = 'T cycling'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'gdT'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4_2'))
seu@meta.data[cell.sel, "persample_ann"] = 'NK'

cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='4_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='5'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='6_0'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'
cell.sel = Cells(subset(seu, RNA_snn_res.0.9=='6_1'))
seu@meta.data[cell.sel, "persample_ann"] = 'T CD8'
o(8,7);DimPlot(seu, group.by='persample_ann', label=T, repel=T, pt.size=0.1)
output_301_0.png

S6

# context switching
sample_name='S6'

seu= immune.list[[sample_name]]
group.by= 'RNA_snn_res.0.9'

o(17,8)
ggarrange(
    DimPlot(seu, group.by=group.by, label=T,repel=T, label.size = 5, cols=manymanycolors),
    DimPlot(seu, group.by='integrated_ann',  label=T,repel=T, label.size = 5),
    nrow=1, ncol=2
)
output_303_0.png
# adopt integrated_ann first
seu@meta.data[, "persample_ann"] = as.character(seu@meta.data[, "integrated_ann"] )

DC

# pDC
p=Nebulosa::plot_density(seu,c('IRF4','LILRA4','LILRB4','IRF8'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)

# cDC1
p=Nebulosa::plot_density(seu,c('HLA-DQA1','BATF3','CADM1','CLEC9A','XCR1'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)


# cDC2
p=Nebulosa::plot_density(seu,c('CD14','PLD4','CD1C','CX3CR1','CLEC10A'),joint=T)&theme(
    axis.title=element_blank(),axis.ticks=element_blank(),axis.text = element_blank())&NoLegend()
o(5*6, 5*1)
p+plot_layout(ncol = 6)
output_306_0.png output_306_1.png output_306_2.png

Mac

# macrophages
o(5*5, 5*9)
FeaturePlot(seu, ncol = 5, pt.size=0.01,
            features = c("CD14",'LYZ',"FCGR3A",
'OLR1','CDKN1C','LILRB2',"ITGAL",
'CDKN1C','LILRB2','ITGAL',
'S100A12','PROK2','S100A8','VCAN',
'NT5E','ANGPTL4','CXCL5','BAG3',
'DNASE2',
'MMP7','TIMP3','CHI3L1','FABP5',
'CHIT1','GDF15','CTSK',
'CCL18','PLTP','CD209','F13A1',
'FABP4','RBP4','PPARG','MARCO',
'CXCL12','IGSF21','C3',
'CXCL9','CXCL10','CXCL11','GBP1',
'CCL17',"CLEC10A",
"TOP2A","MKI67",'CDK1')
)&theme(
legend.position=c(0.8,0.8),
axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of CXCL12.”
Warning message in FeaturePlot(seu, ncol = 5, pt.size = 0.01, features = c("CD14", :
“All cells have the same value (0) of CCL17.”
output_308_1.png

T

# T cell markers
o(5*5, 5*7)
FeaturePlot(seu, ncol = 5,pt.size=0.01,
features = c("CD3D","CD3E",'TRAC','TRBC1','TRGC2',
             'TRGC1','TRDC',"CD4",'CD8A','CD8B',
             'RORC','FOXP3','CD28','IL2RA',"CD44",
             'CD69','CD27','PRF1','GZMK','ID2',
             'RORC','GATA3','ZBTB16','IL7R','TBX21',
             'NKG7','GNLY','EOMES','KLRB1','TOX',
             "TOX2",'CXCR5','SELL','CD68','MT2A',
             'CST7','HOPX','GZMM','KLRD1','KLRC2',
             'KLRF1'), order=F)&theme(axis.line = element_blank(),
axis.title = element_blank(),axis.text = element_blank(), axis.ticks=element_blank()
)
output_312_0.png