Last updated: 2022-10-13

Checks: 6 1

Knit directory: humanCardiacFibroblasts/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210903) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 8504490. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    data/GSEA/
    Ignored:    data/humanFibroblast/
    Ignored:    figure/DEgenesGZplusSG_Groups.Rmd/.DS_Store

Untracked files:
    Untracked:  analysis/clusterPatients.Rmd

Unstaged changes:
    Modified:   analysis/DEgenesGZplusSG_SubsetHT.Rmd
    Modified:   analysis/assignLabelshumanHeartsPlusGrazInt.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/assignLabelshumanHeartsPlusGrazInt.Rmd) and HTML (docs/assignLabelshumanHeartsPlusGrazInt.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd e6d0c3c mluetge 2022-09-26 add final human samples
html e6d0c3c mluetge 2022-09-26 add final human samples
Rmd cd902dd mluetge 2022-09-12 add human cardiac samples GZ and SG
html cd902dd mluetge 2022-09-12 add human cardiac samples GZ and SG
Rmd 141fae8 mluetge 2022-07-06 assign labels
html 141fae8 mluetge 2022-07-06 assign labels

load packages

suppressPackageStartupMessages({
  library(SingleCellExperiment)
  library(tidyverse)
  library(Seurat)
  library(magrittr)
  library(dplyr)
  library(purrr)
  library(ggplot2)
  library(here)
  library(runSeurat3)
  library(ggsci)
  library(ggpubr)
  library(pheatmap)
  library(viridis)
  library(sctransform)
})

load data

basedir <- here()
seurat <- readRDS(file = paste0(basedir, 
                              "/data/humanHeartsPlusGraz_intPatients_merged", 
                              "_seurat.rds"))
Idents(seurat) <- seurat$seurat_clusters

assign labels

seurat$label <- "other"
seurat$label[which(seurat$integrated_snn_res.0.4 %in% c("2","9","7","10","12"))] <- "Endothelial"
seurat$label[which(seurat$integrated_snn_res.0.4 %in% c("4"))] <- "Tcell"
seurat$label[which(seurat$integrated_snn_res.0.4 %in% c("3"))] <- "Cardiomyocyte"
seurat$label[which(seurat$integrated_snn_res.0.4 %in% c("0"))] <- "Fibroblast"
seurat$label[which(seurat$integrated_snn_res.0.4 %in% c("1","8"))] <- "Perivascular"
seurat$label[which(seurat$integrated_snn_res.0.4 %in% c("5"))] <- "resMacrophage"
seurat$label[which(seurat$integrated_snn_res.0.4 %in% c("6"))] <- "infMacrophage"

color vectors

colPal <- c(pal_igv()(12),
            pal_aaas()(10))[1:length(levels(seurat))]
colTec <- pal_jama()(length(unique(seurat$technique)))
colSmp <- c(pal_uchicago()(9), pal_npg()(10), pal_aaas()(10), 
            pal_jama()(7))[1:length(unique(seurat$dataset))]
colCond <- pal_npg()(length(unique(seurat$cond)))
colID <- c(pal_jco()(10), pal_npg()(10), pal_futurama()(10),
           pal_d3()(10))[1:length(unique(seurat$ID))]
colOrig <- pal_aaas()(length(unique(seurat$origin)))
colIso <- pal_nejm()(length(unique(seurat$isolation)))
colProc <- pal_aaas()(length(unique(seurat$processing)))
colLab <- pal_futurama()(length(unique(seurat$label)))

names(colPal) <- levels(seurat)
names(colTec) <- unique(seurat$technique)
names(colSmp) <- unique(seurat$dataset)
names(colCond) <- unique(seurat$cond)
names(colID) <- unique(seurat$ID)
names(colOrig) <- unique(seurat$origin)
names(colIso) <- unique(seurat$isolation)
names(colProc) <- unique(seurat$processing)
names(colLab) <- unique(seurat$label)

vis data

clusters

DimPlot(seurat, reduction = "umap", cols=colPal)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

label

DimPlot(seurat, reduction = "umap",  group.by = "label", cols=colLab)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

technique

DimPlot(seurat, reduction = "umap", group.by = "technique", cols=colTec)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

Sample

DimPlot(seurat, reduction = "umap", group.by = "dataset", cols=colSmp)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

ID

DimPlot(seurat, reduction = "umap", group.by = "ID", cols=colID)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

Origin

DimPlot(seurat, reduction = "umap", group.by = "origin", cols=colOrig)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

isolation

DimPlot(seurat, reduction = "umap", group.by = "isolation", cols=colIso)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

cond

DimPlot(seurat, reduction = "umap", group.by = "cond", cols=colCond)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

processing

DimPlot(seurat, reduction = "umap", group.by = "processing", cols=colProc)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(), 
        panel.grid.minor = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

cnt tables

per patient

## total cells per patient
knitr::kable(table(seurat$ID))
Var1 Freq
GZ1 2740
GZ10 3731
GZ11 3991
GZ12 3818
GZ13 9882
GZ14 1268
GZ15 4439
GZ16 436
GZ17 1370
GZ18 2280
GZ19 111
GZ2 1684
GZ20 2706
GZ21 1442
GZ22 1998
GZ23 841
GZ24 1480
GZ3 2396
GZ4 545
GZ5 781
GZ6 491
GZ7 653
GZ8 3921
GZ9 4908
SG29 1242
SG30 236
SG31 1192
SG32 1428
SG33 6286
SG34 620
SG35 2363
## celltype per patient counts
knitr::kable(table(seurat$label, seurat$ID))
GZ1 GZ10 GZ11 GZ12 GZ13 GZ14 GZ15 GZ16 GZ17 GZ18 GZ19 GZ2 GZ20 GZ21 GZ22 GZ23 GZ24 GZ3 GZ4 GZ5 GZ6 GZ7 GZ8 GZ9 SG29 SG30 SG31 SG32 SG33 SG34 SG35
Cardiomyocyte 208 1098 299 117 2207 50 117 25 71 328 1 108 46 58 159 54 117 234 45 39 12 88 714 650 109 47 178 40 212 173 304
Endothelial 471 421 819 1188 2352 326 1098 73 195 650 30 456 1256 258 279 226 286 616 184 245 155 139 795 1037 168 74 259 593 257 105 598
Fibroblast 715 983 841 1110 2217 316 1095 88 368 623 16 638 622 99 314 68 268 812 135 261 150 220 1144 1466 140 41 347 306 401 115 759
infMacrophage 162 108 275 65 288 19 109 32 106 18 7 29 36 38 113 31 29 43 22 11 19 5 120 228 187 5 36 19 1270 10 76
other 59 93 27 22 205 10 77 11 28 29 1 30 20 15 30 7 11 37 8 27 3 53 69 34 15 0 23 33 32 6 29
Perivascular 749 523 1200 1096 1817 439 1535 82 190 518 33 323 499 803 728 337 657 525 91 156 72 123 744 1000 104 56 234 321 171 145 396
resMacrophage 137 380 384 154 611 72 223 24 225 75 10 56 101 143 331 91 77 76 32 20 44 13 240 409 136 9 88 46 898 41 129
Tcell 239 125 146 66 185 36 185 101 187 39 13 44 126 28 44 27 35 53 28 22 36 12 95 84 383 4 27 70 3045 25 72
## celltype percentages per patient
datLab <- data.frame(table(seurat$label, seurat$ID))
colnames(datLab) <- c("label", "ID", "cnt")
datPat <- data.frame(table(seurat$ID))
colnames(datPat) <- c("ID", "total")
datFrac <- datLab %>% left_join(., datPat, by="ID") %>% 
  mutate(percentage = cnt*100/total)
knitr::kable(datFrac)
label ID cnt total percentage
Cardiomyocyte GZ1 208 2740 7.5912409
Endothelial GZ1 471 2740 17.1897810
Fibroblast GZ1 715 2740 26.0948905
infMacrophage GZ1 162 2740 5.9124088
other GZ1 59 2740 2.1532847
Perivascular GZ1 749 2740 27.3357664
resMacrophage GZ1 137 2740 5.0000000
Tcell GZ1 239 2740 8.7226277
Cardiomyocyte GZ10 1098 3731 29.4291075
Endothelial GZ10 421 3731 11.2838381
Fibroblast GZ10 983 3731 26.3468239
infMacrophage GZ10 108 3731 2.8946663
other GZ10 93 3731 2.4926293
Perivascular GZ10 523 3731 14.0176896
resMacrophage GZ10 380 3731 10.1849370
Tcell GZ10 125 3731 3.3503082
Cardiomyocyte GZ11 299 3991 7.4918567
Endothelial GZ11 819 3991 20.5211726
Fibroblast GZ11 841 3991 21.0724129
infMacrophage GZ11 275 3991 6.8905036
other GZ11 27 3991 0.6765222
Perivascular GZ11 1200 3991 30.0676522
resMacrophage GZ11 384 3991 9.6216487
Tcell GZ11 146 3991 3.6582310
Cardiomyocyte GZ12 117 3818 3.0644316
Endothelial GZ12 1188 3818 31.1157674
Fibroblast GZ12 1110 3818 29.0728130
infMacrophage GZ12 65 3818 1.7024620
other GZ12 22 3818 0.5762179
Perivascular GZ12 1096 3818 28.7061289
resMacrophage GZ12 154 3818 4.0335254
Tcell GZ12 66 3818 1.7286537
Cardiomyocyte GZ13 2207 9882 22.3335357
Endothelial GZ13 2352 9882 23.8008500
Fibroblast GZ13 2217 9882 22.4347298
infMacrophage GZ13 288 9882 2.9143898
other GZ13 205 9882 2.0744789
Perivascular GZ13 1817 9882 18.3869662
resMacrophage GZ13 611 9882 6.1829589
Tcell GZ13 185 9882 1.8720907
Cardiomyocyte GZ14 50 1268 3.9432177
Endothelial GZ14 326 1268 25.7097792
Fibroblast GZ14 316 1268 24.9211356
infMacrophage GZ14 19 1268 1.4984227
other GZ14 10 1268 0.7886435
Perivascular GZ14 439 1268 34.6214511
resMacrophage GZ14 72 1268 5.6782334
Tcell GZ14 36 1268 2.8391167
Cardiomyocyte GZ15 117 4439 2.6357288
Endothelial GZ15 1098 4439 24.7353007
Fibroblast GZ15 1095 4439 24.6677180
infMacrophage GZ15 109 4439 2.4555080
other GZ15 77 4439 1.7346249
Perivascular GZ15 1535 4439 34.5798603
resMacrophage GZ15 223 4439 5.0236540
Tcell GZ15 185 4439 4.1676053
Cardiomyocyte GZ16 25 436 5.7339450
Endothelial GZ16 73 436 16.7431193
Fibroblast GZ16 88 436 20.1834862
infMacrophage GZ16 32 436 7.3394495
other GZ16 11 436 2.5229358
Perivascular GZ16 82 436 18.8073394
resMacrophage GZ16 24 436 5.5045872
Tcell GZ16 101 436 23.1651376
Cardiomyocyte GZ17 71 1370 5.1824818
Endothelial GZ17 195 1370 14.2335766
Fibroblast GZ17 368 1370 26.8613139
infMacrophage GZ17 106 1370 7.7372263
other GZ17 28 1370 2.0437956
Perivascular GZ17 190 1370 13.8686131
resMacrophage GZ17 225 1370 16.4233577
Tcell GZ17 187 1370 13.6496350
Cardiomyocyte GZ18 328 2280 14.3859649
Endothelial GZ18 650 2280 28.5087719
Fibroblast GZ18 623 2280 27.3245614
infMacrophage GZ18 18 2280 0.7894737
other GZ18 29 2280 1.2719298
Perivascular GZ18 518 2280 22.7192982
resMacrophage GZ18 75 2280 3.2894737
Tcell GZ18 39 2280 1.7105263
Cardiomyocyte GZ19 1 111 0.9009009
Endothelial GZ19 30 111 27.0270270
Fibroblast GZ19 16 111 14.4144144
infMacrophage GZ19 7 111 6.3063063
other GZ19 1 111 0.9009009
Perivascular GZ19 33 111 29.7297297
resMacrophage GZ19 10 111 9.0090090
Tcell GZ19 13 111 11.7117117
Cardiomyocyte GZ2 108 1684 6.4133017
Endothelial GZ2 456 1684 27.0783848
Fibroblast GZ2 638 1684 37.8859857
infMacrophage GZ2 29 1684 1.7220903
other GZ2 30 1684 1.7814727
Perivascular GZ2 323 1684 19.1805226
resMacrophage GZ2 56 1684 3.3254157
Tcell GZ2 44 1684 2.6128266
Cardiomyocyte GZ20 46 2706 1.6999261
Endothelial GZ20 1256 2706 46.4153732
Fibroblast GZ20 622 2706 22.9859571
infMacrophage GZ20 36 2706 1.3303769
other GZ20 20 2706 0.7390983
Perivascular GZ20 499 2706 18.4405026
resMacrophage GZ20 101 2706 3.7324464
Tcell GZ20 126 2706 4.6563193
Cardiomyocyte GZ21 58 1442 4.0221914
Endothelial GZ21 258 1442 17.8918169
Fibroblast GZ21 99 1442 6.8654646
infMacrophage GZ21 38 1442 2.6352288
other GZ21 15 1442 1.0402219
Perivascular GZ21 803 1442 55.6865465
resMacrophage GZ21 143 1442 9.9167822
Tcell GZ21 28 1442 1.9417476
Cardiomyocyte GZ22 159 1998 7.9579580
Endothelial GZ22 279 1998 13.9639640
Fibroblast GZ22 314 1998 15.7157157
infMacrophage GZ22 113 1998 5.6556557
other GZ22 30 1998 1.5015015
Perivascular GZ22 728 1998 36.4364364
resMacrophage GZ22 331 1998 16.5665666
Tcell GZ22 44 1998 2.2022022
Cardiomyocyte GZ23 54 841 6.4209275
Endothelial GZ23 226 841 26.8727705
Fibroblast GZ23 68 841 8.0856124
infMacrophage GZ23 31 841 3.6860880
other GZ23 7 841 0.8323424
Perivascular GZ23 337 841 40.0713436
resMacrophage GZ23 91 841 10.8204518
Tcell GZ23 27 841 3.2104637
Cardiomyocyte GZ24 117 1480 7.9054054
Endothelial GZ24 286 1480 19.3243243
Fibroblast GZ24 268 1480 18.1081081
infMacrophage GZ24 29 1480 1.9594595
other GZ24 11 1480 0.7432432
Perivascular GZ24 657 1480 44.3918919
resMacrophage GZ24 77 1480 5.2027027
Tcell GZ24 35 1480 2.3648649
Cardiomyocyte GZ3 234 2396 9.7662771
Endothelial GZ3 616 2396 25.7095159
Fibroblast GZ3 812 2396 33.8898164
infMacrophage GZ3 43 2396 1.7946578
other GZ3 37 2396 1.5442404
Perivascular GZ3 525 2396 21.9115192
resMacrophage GZ3 76 2396 3.1719533
Tcell GZ3 53 2396 2.2120200
Cardiomyocyte GZ4 45 545 8.2568807
Endothelial GZ4 184 545 33.7614679
Fibroblast GZ4 135 545 24.7706422
infMacrophage GZ4 22 545 4.0366972
other GZ4 8 545 1.4678899
Perivascular GZ4 91 545 16.6972477
resMacrophage GZ4 32 545 5.8715596
Tcell GZ4 28 545 5.1376147
Cardiomyocyte GZ5 39 781 4.9935980
Endothelial GZ5 245 781 31.3700384
Fibroblast GZ5 261 781 33.4186940
infMacrophage GZ5 11 781 1.4084507
other GZ5 27 781 3.4571063
Perivascular GZ5 156 781 19.9743918
resMacrophage GZ5 20 781 2.5608195
Tcell GZ5 22 781 2.8169014
Cardiomyocyte GZ6 12 491 2.4439919
Endothelial GZ6 155 491 31.5682281
Fibroblast GZ6 150 491 30.5498982
infMacrophage GZ6 19 491 3.8696538
other GZ6 3 491 0.6109980
Perivascular GZ6 72 491 14.6639511
resMacrophage GZ6 44 491 8.9613035
Tcell GZ6 36 491 7.3319756
Cardiomyocyte GZ7 88 653 13.4762634
Endothelial GZ7 139 653 21.2863706
Fibroblast GZ7 220 653 33.6906585
infMacrophage GZ7 5 653 0.7656968
other GZ7 53 653 8.1163859
Perivascular GZ7 123 653 18.8361409
resMacrophage GZ7 13 653 1.9908116
Tcell GZ7 12 653 1.8376723
Cardiomyocyte GZ8 714 3921 18.2096404
Endothelial GZ8 795 3921 20.2754399
Fibroblast GZ8 1144 3921 29.1762306
infMacrophage GZ8 120 3921 3.0604438
other GZ8 69 3921 1.7597552
Perivascular GZ8 744 3921 18.9747513
resMacrophage GZ8 240 3921 6.1208875
Tcell GZ8 95 3921 2.4228513
Cardiomyocyte GZ9 650 4908 13.2436838
Endothelial GZ9 1037 4908 21.1287694
Fibroblast GZ9 1466 4908 29.8696007
infMacrophage GZ9 228 4908 4.6454768
other GZ9 34 4908 0.6927465
Perivascular GZ9 1000 4908 20.3748981
resMacrophage GZ9 409 4908 8.3333333
Tcell GZ9 84 4908 1.7114914
Cardiomyocyte SG29 109 1242 8.7761675
Endothelial SG29 168 1242 13.5265700
Fibroblast SG29 140 1242 11.2721417
infMacrophage SG29 187 1242 15.0563607
other SG29 15 1242 1.2077295
Perivascular SG29 104 1242 8.3735910
resMacrophage SG29 136 1242 10.9500805
Tcell SG29 383 1242 30.8373591
Cardiomyocyte SG30 47 236 19.9152542
Endothelial SG30 74 236 31.3559322
Fibroblast SG30 41 236 17.3728814
infMacrophage SG30 5 236 2.1186441
other SG30 0 236 0.0000000
Perivascular SG30 56 236 23.7288136
resMacrophage SG30 9 236 3.8135593
Tcell SG30 4 236 1.6949153
Cardiomyocyte SG31 178 1192 14.9328859
Endothelial SG31 259 1192 21.7281879
Fibroblast SG31 347 1192 29.1107383
infMacrophage SG31 36 1192 3.0201342
other SG31 23 1192 1.9295302
Perivascular SG31 234 1192 19.6308725
resMacrophage SG31 88 1192 7.3825503
Tcell SG31 27 1192 2.2651007
Cardiomyocyte SG32 40 1428 2.8011204
Endothelial SG32 593 1428 41.5266106
Fibroblast SG32 306 1428 21.4285714
infMacrophage SG32 19 1428 1.3305322
other SG32 33 1428 2.3109244
Perivascular SG32 321 1428 22.4789916
resMacrophage SG32 46 1428 3.2212885
Tcell SG32 70 1428 4.9019608
Cardiomyocyte SG33 212 6286 3.3725740
Endothelial SG33 257 6286 4.0884505
Fibroblast SG33 401 6286 6.3792555
infMacrophage SG33 1270 6286 20.2036271
other SG33 32 6286 0.5090678
Perivascular SG33 171 6286 2.7203309
resMacrophage SG33 898 6286 14.2857143
Tcell SG33 3045 6286 48.4409800
Cardiomyocyte SG34 173 620 27.9032258
Endothelial SG34 105 620 16.9354839
Fibroblast SG34 115 620 18.5483871
infMacrophage SG34 10 620 1.6129032
other SG34 6 620 0.9677419
Perivascular SG34 145 620 23.3870968
resMacrophage SG34 41 620 6.6129032
Tcell SG34 25 620 4.0322581
Cardiomyocyte SG35 304 2363 12.8650021
Endothelial SG35 598 2363 25.3068134
Fibroblast SG35 759 2363 32.1201862
infMacrophage SG35 76 2363 3.2162505
other SG35 29 2363 1.2272535
Perivascular SG35 396 2363 16.7583580
resMacrophage SG35 129 2363 5.4591621
Tcell SG35 72 2363 3.0469742
ggbarplot(datFrac, x="ID", y="percentage",
          fill = "label",
          palette = colLab) +
  rotate_x_text(angle = 90)

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

per cond

## total cells per cond
knitr::kable(table(seurat$cond))
Var1 Freq
HH 36012
InfCardiomyopathy 1428
inflamation 236
Myocarditis 32411
Perimyocarditis 1192
## celltype per cond counts
knitr::kable(table(seurat$label, seurat$cond))
HH InfCardiomyopathy inflamation Myocarditis Perimyocarditis
Cardiomyocyte 5473 40 47 2170 178
Endothelial 7661 593 74 7022 259
Fibroblast 8510 306 41 7474 347
infMacrophage 1295 19 5 2161 36
other 513 33 0 475 23
Perivascular 8905 321 56 6151 234
resMacrophage 2820 46 9 2312 88
Tcell 835 70 4 4646 27
## celltype percentages per cond
datLab <- data.frame(table(seurat$label, seurat$cond))
colnames(datLab) <- c("label", "cond", "cnt")
datPat <- data.frame(table(seurat$cond))
colnames(datPat) <- c("cond", "total")
datFrac <- datLab %>% left_join(., datPat, by="cond") %>% 
  mutate(percentage = cnt*100/total)
knitr::kable(datFrac)
label cond cnt total percentage
Cardiomyocyte HH 5473 36012 15.197712
Endothelial HH 7661 36012 21.273464
Fibroblast HH 8510 36012 23.631012
infMacrophage HH 1295 36012 3.596023
other HH 513 36012 1.424525
Perivascular HH 8905 36012 24.727868
resMacrophage HH 2820 36012 7.830723
Tcell HH 835 36012 2.318672
Cardiomyocyte InfCardiomyopathy 40 1428 2.801120
Endothelial InfCardiomyopathy 593 1428 41.526611
Fibroblast InfCardiomyopathy 306 1428 21.428571
infMacrophage InfCardiomyopathy 19 1428 1.330532
other InfCardiomyopathy 33 1428 2.310924
Perivascular InfCardiomyopathy 321 1428 22.478992
resMacrophage InfCardiomyopathy 46 1428 3.221288
Tcell InfCardiomyopathy 70 1428 4.901961
Cardiomyocyte inflamation 47 236 19.915254
Endothelial inflamation 74 236 31.355932
Fibroblast inflamation 41 236 17.372881
infMacrophage inflamation 5 236 2.118644
other inflamation 0 236 0.000000
Perivascular inflamation 56 236 23.728814
resMacrophage inflamation 9 236 3.813559
Tcell inflamation 4 236 1.694915
Cardiomyocyte Myocarditis 2170 32411 6.695258
Endothelial Myocarditis 7022 32411 21.665484
Fibroblast Myocarditis 7474 32411 23.060072
infMacrophage Myocarditis 2161 32411 6.667489
other Myocarditis 475 32411 1.465552
Perivascular Myocarditis 6151 32411 18.978125
resMacrophage Myocarditis 2312 32411 7.133381
Tcell Myocarditis 4646 32411 14.334639
Cardiomyocyte Perimyocarditis 178 1192 14.932886
Endothelial Perimyocarditis 259 1192 21.728188
Fibroblast Perimyocarditis 347 1192 29.110738
infMacrophage Perimyocarditis 36 1192 3.020134
other Perimyocarditis 23 1192 1.929530
Perivascular Perimyocarditis 234 1192 19.630872
resMacrophage Perimyocarditis 88 1192 7.382550
Tcell Perimyocarditis 27 1192 2.265101
ggbarplot(datFrac, x="cond", y="percentage",
          fill = "label",
          palette = colLab) +
  rotate_x_text(angle = 90)

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

assign groups based on T cell fraction

TcellGrp <- read_tsv(paste0(basedir, "/data/assignTcellGrp.txt"))
IDtoTcell <- data.frame(ID=seurat$ID) %>% left_join(., TcellGrp, by="ID")
seurat$TcellGrp <- IDtoTcell$TcellGrp
table(seurat$TcellGrp)

     Ctrl TcellHigh  TcellLow 
    36012     24777     10254 
table(seurat$TcellGrp, seurat$ID)
           
             GZ1 GZ10 GZ11 GZ12 GZ13 GZ14 GZ15 GZ16 GZ17 GZ18 GZ19  GZ2 GZ20
  Ctrl         0 3731 3991 3818 9882    0    0    0    0    0    0    0    0
  TcellHigh 2740    0    0    0    0    0 4439  436 1370    0  111    0 2706
  TcellLow     0    0    0    0    0 1268    0    0    0 2280    0 1684    0
           
            GZ21 GZ22 GZ23 GZ24  GZ3  GZ4  GZ5  GZ6  GZ7  GZ8  GZ9 SG29 SG30
  Ctrl      1442 1998  841 1480    0    0    0    0    0 3921 4908    0    0
  TcellHigh    0    0    0    0    0  545    0  491    0    0    0 1242    0
  TcellLow     0    0    0    0 2396    0  781    0  653    0    0    0    0
           
            SG31 SG32 SG33 SG34 SG35
  Ctrl         0    0    0    0    0
  TcellHigh    0 1428 6286  620 2363
  TcellLow  1192    0    0    0    0

vis marker for celltype assignment

heatmap

genes <- data.frame(gene=rownames(seurat)) %>% 
    mutate(geneID=gsub("^.*\\.", "", gene)) 

selGenesAll <- read_tsv(file = paste0(basedir,
                                      "/data/markerLabels.txt")) %>% 
  left_join(., genes, by = "geneID")

Idents(seurat) <- seurat$seurat_clusters
pOut <- avgHeatmap(seurat = seurat, selGenes = selGenesAll,
                  colVecIdent = colPal, 
                  ordVec=levels(seurat),
                  gapVecR=NULL, gapVecC=NULL,cc=T,
                  cr=F, condCol=F)

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06
Idents(seurat) <- seurat$label
pOut <- avgHeatmap(seurat = seurat, selGenes = selGenesAll,
                  colVecIdent = colLab, 
                  ordVec=levels(seurat),
                  gapVecR=NULL, gapVecC=NULL,cc=T,
                  cr=F, condCol=F)

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

Dotplot

DotPlot(seurat, assay="RNA", features = selGenesAll$gene, scale =T,
        cluster.idents = T) +
  scale_color_viridis_c() +
  coord_flip() +
  theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
  scale_x_discrete(breaks=selGenesAll$gene, labels=selGenesAll$geneID) +
  xlab("") + ylab("")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06
Idents(seurat) <- seurat$seurat_clusters
DotPlot(seurat, assay="RNA", features = selGenesAll$gene, scale =T,
        cluster.idents = T) +
  scale_color_viridis_c() +
  coord_flip() +
  theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
  scale_x_discrete(breaks=selGenesAll$gene, labels=selGenesAll$geneID) +
  xlab("") + ylab("")

Version Author Date
e6d0c3c mluetge 2022-09-26
cd902dd mluetge 2022-09-12
141fae8 mluetge 2022-07-06

exclude two patients with very low nuclei

## two patients with <250 nuclei --> exclude from downstream analysis
table(seurat$ID)

 GZ1 GZ10 GZ11 GZ12 GZ13 GZ14 GZ15 GZ16 GZ17 GZ18 GZ19  GZ2 GZ20 GZ21 GZ22 GZ23 
2740 3731 3991 3818 9882 1268 4439  436 1370 2280  111 1684 2706 1442 1998  841 
GZ24  GZ3  GZ4  GZ5  GZ6  GZ7  GZ8  GZ9 SG29 SG30 SG31 SG32 SG33 SG34 SG35 
1480 2396  545  781  491  653 3921 4908 1242  236 1192 1428 6286  620 2363 
seurat <- subset(seurat, ID %in% c("GZ19", "SG30"), invert=T)
table(seurat$ID)

 GZ1 GZ10 GZ11 GZ12 GZ13 GZ14 GZ15 GZ16 GZ17 GZ18  GZ2 GZ20 GZ21 GZ22 GZ23 GZ24 
2740 3731 3991 3818 9882 1268 4439  436 1370 2280 1684 2706 1442 1998  841 1480 
 GZ3  GZ4  GZ5  GZ6  GZ7  GZ8  GZ9 SG29 SG31 SG32 SG33 SG34 SG35 
2396  545  781  491  653 3921 4908 1242 1192 1428 6286  620 2363 

save seurat object

saveRDS(seurat, file = paste0(basedir, 
                              "/data/humanHeartsPlusGraz_intPatients_merged", 
                              "labeled_seurat.rds"))

session info

sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur ... 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] sctransform_0.3.5           viridis_0.6.2              
 [3] viridisLite_0.4.1           pheatmap_1.0.12            
 [5] ggpubr_0.4.0                ggsci_2.9                  
 [7] runSeurat3_0.1.0            here_1.0.1                 
 [9] magrittr_2.0.3              sp_1.5-0                   
[11] SeuratObject_4.1.2          Seurat_4.2.0               
[13] forcats_0.5.2               stringr_1.4.1              
[15] dplyr_1.0.10                purrr_0.3.5                
[17] readr_2.1.3                 tidyr_1.2.1                
[19] tibble_3.1.8                ggplot2_3.3.6              
[21] tidyverse_1.3.2             SingleCellExperiment_1.18.1
[23] SummarizedExperiment_1.26.1 Biobase_2.56.0             
[25] GenomicRanges_1.48.0        GenomeInfoDb_1.32.4        
[27] IRanges_2.30.1              S4Vectors_0.34.0           
[29] BiocGenerics_0.42.0         MatrixGenerics_1.8.1       
[31] matrixStats_0.62.0         

loaded via a namespace (and not attached):
  [1] utf8_1.2.2             reticulate_1.26        tidyselect_1.2.0      
  [4] htmlwidgets_1.5.4      grid_4.2.1             Rtsne_0.16            
  [7] munsell_0.5.0          codetools_0.2-18       ica_1.0-3             
 [10] future_1.28.0          miniUI_0.1.1.1         withr_2.5.0           
 [13] spatstat.random_2.2-0  colorspace_2.0-3       progressr_0.11.0      
 [16] highr_0.9              knitr_1.40             rstudioapi_0.14       
 [19] ROCR_1.0-11            ggsignif_0.6.3         tensor_1.5            
 [22] listenv_0.8.0          labeling_0.4.2         git2r_0.30.1          
 [25] GenomeInfoDbData_1.2.8 polyclip_1.10-0        bit64_4.0.5           
 [28] farver_2.1.1           rprojroot_2.0.3        parallelly_1.32.1     
 [31] vctrs_0.4.2            generics_0.1.3         xfun_0.33             
 [34] R6_2.5.1               bitops_1.0-7           spatstat.utils_2.3-1  
 [37] cachem_1.0.6           DelayedArray_0.22.0    assertthat_0.2.1      
 [40] vroom_1.6.0            promises_1.2.0.1       scales_1.2.1          
 [43] googlesheets4_1.0.1    rgeos_0.5-9            gtable_0.3.1          
 [46] globals_0.16.1         goftest_1.2-3          workflowr_1.7.0       
 [49] rlang_1.0.6            splines_4.2.1          rstatix_0.7.0         
 [52] lazyeval_0.2.2         gargle_1.2.1           spatstat.geom_2.4-0   
 [55] broom_1.0.1            yaml_2.3.5             reshape2_1.4.4        
 [58] abind_1.4-5            modelr_0.1.9           backports_1.4.1       
 [61] httpuv_1.6.6           tools_4.2.1            ellipsis_0.3.2        
 [64] spatstat.core_2.4-4    jquerylib_0.1.4        RColorBrewer_1.1-3    
 [67] ggridges_0.5.4         Rcpp_1.0.9             plyr_1.8.7            
 [70] zlibbioc_1.42.0        RCurl_1.98-1.9         rpart_4.1.16          
 [73] deldir_1.0-6           pbapply_1.5-0          cowplot_1.1.1         
 [76] zoo_1.8-11             haven_2.5.1            ggrepel_0.9.1         
 [79] cluster_2.1.4          fs_1.5.2               data.table_1.14.2     
 [82] scattermore_0.8        lmtest_0.9-40          reprex_2.0.2          
 [85] RANN_2.6.1             googledrive_2.0.0      whisker_0.4           
 [88] fitdistrplus_1.1-8     hms_1.1.2              patchwork_1.1.2       
 [91] mime_0.12              evaluate_0.17          xtable_1.8-4          
 [94] readxl_1.4.1           gridExtra_2.3          compiler_4.2.1        
 [97] KernSmooth_2.23-20     crayon_1.5.2           htmltools_0.5.3       
[100] mgcv_1.8-40            later_1.3.0            tzdb_0.3.0            
[103] lubridate_1.8.0        DBI_1.1.3              dbplyr_2.2.1          
[106] MASS_7.3-58.1          Matrix_1.5-1           car_3.1-0             
[109] cli_3.4.1              parallel_4.2.1         igraph_1.3.5          
[112] pkgconfig_2.0.3        plotly_4.10.0          spatstat.sparse_2.1-1 
[115] xml2_1.3.3             bslib_0.4.0            XVector_0.36.0        
[118] rvest_1.0.3            digest_0.6.29          RcppAnnoy_0.0.19      
[121] spatstat.data_2.2-0    rmarkdown_2.17         cellranger_1.1.0      
[124] leiden_0.4.3           uwot_0.1.14            shiny_1.7.2           
[127] lifecycle_1.0.3        nlme_3.1-159           jsonlite_1.8.2        
[130] carData_3.0-5          fansi_1.0.3            pillar_1.8.1          
[133] lattice_0.20-45        fastmap_1.1.0          httr_1.4.4            
[136] survival_3.4-0         glue_1.6.2             png_0.1-7             
[139] bit_4.0.4              stringi_1.7.8          sass_0.4.2            
[142] irlba_2.3.5.1          future.apply_1.9.1    
date()
[1] "Thu Oct 13 09:59:49 2022"

sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur ... 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] sctransform_0.3.5           viridis_0.6.2              
 [3] viridisLite_0.4.1           pheatmap_1.0.12            
 [5] ggpubr_0.4.0                ggsci_2.9                  
 [7] runSeurat3_0.1.0            here_1.0.1                 
 [9] magrittr_2.0.3              sp_1.5-0                   
[11] SeuratObject_4.1.2          Seurat_4.2.0               
[13] forcats_0.5.2               stringr_1.4.1              
[15] dplyr_1.0.10                purrr_0.3.5                
[17] readr_2.1.3                 tidyr_1.2.1                
[19] tibble_3.1.8                ggplot2_3.3.6              
[21] tidyverse_1.3.2             SingleCellExperiment_1.18.1
[23] SummarizedExperiment_1.26.1 Biobase_2.56.0             
[25] GenomicRanges_1.48.0        GenomeInfoDb_1.32.4        
[27] IRanges_2.30.1              S4Vectors_0.34.0           
[29] BiocGenerics_0.42.0         MatrixGenerics_1.8.1       
[31] matrixStats_0.62.0         

loaded via a namespace (and not attached):
  [1] utf8_1.2.2             reticulate_1.26        tidyselect_1.2.0      
  [4] htmlwidgets_1.5.4      grid_4.2.1             Rtsne_0.16            
  [7] munsell_0.5.0          codetools_0.2-18       ica_1.0-3             
 [10] future_1.28.0          miniUI_0.1.1.1         withr_2.5.0           
 [13] spatstat.random_2.2-0  colorspace_2.0-3       progressr_0.11.0      
 [16] highr_0.9              knitr_1.40             rstudioapi_0.14       
 [19] ROCR_1.0-11            ggsignif_0.6.3         tensor_1.5            
 [22] listenv_0.8.0          labeling_0.4.2         git2r_0.30.1          
 [25] GenomeInfoDbData_1.2.8 polyclip_1.10-0        bit64_4.0.5           
 [28] farver_2.1.1           rprojroot_2.0.3        parallelly_1.32.1     
 [31] vctrs_0.4.2            generics_0.1.3         xfun_0.33             
 [34] R6_2.5.1               bitops_1.0-7           spatstat.utils_2.3-1  
 [37] cachem_1.0.6           DelayedArray_0.22.0    assertthat_0.2.1      
 [40] vroom_1.6.0            promises_1.2.0.1       scales_1.2.1          
 [43] googlesheets4_1.0.1    rgeos_0.5-9            gtable_0.3.1          
 [46] globals_0.16.1         goftest_1.2-3          workflowr_1.7.0       
 [49] rlang_1.0.6            splines_4.2.1          rstatix_0.7.0         
 [52] lazyeval_0.2.2         gargle_1.2.1           spatstat.geom_2.4-0   
 [55] broom_1.0.1            yaml_2.3.5             reshape2_1.4.4        
 [58] abind_1.4-5            modelr_0.1.9           backports_1.4.1       
 [61] httpuv_1.6.6           tools_4.2.1            ellipsis_0.3.2        
 [64] spatstat.core_2.4-4    jquerylib_0.1.4        RColorBrewer_1.1-3    
 [67] ggridges_0.5.4         Rcpp_1.0.9             plyr_1.8.7            
 [70] zlibbioc_1.42.0        RCurl_1.98-1.9         rpart_4.1.16          
 [73] deldir_1.0-6           pbapply_1.5-0          cowplot_1.1.1         
 [76] zoo_1.8-11             haven_2.5.1            ggrepel_0.9.1         
 [79] cluster_2.1.4          fs_1.5.2               data.table_1.14.2     
 [82] scattermore_0.8        lmtest_0.9-40          reprex_2.0.2          
 [85] RANN_2.6.1             googledrive_2.0.0      whisker_0.4           
 [88] fitdistrplus_1.1-8     hms_1.1.2              patchwork_1.1.2       
 [91] mime_0.12              evaluate_0.17          xtable_1.8-4          
 [94] readxl_1.4.1           gridExtra_2.3          compiler_4.2.1        
 [97] KernSmooth_2.23-20     crayon_1.5.2           htmltools_0.5.3       
[100] mgcv_1.8-40            later_1.3.0            tzdb_0.3.0            
[103] lubridate_1.8.0        DBI_1.1.3              dbplyr_2.2.1          
[106] MASS_7.3-58.1          Matrix_1.5-1           car_3.1-0             
[109] cli_3.4.1              parallel_4.2.1         igraph_1.3.5          
[112] pkgconfig_2.0.3        plotly_4.10.0          spatstat.sparse_2.1-1 
[115] xml2_1.3.3             bslib_0.4.0            XVector_0.36.0        
[118] rvest_1.0.3            digest_0.6.29          RcppAnnoy_0.0.19      
[121] spatstat.data_2.2-0    rmarkdown_2.17         cellranger_1.1.0      
[124] leiden_0.4.3           uwot_0.1.14            shiny_1.7.2           
[127] lifecycle_1.0.3        nlme_3.1-159           jsonlite_1.8.2        
[130] carData_3.0-5          fansi_1.0.3            pillar_1.8.1          
[133] lattice_0.20-45        fastmap_1.1.0          httr_1.4.4            
[136] survival_3.4-0         glue_1.6.2             png_0.1-7             
[139] bit_4.0.4              stringi_1.7.8          sass_0.4.2            
[142] irlba_2.3.5.1          future.apply_1.9.1