Set working directory

knitr::opts_knit$set(root.dir = ".")

Libraris, paths, colors

source("/research/labs/neurology/fryer/m239830/Ecoli_pigs/snRNA/scripts/R/file_paths_and_colours.R")
tissue <- "Kidney"

Read in object

# read object
pigs.unannotated <- readRDS("../../rObjects/kidney_unannotated.rds")

Define resolution and groups

# set levels and idents
Idents(pigs.unannotated) <- "seurat_clusters"
DefaultAssay(pigs.unannotated) <- "RNA"

Unannotated UMAP

dittoDimPlot(object = pigs.unannotated,
             var = "seurat_clusters",
             reduction.use = "umap",
             do.label = TRUE,
             labels.highlight = TRUE)

Mitochondrial contamination

# umap percent.mt split by sample
FeaturePlot(pigs.unannotated, 
            reduction = "umap", 
            features = "percent.mt",
            split.by = "sample",
            min.cutoff = 'q10',
            label = TRUE)

Cells per cluster

n_cells <- FetchData(pigs.unannotated, 
                     vars = c("ident", "treatment")) %>%
  dplyr::count(ident,treatment) %>%
  tidyr::spread(ident, n)
n_cells
##   treatment    0    1    2    3   4   5   6   7   8   9  10  11  12
## 1     Ecoli 1766 1590 1487 1261 796 773 683 615 421 266 247 205 161

Cluster tree

pigs.unannotated <- BuildClusterTree(object = pigs.unannotated,
                                     dims = 1:11,
                                     reorder = FALSE,
                                     reorder.numeric = FALSE)

tree <- pigs.unannotated@tools$BuildClusterTree
tree$tip.label <- paste0("Cluster ", tree$tip.label)

tree_1 <- ggtree::ggtree(tree, aes(x, y)) +
  scale_y_reverse() +
  ggtree::geom_tree() +
  ggtree::theme_tree() +
  ggtree::geom_tiplab(offset = 1) +
  ggtree::geom_tippoint(color = colors[1:length(tree$tip.label)], 
                        shape = 16, size = 5) +
  coord_cartesian(clip = 'off') +
  theme(plot.margin = unit(c(0,2.5,0,0), 'cm'))
tree_1

Marker exploration

FindAllMarkers will find markers differentially expressed in each identity group by comparing it to all of the others - you don’t have to manually define anything. Note that markers may bleed over between closely-related groups - they are not forced to be specific to only one group. This is what most people use (and likely what you want).

Find all markers

# read object
all.markers <- readRDS(paste0("../../rObjects/", tolower(tissue), "_unannotated_all_markers.rds"))

# more stringent filtering
all.markers <- all.markers[all.markers$p_val_adj < 0.05,]
markers.strict <- all.markers[
  all.markers$delta_pct > summary(all.markers$delta_pct)[5],]

# compare 
table(all.markers$cluster)
## 
##   0   1   2   3   4   5   6   7   8   9  10  11  12 
## 300 295 285 237 460 266 293 293 206 258 116 150 184
table(markers.strict$cluster)
## 
##   0   1   2   3   4   5   6   7   8   9  10  11  12 
##  61  19  57  21  91  49  49  76  86 101  59  79  82
# subset
cluster0 <- markers.strict[markers.strict$cluster == 0,]
cluster1 <- markers.strict[markers.strict$cluster == 1,]
cluster2 <- markers.strict[markers.strict$cluster == 2,]
cluster3 <- markers.strict[markers.strict$cluster == 3,]
cluster4 <- markers.strict[markers.strict$cluster == 4,]
cluster5 <- markers.strict[markers.strict$cluster == 5,]
cluster6 <- markers.strict[markers.strict$cluster == 6,]
cluster7 <- markers.strict[markers.strict$cluster == 7,]
cluster8 <- markers.strict[markers.strict$cluster == 8,]
cluster9 <- markers.strict[markers.strict$cluster == 9,]
cluster10 <- markers.strict[markers.strict$cluster == 10,]
cluster11 <- markers.strict[markers.strict$cluster == 11,]
cluster12 <- markers.strict[markers.strict$cluster == 12,]

PCs

# Printing out the most variable genes driving PCs
print(x = pigs.unannotated[["pca"]], 
      dims = 1:5, 
      nfeatures = 10)
## PC_ 1 
## Positive:  CYP4A24, FGB, DAB2, HAO2, SLC13A3, GPX3, SLC4A4, NAMPT, CYP24A1, EXT1 
## Negative:  ERBB4, SLC8A1, ENSSSCG00000063471, ENSSSCG00000056698, MECOM, SLC12A3, ENOX1, TXNIP, ENSSSCG00000061089, EFEMP1 
## PC_ 2 
## Positive:  ERBB4, SLC12A3, ENOX1, SLC8A1, PLCB1, EFEMP1, EGF, SLC12A1, ENSSSCG00000010893, MECOM 
## Negative:  PTPRQ, ENSSSCG00000063471, MAGI2, ENSSSCG00000016548, PDE3A, RPGRIP1L, THSD7A, ENSSSCG00000063404, DCLK1, COL4A3 
## PC_ 3 
## Positive:  PTPRQ, ERBB4, ENSSSCG00000063471, MAGI2, SLC12A3, ENOX1, ENSSSCG00000016548, SLC8A1, PDE3A, THSD7A 
## Negative:  ESRRG, ADGRF5, BCAT1, FOXI1, ENSSSCG00000054874, FOXP1, SLC26A4, TBC1D1, ADGRF1, RHOBTB2 
## PC_ 4 
## Positive:  SLC8A1, TRPV5, ENPP1, MECOM, TRPV6, ENSSSCG00000063471, NR3C2, GHSR, CRYBG1, ENSSSCG00000015565 
## Negative:  ERBB4, ENOX1, SLC12A1, EGF, PLCB1, THSD4, ENSSSCG00000010893, DOK6, ZNF385D, DDIT4L 
## PC_ 5 
## Positive:  SERPINE1, ENSSSCG00000029160, CD74, TCF4, DCLK1, RPGRIP1L, LDB2, STC1, FLT1, CLDN5 
## Negative:  PTPRQ, MAGI2, COL4A3, ENSSSCG00000063404, ENSSSCG00000016548, PDE3A, THSD7A, PTPRO, SAMD12, PDE10A

Top variable genes

# print top variable genes
top100 <- pigs.unannotated@assays$SCT@var.features[1:100]
top100
##   [1] "SLC8A1"             "PTPRQ"              "CEMIP"             
##   [4] "ENSSSCG00000054874" "SLC26A4"            "ENSSSCG00000063471"
##   [7] "ERBB4"              "SLC12A3"            "MAGI2"             
##  [10] "ENSSSCG00000037358" "ENOX1"              "ESRRG"             
##  [13] "FOXI1"              "CHODL"              "BCAT1"             
##  [16] "ADGRF5"             "EGF"                "SERPINE1"          
##  [19] "ENSSSCG00000056698" "ENSSSCG00000029160" "STC1"              
##  [22] "A2M"                "TIMP3"              "THSD7A"            
##  [25] "TRPV5"              "SLPI"               "TRPV6"             
##  [28] "PCK1"               "SLC40A1"            "CALD1"             
##  [31] "MECOM"              "DCLRE1C"            "PDE3A"             
##  [34] "ENSSSCG00000044696" "SLC12A1"            "DEFB1.1"           
##  [37] "ENSSSCG00000008998" "PLAT"               "ZNF521"            
##  [40] "REN"                "NRG1"               "RPGRIP1L"          
##  [43] "SLC13A1"            "DCLK1"              "CLIC5"             
##  [46] "SAMD12"             "RHOBTB1"            "GPX3"              
##  [49] "GTPBP10"            "PTPRO"              "NYAP2"             
##  [52] "FOXP1"              "SLIT2"              "TGM3"              
##  [55] "ENSSSCG00000050067" "EFEMP1"             "CXCL10"            
##  [58] "FAM171B"            "PDE10A"             "PTGER3"            
##  [61] "CLU"                "ENSSSCG00000016548" "CYP4A24"           
##  [64] "ENSSSCG00000056609" "FLT1"               "COL4A3"            
##  [67] "SLC26A7"            "ARSB"               "FGB"               
##  [70] "ADGRG6"             "DACH1"              "TIMP1"             
##  [73] "ADGRF1"             "G6PC1"              "HPGD"              
##  [76] "CLDN5"              "ENSSSCG00000014062" "ESRRB"             
##  [79] "ENSSSCG00000063404" "CIITA"              "ENSSSCG00000010893"
##  [82] "KCTD9"              "ENSSSCG00000051520" "TBC1D1"            
##  [85] "SLC16A9"            "SAMD5"              "ENSSSCG00000055373"
##  [88] "ENSSSCG00000062072" "GATA3"              "RHOBTB2"           
##  [91] "NUPR1"              "HS6ST2"             "FGFR1"             
##  [94] "MAN1A1"             "SAT1"               "ENSSSCG00000061089"
##  [97] "ENSSSCG00000042325" "HERC1"              "SORBS2"            
## [100] "CYP24A1"

Kidney cell types

The human protein atlas https://www.proteinatlas.org/ENSG00000085276-MECOM/single+cell+type/kidney\

kidney_cells <- c("CD19", "CR2", "MS4A1", "GZMB", "IL3RA", "CEBPE", "HDC", "MS4A2", "CD163", "CD68", "MARCO", "MRC1", "MSR1", "FCGR3A", "KIR2DL4", "PIM2", "CD3E", "CD4", "CD8A", "FOXP3", "IL17A", "CD34", "PECAM1", "SELE", "SLC2A1", "VWF", "MBP", "MPZ", "S100B", "SOX10", "COL3A1", "FBN1", "LUM", "ACTA2", "ACTG2", "CNN1", "MYH11", "AQP2", "CLDN8", "PVALB", "TMEM213", "SLC12A1", "TMEM72", "UMOD", "MIOX", "NAT8", "SLC22A8", "TMEM174") 
VlnPlot(pigs.unannotated,
        features = kidney_cells,
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

Cluster Annotation

Cluster 0 - Hepatocytes / Proximal tubular

FGB - Hepatocytes - Metabolism (mainly)
SLC4A4 -Astrocytes - Unknown function (mainly) /Proximal tubular
FGG - Hepatocytes /Proximal tubular
SLC2A2 - Hepatocytes / Proximal tubular

Hepatocytes in the kidney: https://pubmed.ncbi.nlm.nih.gov/9770301/

# Number of cells per condition
n_cells[,c(1,2)]
##   treatment    0
## 1     Ecoli 1766
# UMAP with only cluster 0
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "0"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[1])

VlnPlot(pigs.unannotated,
        features = cluster0$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster0$gene[1:10]
##  [1] "FGB"                "SLC4A4"             "FGG"               
##  [4] "HAO2"               "FTL"                "SLC13A3"           
##  [7] "SLC2A2"             "ENSSSCG00000024911" "LGMN"              
## [10] "MT1A"

Cluster 1 - Hepatocytes / Proximal tubular

VMP1 - Monocytes - Innate immune response (mainly) / marcophage ACO1 - Proximal tubular cells
SLC39A14 - Hepatocytes
LGMN - Macrophages - Innate immune response (mainly)
NKAIN3 - Astrocytes?  LBP - Hepatocytes - Metabolism (mainly)

# Number of cells per condition
n_cells[,c(1,3)]
##   treatment    1
## 1     Ecoli 1590
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "1"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[2])

VlnPlot(pigs.unannotated,
        features = cluster1$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster1$gene[1:10]
##  [1] "VMP1"     "ACO1"     "SLC39A14" "LGMN"     "NKAIN3"   "NAMPT"   
##  [7] "NDRG1"    "PITPNC1"  "DAB2"     "LBP"

Cluster 2 - Proximal tubular

RHOBTB1 - Syncytiotrophoblasts - Pregnancy (mainly) / Proximal tubular  SLC5A12 - Proximal enterocytes - Digestion (mainly) / Proximal tubular  ARSB - Oligodendrocyte precursor

# Number of cells per condition
n_cells[,c(1,4)]
##   treatment    2
## 1     Ecoli 1487
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "2"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[3])

VlnPlot(pigs.unannotated,
        features = cluster2$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster2$gene[1:10]
##  [1] "CYP4A24"            "ENSSSCG00000007858" "RHOBTB1"           
##  [4] "ARSB"               "HAO2"               "SLC5A12"           
##  [7] "CUBN"               "ANKS1A"             "ENSSSCG00000003891"
## [10] "SLC13A3"

Cluster 3 - Proximal tubular

CYP24A1 - Respiratory epithelial cells / Proximal tubular  SLC13A1 - Proximal tubular cells 

# Number of cells per condition
n_cells[,c(1,4)]
##   treatment    2
## 1     Ecoli 1487
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "3"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[4])

VlnPlot(pigs.unannotated,
        features = cluster3$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster3$gene[1:10]
##  [1] "CYP24A1"            "SLC13A1"            "DAB2"              
##  [4] "NAMPT"              "CYP4A24"            "ENSSSCG00000058016"
##  [7] "HAO2"               "NDRG1"              "CGNL1"             
## [10] "GRAMD1B"

Cluster 4 - B-cells / Monocytes / Proximal tubular

BIRC3 - B-cells
NFKBIA - Monocytes - Innate immune response (mainly) / marcophages  HSPG2 - Adipocytes & Endothelial cells - Mixed function (mainly) / B-cells

# Number of cells per condition
n_cells[,c(1,5)]
##   treatment    3
## 1     Ecoli 1261
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "4"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[5])

VlnPlot(pigs.unannotated,
        features = cluster4$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster4$gene[1:10]
##  [1] "NFKBIA"             "ENSSSCG00000063471" "LDB2"              
##  [4] "DCLK1"              "BIRC3"              "PALM2AKAP2"        
##  [7] "ENSSSCG00000001341" "ENSSSCG00000052432" "ENSSSCG00000044696"
## [10] "HSPG2"

Cluster 5 - Neurons / Distal tubular

SLC12A1 - distal tubular cells
THSD4 - Squamous epithelial cells / collecting duct  ERBB4 - neurons / collecting duct / distal tubular cells
ENOX1 - neurons / distal tubular cells
PLCB1 - neurons

# Number of cells per condition
n_cells[,c(1,6)]
##   treatment   4
## 1     Ecoli 796
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "5"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[6])

VlnPlot(pigs.unannotated,
        features = cluster5$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster5$gene[1:10]
##  [1] "SLC12A1"            "ERBB4"              "ENOX1"             
##  [4] "PLCB1"              "ENSSSCG00000010893" "THSD4"             
##  [7] "TXNIP"              "SAMD4A"             "GPR39"             
## [10] "EFEMP1"

Cluster 6 - Immune response / collecting duct

MECOM - microglia  TRPV5 - Oligodendrocytes / collecting duct  NR3C2 - neurons / B-cells / collecting duct
SLC8A1 - neurons / macrophages / collecting duct  ENPP1 - connective tissue

# Number of cells per condition
n_cells[,c(1,7)]
##   treatment   5
## 1     Ecoli 773
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "6"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[7])

VlnPlot(pigs.unannotated,
        features = cluster6$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster6$gene[1:10]
##  [1] "MECOM"              "TRPV5"              "NR3C2"             
##  [4] "ENSSSCG00000063471" "GHSR"               "SLC8A1"            
##  [7] "ENPP1"              "ENSSSCG00000015565" "CRYBG1"            
## [10] "EFEMP1"

Cluster 7 - Innate immune response / B-cells

ADGRF5 - Adipocytes & Endothelial cells / B-cells
BCAT1 - Macrophages
ESRRG - neurons  ADGRF1 - Respiratory epithelial cells / collecting duct  UVRAG - B-cells / Macrophages

# Number of cells per condition
n_cells[,c(1,8)]
##   treatment   6
## 1     Ecoli 683
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "7"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[8])

VlnPlot(pigs.unannotated,
        features = cluster7$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster7$gene[1:10]
##  [1] "ADGRF5"             "BCAT1"              "ESRRG"             
##  [4] "ADGRF1"             "UVRAG"              "FOXI1"             
##  [7] "KIT"                "TBC1D1"             "ENSSSCG00000052253"
## [10] "WDSUB1"

Cluster 8 - Distal tubular

ERBB4 - neurons / collecting duct /Distal tubular
ENOX1 - neurons / oligodendrocytes / Distal tubular
EGF - Skeletal myocytes / Distal tubular / Proximal tubular  KNG1 - Hepatocytes / Distal tubular

# Number of cells per condition
n_cells[,c(1,9)]
##   treatment   7
## 1     Ecoli 615
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "8"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[9])

VlnPlot(pigs.unannotated,
        features = cluster8$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster8$gene[1:10]
##  [1] "SLC12A3"            "ERBB4"              "ENOX1"             
##  [4] "DACH1"              "PLCB1"              "IER3"              
##  [7] "ENSSSCG00000027903" "EGF"                "TXNIP"             
## [10] "KNG1"

Cluster 9 - Macrophages

SERPINE1 - mural / macrophage
CD74 - Dendritic cells / B-cell / macrophage  CXCL10 - Monocytes / macrophage

# Number of cells per condition
n_cells[,c(1,10)]
##   treatment   8
## 1     Ecoli 421
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "9"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[10])

VlnPlot(pigs.unannotated,
        features = cluster9$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster9$gene[1:10]
##  [1] "ENSSSCG00000060989" "SERPINE1"           "CD74"              
##  [4] "ENSSSCG00000052432" "RPGRIP1L"           "DCLK1"             
##  [7] "CXCL10"             "SLC3A1"             "TCF4"              
## [10] "ENSSSCG00000001229"

Cluster 10 - Immune response

SLC8A1 - Neuron  TRPV5 - Oligodendrocytes  MECOM - Endothelial - Glandular & Luminal cells - Unknown function (mainly)
ENPP1 - Fibroblast like  TRPV6 - Serous glandular cells - Salivary secretion (mainly)

# Number of cells per condition
n_cells[,c(1,11)]
##   treatment   9
## 1     Ecoli 266
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "10"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[11])

VlnPlot(pigs.unannotated,
        features = cluster10$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster10$gene[1:10]
##  [1] "SLC8A1" "TRPV5"  "MECOM"  "ENPP1"  "GHSR"   "NR3C2"  "EFEMP1" "CRYBG1"
##  [9] "TRPV6"  "PAK5"

Cluster 11 - Neuron

SLC26A4 - neuron  NYAP2 - interneuron  FOXP1 - neuron 

# Number of cells per condition
n_cells[,c(1,12)]
##   treatment  10
## 1     Ecoli 247
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "11"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[12])

VlnPlot(pigs.unannotated,
        features = cluster11$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster11$gene[1:10]
##  [1] "ENSSSCG00000054874" "SLC26A4"            "NYAP2"             
##  [4] "FOXP1"              "MAN1A1"             "ATP6V1C2"          
##  [7] "STAP1"              "TLDC2"              "LIMCH1"            
## [10] "TBC1D1"

Cluster 12 - Neuron

PTPRQ - neuron
MAGI2 - neuron / oligodendrocytes
ENSSSCG00000063404 = SLC30A3 - neuron 

# Number of cells per condition
n_cells[,c(1,12)]
##   treatment  10
## 1     Ecoli 247
DimPlot(object = subset(pigs.unannotated, seurat_clusters == "11"),
        reduction = "umap", 
        label = TRUE,
        label.box = TRUE,
        label.size = 3,
        repel = TRUE,
        cols = colors[13])

VlnPlot(pigs.unannotated,
        features = cluster11$gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

cluster12$gene[1:10]
##  [1] "PTPRQ"              "MAGI2"              "ENSSSCG00000063404"
##  [4] "ENSSSCG00000063471" "ENSSSCG00000016548" "COL4A3"            
##  [7] "PDE3A"              "WT1"                "THSD7A"            
## [10] "PLEKHG1"

Assign identities

# Rename all identities
pigs.annotated <- RenameIdents(object = pigs.unannotated, 
                               "0" = "Hepatocytes",
                               "1" = "Hepatocytes",
                               "2" = "Proximal tubular",
                               "3" = "Proximal tubular",
                               "4" = "B-cells",
                               "5" = "Neuron",
                               "6" = "Immune response",
                               "7" = "Innate immune response",
                               "8" = "Distal tubular",
                               "9" = "Macrophage",
                               "10" = "Immune response",
                               "11" = "Neuron", 
                               "12" = "Neuron")
pigs.annotated$annotated_clusters <- factor(Idents(pigs.annotated),
                                             levels = c("Distal tubular",
                                                        "Proximal tubular",
                                                        "Hepatocytes",
                                                        "B-cells",
                                                        "Immune response",
                                                        "Innate immune response",
                                                        "Macrophage",
                                                        "Neuron"))
Idents(pigs.annotated) <- "annotated_clusters"

UMAP - annotated

u1 <- DimPlot(pigs.annotated,
              group.by = "annotated_clusters",
              cols = colors,
              raster = FALSE,
              label = FALSE) +
  ggtitle("Ecoli pig Kidney")
u1

u2 <- DimPlot(pigs.annotated,
              group.by = "annotated_clusters",
              cols = colors,
              dims = c(2,3),
              raster = FALSE,
              label = FALSE) +
  ggtitle("Ecoli pig Kidney")
u2

Cell count

n_cells <- FetchData(pigs.annotated, 
                     vars = c("ident", "sample")) %>%
  dplyr::count(ident,sample) %>%
  tidyr::spread(ident, n)
n_cells
##   sample Distal tubular Proximal tubular Hepatocytes B-cells Immune response
## 1     E1            421             2748        3356     796             930
##   Innate immune response Macrophage Neuron
## 1                    615        266   1139

Tree annoated

pigs.annotated <- BuildClusterTree(object = pigs.annotated,
                                     dims = 1:11,
                                     reorder = FALSE,
                                     reorder.numeric = FALSE)

tree <- pigs.annotated@tools$BuildClusterTree
tree$tip.label <- paste0("", tree$tip.label)

tree_an <- ggtree::ggtree(tree, aes(x, y)) +
  scale_y_reverse() +
  ggtree::geom_tree() +
  ggtree::theme_tree() +
  ggtree::geom_tiplab(offset = 1) +
  ggtree::geom_tippoint(color = colors[1:length(tree$tip.label)], 
                        shape = 16, size = 5) +
  coord_cartesian(clip = 'off') +
  theme(plot.margin = unit(c(0,5,0,0), 'cm'))
tree_an

Bulk DEGs

DEGs <- read.delim("/research/labs/neurology/fryer/m239830/Ecoli_pigs/bulkRNA/results/star_high_dose_exclude_S4_S5_E3_E5_E7/DEGs/Ecoli_Kidney_gene_DEGs_FDRq0.05.txt")
up_DEGs <- subset(DEGs, logFC > 2) # log2FC greater than 2
# order from greatest to least fold change
up_DEGs <- up_DEGs[order(-up_DEGs$logFC),] 
up_DEGs_gene <- up_DEGs$gene_name

Top up-regualted bulk DEGs

Feature plot

up_DEGs_gene_list <- list(c(up_DEGs_gene))
pigs.annotated <- AddModuleScore(object = pigs.annotated, 
                                 features = up_DEGs_gene_list, 
                                 name = "DEGs")
FeaturePlot(object = pigs.annotated, features = "DEGs1", label = FALSE)+
  scale_colour_gradientn(colours = rev(brewer.pal(n = 11, name = "RdYlBu")))

Violins

# 1-10
VlnPlot(pigs.annotated,
        features = up_DEGs_gene[1:10],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

# 11-20
VlnPlot(pigs.annotated,
        features = up_DEGs_gene[11:20],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

# 21-30
VlnPlot(pigs.annotated,
        features = up_DEGs_gene[21:30],
        cols = colors,
        stack = TRUE,
        flip = TRUE,
        split.by = "seurat_clusters")

Cytokines

A list of reported cytokines was downloaded from https://www.immport.org/shared/genelists\

cytokines <- read.delim("/research/labs/neurology/fryer/m239830/Ecoli_pigs/cytokines.txt")
cytokine_gene <- cytokines$Symbol

cytokine_gene_list <- list(cytokine_gene)
pigs.annotated <- AddModuleScore(object = pigs.annotated, 
                                 features = cytokine_gene_list, 
                                 name = "cytokines")
FeaturePlot(object = pigs.annotated, features = "cytokines1") +
  scale_colour_gradientn(colours = rev(brewer.pal(n = 11, name = "RdYlBu")))