Last updated: 2023-02-16

Checks: 6 1

Knit directory: scSeq_Hefendehl/

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.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

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(20220131) 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.

Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.

absolute relative
/files/scSeq_Hefendehl/shinySecret.R shinySecret.R

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 eaa373d. 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:    .RData
    Ignored:    .Rproj.user/
    Ignored:    data/20230203/
    Ignored:    data/Alignments/
    Ignored:    data/Cluster.markers_02-02-2023.xlsx
    Ignored:    data/DAM_genelists.RData
    Ignored:    data/ReloadAllData_Hefendehl_Stroke_Dec'21.RData
    Ignored:    data/Sample_Tables/
    Ignored:    data/Stroke-SS2_SCT-harmony_Hefendehl.html
    Ignored:    data/counts.csv
    Ignored:    data/genecounts.csv
    Ignored:    data/microglia-SCT_02-02-23.rds
    Ignored:    data/microglia_protein.rds
    Ignored:    data/samples.integrated.RData
    Ignored:    data/seu-SCT-harmony_02-02-23.rds
    Ignored:    data/seu_filtered_nonorm_02-02-23.rds
    Ignored:    data/tx2genes.csv
    Ignored:    output/integrated_analysis.RData

Untracked files:
    Untracked:  shinySecret.R
    Untracked:  wflowhelper.R

Unstaged changes:
    Modified:   _workflowr.yml
    Modified:   data/README.md
    Modified:   geneviewer/Dataset.RData
    Modified:   geneviewer/app.R
    Modified:   geneviewer/rsconnect/shinyapps.io/molgenlab/geneviewer.dcf

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/01_Biostat.Rmd) and HTML (docs/01_Biostat.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 eaa373d Andreas Chiocchetti 2023-02-16 workflowr::wflow_publish(c("./docs/", "./analysis/", "./code/*",
html eaa373d Andreas Chiocchetti 2023-02-16 workflowr::wflow_publish(c("./docs/", "./analysis/", "./code/*",
html 7764484 achiocch 2022-06-27 Build site.
html 14e1ee0 achiocch 2022-06-27 Build site.
Rmd 5bba014 achiocch 2022-06-27 wflow_publish(c("analysis/", "docs/", "code/*"))
html 5bba014 achiocch 2022-06-27 wflow_publish(c("analysis/", "docs/", "code/*"))
html 3451e15 achiocch 2022-06-22 Build site.
Rmd cfbfcf6 achiocch 2022-06-22 wflow_publish(c("analysis/", "docs/", "code/*"))
html cfbfcf6 achiocch 2022-06-22 wflow_publish(c("analysis/", "docs/", "code/*"))
html faf20e9 achiocch 2022-05-16 Build site.
Rmd 8791434 achiocch 2022-05-16 wflow_publish(c("analysis/", "docs/", "code/*"))
html 8791434 achiocch 2022-05-16 wflow_publish(c("analysis/", "docs/", "code/*"))
html 51b35c8 achiocch 2022-04-26 Build site.
Rmd 3277c08 achiocch 2022-04-26 wflow_publish(c("analysis/", "docs/", "code/*"))
html 41d6cd0 achiocch 2022-04-26 Build site.
Rmd 7d20262 achiocch 2022-04-26 wflow_publish(c("analysis/", "docs/", "code/*"))
Rmd 8e44cfc achiocch 2022-04-22 wflow_publish(c("analysis/", "docs/", "code/*"))
html 8e44cfc achiocch 2022-04-22 wflow_publish(c("analysis/", "docs/", "code/*"))
html 9b778b1 achiocch 2022-04-19 Build site.
Rmd d2ed458 achiocch 2022-04-19 wflow_publish(c("analysis/", "docs/", "code/*"))
html d2ed458 achiocch 2022-04-19 wflow_publish(c("analysis/", "docs/", "code/*"))
html 55b3c82 achiocch 2022-04-08 wflow_publish(c("analysis/", "docs/", "code/*"))
html cf395f4 achiocch 2022-03-30 Build site.
Rmd 55e7738 achiocch 2022-03-30 wflow_publish(c("analysis/", "docs/", "code/*"))
html 55e7738 achiocch 2022-03-30 wflow_publish(c("analysis/", "docs/", "code/*"))
html c998828 achiocch 2022-03-30 Build site.
Rmd f21fdf7 achiocch 2022-03-30 wflow_publish(c("analysis/", "docs/", "code/*"))
html f21fdf7 achiocch 2022-03-30 wflow_publish(c("analysis/", "docs/", "code/*"))
html 87439a3 achiocch 2022-02-21 Build site.
Rmd ef56d05 achiocch 2022-02-21 wflow_publish(c("analysis/", "docs/", "code/*"))
html d6f2105 achiocch 2022-02-21 Build site.
Rmd b832d1c achiocch 2022-02-21 wflow_publish(c("analysis/", "docs/", "code/*"))
Rmd 95fb700 achiocch 2022-02-21 wflow_publish(c("analysis/", "docs/", "code/*"))
html 95fb700 achiocch 2022-02-21 wflow_publish(c("analysis/", "docs/", "code/*"))
html 79dd0b1 achiocch 2022-02-21 Build site.
Rmd 73aabec achiocch 2022-02-21 wflow_publish(c("analysis/", "docs/", "code/*"))
html ded601d achiocch 2022-02-03 Build site.
Rmd 858d646 achiocch 2022-02-03 wflow_publish(c("analysis/", "docs/", "code/*"))
html 858d646 achiocch 2022-02-03 wflow_publish(c("analysis/", "docs/", "code/*"))
html 50fe211 achiocch 2022-02-03 Build site.
Rmd 64cd37c achiocch 2022-02-03 wflow_publish(c("analysis/", "docs/", "code/*"))
html 5fbdba4 achiocch 2022-02-02 Build site.
Rmd 636a117 achiocch 2022-02-02 wflow_publish(c("analysis/", "docs/", "code/*"))
html 636a117 achiocch 2022-02-02 wflow_publish(c("analysis/", "docs/", "code/*"))
Rmd 9044798 Andreas Geburtig-Chiocchetti 2022-02-02 workflowr automated
Rmd 57c9e70 achiocch 2022-02-02 adds initial html files
html 57c9e70 achiocch 2022-02-02 adds initial html files
Rmd ddb6373 achiocch 2022-02-02 first commit

#get sample data
samples.integrated@meta.data %>% as.data.frame() -> samplemeta


# convert to correct data type 

# define genotype as is
samplemeta$Genotype_corr = factor(samplemeta$Genotype=="WT", levels=c(F,T), labels = c("APPPS1+", "WT"))
samplemeta$Genotype_corr = relevel(samplemeta$Genotype_corr, ref="WT")

samplemeta$methoxy = factor(samplemeta$Methoxy=="pos", levels=c(T,F), labels = c("MX04+", "MX04-"))

samplemeta$Treatment = as.factor(samplemeta$Treatment)
samplemeta$Treatment = relevel(samplemeta$Treatment, ref="Ctrl")
samplemeta$Mouse_ID = as.factor(samplemeta$Mouse_ID)
samplemeta$Sex = as.factor(samplemeta$Gender)
samplemeta$Brain_region = as.factor(samplemeta$Brain_region)
samplemeta$Celltype = as.factor(samplemeta$Celltype)

samples.integrated@meta.data = samplemeta

nCells=nrow(samplemeta)
nMice=nlevels(samplemeta$Mouse_ID)
nCelltypes=nlevels(samplemeta$Celltype)

Sample descriptive:

Data contains a total of 905 Cells from 9.

Cells per Mouse

Cells per Strain

table(Mouse_ID=samplemeta$Mouse_ID) %>% as.data.frame() %>% display_tab()

Cells per Genotype

table(Genotype=samplemeta$Genotype_corr, Treatment=samplemeta$Treatment) %>% as.data.frame() %>% display_tab()
table(Genotype=samplemeta$Genotype_corr, Celltype=samplemeta$Celltype) %>% 
  as.data.frame() %>% display_tab()
table(Genotype=samplemeta$Genotype_corr, 
      Celltype=samplemeta$Celltype, Treatment=samplemeta$Treatment
) %>% 
  as.data.frame() %>% display_tab()
samplemeta$condition=paste0(samplemeta$Genotype_corr,"_", samplemeta$Treatment)
samples.integrated@meta.data = samplemeta

sce=as.SingleCellExperiment(samples.integrated)

sce <- slingshot(sce, clusterLabels = 'Celltype', reducedDim = 'UMAP')
samplemeta$Pseudotime <- sce$slingPseudotime_1
samples.integrated@meta.data = samplemeta

variables=c("Celltype","Sex", "Age","Genotype_corr", "Treatment", "condition","Phase", "Pseudotime","Brain_region","nCount_RNA","pseudoaligned_reads", "percent.mt", "percent.rp", "Mouse_ID")

Descriptive stats across Cell type

res = compareGroups(Celltype~., data = samplemeta[,variables], max.ylev = 10)
#summary(res)
export_table <- createTable(res)
options(width = 10000)
export2md(export_table)
Summary descriptives table by groups of `Celltype’
Microglia_1 Microglia_2 Microglia_3 Microglia_4 Granulocytes Microglia_5 Mono/Mac p.overall
N=476 N=160 N=143 N=45 N=27 N=19 N=35
Sex: .
f 91 (19.1%) 40 (25.0%) 52 (36.4%) 8 (17.8%) 13 (48.1%) 5 (26.3%) 8 (22.9%)
m 385 (80.9%) 120 (75.0%) 91 (63.6%) 37 (82.2%) 14 (51.9%) 14 (73.7%) 27 (77.1%)
Age: .
37 weeks 295 (62.0%) 100 (62.5%) 83 (58.0%) 14 (31.1%) 15 (55.6%) 8 (42.1%) 18 (51.4%)
38 weeks 49 (10.3%) 11 (6.88%) 16 (11.2%) 3 (6.67%) 3 (11.1%) 4 (21.1%) 4 (11.4%)
40 weeks 132 (27.7%) 49 (30.6%) 44 (30.8%) 28 (62.2%) 9 (33.3%) 7 (36.8%) 13 (37.1%)
Genotype_corr: 0.506
WT 200 (42.0%) 65 (40.6%) 61 (42.7%) 14 (31.1%) 9 (33.3%) 10 (52.6%) 18 (51.4%)
APPPS1+ 276 (58.0%) 95 (59.4%) 82 (57.3%) 31 (68.9%) 18 (66.7%) 9 (47.4%) 17 (48.6%)
Treatment: <0.001
Ctrl 337 (70.8%) 96 (60.0%) 70 (49.0%) 13 (28.9%) 5 (18.5%) 13 (68.4%) 13 (37.1%)
Stroke 139 (29.2%) 64 (40.0%) 73 (51.0%) 32 (71.1%) 22 (81.5%) 6 (31.6%) 22 (62.9%)
condition: .
APPPS1+_Ctrl 220 (46.2%) 54 (33.8%) 21 (14.7%) 3 (6.67%) 0 (0.00%) 8 (42.1%) 5 (14.3%)
APPPS1+_Stroke 56 (11.8%) 41 (25.6%) 61 (42.7%) 28 (62.2%) 18 (66.7%) 1 (5.26%) 12 (34.3%)
WT_Ctrl 117 (24.6%) 42 (26.2%) 49 (34.3%) 10 (22.2%) 5 (18.5%) 5 (26.3%) 8 (22.9%)
WT_Stroke 83 (17.4%) 23 (14.4%) 12 (8.39%) 4 (8.89%) 4 (14.8%) 5 (26.3%) 10 (28.6%)
Phase: .
G1 211 (44.3%) 60 (37.5%) 46 (32.2%) 20 (44.4%) 8 (29.6%) 12 (63.2%) 12 (34.3%)
G2M 114 (23.9%) 38 (23.8%) 40 (28.0%) 11 (24.4%) 11 (40.7%) 3 (15.8%) 13 (37.1%)
S 151 (31.7%) 62 (38.8%) 57 (39.9%) 14 (31.1%) 8 (29.6%) 4 (21.1%) 10 (28.6%)
Pseudotime 3.65 (1.91) 8.25 (1.04) 11.4 (1.55) . (.) 25.4 (0.15) 0.37 (0.28) . (.) 0.000
Brain_region: <0.001
Cortex 337 (70.8%) 96 (60.0%) 70 (49.0%) 13 (28.9%) 5 (18.5%) 13 (68.4%) 13 (37.1%)
Lesion 139 (29.2%) 64 (40.0%) 73 (51.0%) 32 (71.1%) 22 (81.5%) 6 (31.6%) 22 (62.9%)
nCount_RNA 144231 (99988) 165293 (106792) 101350 (115577) 45112 (115701) 128528 (83221) 156629 (113020) 139846 (82161) <0.001
pseudoaligned_reads 144728 (100322) 165698 (106875) 102184 (115632) 45218 (115828) 128986 (83445) 157045 (113080) 140931 (82079) <0.001
percent.mt 1.84 (1.32) 2.44 (1.89) 1.37 (1.37) 1.05 (1.56) 0.86 (0.96) 1.98 (0.91) 1.99 (1.37) <0.001
percent.rp 2.10 (1.25) 2.82 (2.11) 1.10 (1.37) 0.52 (0.67) 1.63 (0.96) 2.12 (1.25) 3.14 (2.50) <0.001
Mouse_ID: .
256#1022 35 (7.35%) 15 (9.38%) 15 (10.5%) 3 (6.67%) 0 (0.00%) 1 (5.26%) 2 (5.71%)
256#1023 33 (6.93%) 16 (10.0%) 18 (12.6%) 4 (8.89%) 2 (7.41%) 0 (0.00%) 2 (5.71%)
364#469 49 (10.3%) 11 (6.88%) 16 (11.2%) 3 (6.67%) 3 (11.1%) 4 (21.1%) 4 (11.4%)
386 21 (4.41%) 6 (3.75%) 11 (7.69%) 4 (8.89%) 1 (3.70%) 1 (5.26%) 6 (17.1%)
387 14 (2.94%) 12 (7.50%) 25 (17.5%) 23 (51.1%) 8 (29.6%) 0 (0.00%) 7 (20.0%)
388 97 (20.4%) 31 (19.4%) 8 (5.59%) 1 (2.22%) 0 (0.00%) 6 (31.6%) 0 (0.00%)
409 62 (13.0%) 17 (10.6%) 1 (0.70%) 0 (0.00%) 3 (11.1%) 4 (21.1%) 4 (11.4%)
457 123 (25.8%) 23 (14.4%) 13 (9.09%) 2 (4.44%) 0 (0.00%) 2 (10.5%) 5 (14.3%)
461 42 (8.82%) 29 (18.1%) 36 (25.2%) 5 (11.1%) 10 (37.0%) 1 (5.26%) 5 (14.3%)
export2xls(export_table,paste0(home,"/docs/Descriptives.xlsx"))

download data as excel file here

Preprocessing

include only genes that are different across samples (5 974 excluded) include only genes with more than 10 reads in at least 10 cells in at least one Celltype (21 733 transcripts excluded) exclude all cells with less than 10000 reads (none excluded)

649 cells and 11 623 transcripts analyzed

#get normalized counts 
# question to Desiree hat the Seurat object been initialized with normalized data?
counts <- samples.integrated@assays$RNA@counts %>% as.data.frame()

# drop no variance data and sort by samplemeta
counts <- counts[apply(counts,1, sd) > 0, rownames(samplemeta)]

# drop genes with low detection rate (more than 5 counts per cell)
counts_per_celltype=apply(counts, 1, function(x){tapply(x, samplemeta$Celltype, function(z){sum(z>10,na.rm=T)})}) %>% as.data.frame()

# keep RNAs with at least 10 cells with good expression
idxr=which(colSums(counts_per_celltype)>10)

idxc=which(colSums(counts)>10000)

counts = counts[idxr,idxc]
samplemeta=samplemeta[colnames(counts), ]

Overview tables

samplemeta$corrGenotype_Treatment<-
  paste0(samplemeta$Genotype_corr," ", samplemeta$Treatment)

sumstat = counts %>% t() %>%  
  aggregate(by=samplemeta["corrGenotype_Treatment"], mean) %>% 
  t() %>% as.data.frame()

names(sumstat) <- paste0("mean",sumstat[1,])
sumstat<-sumstat[-1,]

sumstatCelltype = counts %>% t() %>%  
  aggregate(by=samplemeta["Celltype"], mean) %>% 
  t() %>% as.data.frame()

names(sumstatCelltype) <- paste0("mean",sumstatCelltype[1,])
sumstatCelltype<-sumstatCelltype[-1,]


Geno.Treatment_kruskal=apply(counts,1, function(x){
  res = kruskal.test(unlist(x)~samplemeta$corrGenotype_Treatment) %>% unlist()
  return(as.numeric(res["p.value"]))
})

Geno.Treatment_kruskal_fdr = p.adjust(Geno.Treatment_kruskal, method = "fdr")

Celltype_kruskal=apply(counts,1, function(x){
   res = kruskal.test(unlist(x)~samplemeta$Celltype) %>% unlist()
  return(as.numeric(res["p.value"]))
})

Celltype_kruskal_fdr = p.adjust(Celltype_kruskal, method = "fdr")

summarytab=cbind(sumstat, Geno.Treatment_kruskal, Geno.Treatment_kruskal_fdr , sumstatCelltype, Celltype_kruskal, Celltype_kruskal_fdr)

summarytab %>% display_tab()
Warning in instance$preRenderHook(instance): It seems your data is too big for client-side DataTables. You may consider server-side processing: https://rstudio.github.io/DT/server.html

Hierarchical clustering

to check where the variance in the data comes from

log2_cpm = log2(counts+1)

varsset=apply(log2_cpm, 1, var)

cpm.sel.trans = t(log2_cpm[order(varsset,decreasing = T)[1:1000],])

distance = dist(cpm.sel.trans)

sampleDistMatrix <- as.matrix(distance)

#colors for plotting heatmap
colors <- rev(colorRampPalette(brewer.pal(9, "Spectral"))(255))
colors=jetcolors(255)
colors=viridis(255)

cellcol = Dark8[1:nlevels(samplemeta$Celltype)]
names(cellcol) = levels(samplemeta$Celltype)

genotypecol = brewer.pal(4,"Accent")[c(1:nlevels(samplemeta$Genotype_corr))]
names(genotypecol) = levels(samplemeta$Genotype_corr)

strokecol = brewer.pal(5,"Set2")[1:nlevels(samplemeta$Treatment)+2]
names(strokecol) = levels(samplemeta$Treatment)

mousecol = brewer.pal(9,"Set1")[1:nlevels(samplemeta$Mouse_ID)]
names(mousecol) = levels(samplemeta$Mouse_ID)

braincol = brewer.pal(3,"Set2")[1:nlevels(samplemeta$Brain_region)]
names(braincol) = levels(samplemeta$Brain_region)

samplemeta$Age = as.factor(samplemeta$Age)
Agecol = colorRampPalette(c("dodgerblue",
                          "dodgerblue4"))(nlevels(samplemeta$Age))[1:nlevels(samplemeta$Age)]
names(Agecol) = levels(samplemeta$Age)

ann_colors = list(
  Genotype_corr = genotypecol, 
  Mouse_ID = mousecol,
  Brain_region = braincol,
  Celltype=cellcol,
  Treatment=strokecol, 
  Age=Agecol
)

labels = samplemeta[,c("Genotype_corr","Mouse_ID", "Age", "Brain_region", "Celltype", "Treatment")] %>%  
  mutate_all(as.character) %>% as.data.frame()
rownames(labels)=rownames(samplemeta)

pheatmap(sampleDistMatrix,
         clustering_distance_rows = distance,
         clustering_distance_cols = distance,
         clustering_method = "ward.D2",
         scale ="none",
         legend = F,
         show_rownames=F, show_colnames = F,
         border_color = NA, 
         annotation_row = labels,
         annotation_col = labels,
         annotation_colors = ann_colors,
         col = colors, 
         main = "D62 top1000 Distances normalized log2 counts")

Version Author Date
eaa373d Andreas Chiocchetti 2023-02-16
cfbfcf6 achiocch 2022-06-22
51b35c8 achiocch 2022-04-26
8e44cfc achiocch 2022-04-22
55e7738 achiocch 2022-03-30
f21fdf7 achiocch 2022-03-30
858d646 achiocch 2022-02-03

Version Author Date
eaa373d Andreas Chiocchetti 2023-02-16
cfbfcf6 achiocch 2022-06-22

Genotype X Treatment Statistical modelling

the logFC should not be interpreted on its own without the specific post hoc tests (see app below to check the individual genes) In any case the value here would correspond to the APPPS1+ with Stroke against all others.

Heatmaps show standardized deviations from mean across all cells, trimmed to 2 standard deviations ( i.e. values above 2 SD are set to 2 SD). this allows to see more subtle changes better.

getres=function(Celltype="Specify", 
                Hypothesis="~1+Sex+Genotype_corr*Treatment", 
                Target="Genotype_corrAPPPS1+:TreatmentStroke",
                Randomeffect=NULL){
  
  res= comparison_rand(designform =Hypothesis, 
                       randomeffect = Randomeffect, 
                       Samples = samplemeta$Celltype==Celltype, 
                       log_cpm = log2_cpm, 
                       samplesdata = samplemeta,
                       target=Target)
  
  
  
  labels = samplemeta[samplemeta$Celltype==Celltype,c("Treatment","Age", "Genotype_corr","Mouse_ID", "Brain_region", "Celltype")] %>%  
    mutate_all(as.character) %>% as.data.frame()

  
  labels=labels %>% arrange(Treatment,Genotype_corr)
  plotdata=log2_cpm[res$adj.P.Val<0.05,rownames(labels)]
  plotdata = apply(plotdata, 2, trimmed_scaled)
  
  
  
  pheatmap(plotdata,
           #clustering_method = "ward.D2",
           cluster_cols = F,
           cluster_rows  = T,
           scale ="row",
           show_rownames=F, show_colnames = F,
           legend=T,
           border_color = NA, 
           #annotation_row = labels,
           annotation_col = labels,
           annotation_colors = ann_colors,
           col = colors, 
           breaks = seq(-2,2, length.out=254),
           main = "D62 Distances normalized log2 counts")
  return(res)
  
}

generate_output=function(CT="Celltype", ...){
  respath=paste0(home, "/docs/LMER_",CT,".xlsx")
  
  analysis = getres(Celltype = CT)
  analysis_sig = analysis[analysis$adj.P.Val<0.05,]
  analysis_sig %>% display_tab()
  
  write.xlsx2(analysis_sig, file =respath , sheetName = "significant genes")
  
  ResGO = getGOresults(rownames(analysis_sig),
                       rownames(analysis),
                       "mmusculus")
  
  if(length(ResGO)>0){
    p=gostplot(ResGO)
  } else{
    ResGO=data.frame(result="no significant enrichment identified")
    p="no significant enrichment identified"
  }
  
  write.xlsx2(ResGO$result, file = respath, sheetName = "GO_enrichment", append=T)
  return(list(results=analysis,results_sig=analysis_sig, plot=p))
}

Microglia_1

res_output=generate_output(CT = "Microglia_1")

Version Author Date
eaa373d Andreas Chiocchetti 2023-02-16
cfbfcf6 achiocch 2022-06-22
8e44cfc achiocch 2022-04-22
55e7738 achiocch 2022-03-30
87439a3 achiocch 2022-02-21
79dd0b1 achiocch 2022-02-21
858d646 achiocch 2022-02-03
[1] "no significant GO terms identified"
res_output[["results_sig"]] %>% display_tab()
res_output[["plot"]]
[1] "no significant enrichment identified"

Data sources and their abbreviations are: Gene Ontology (GO or by branch GO:MF, GO:BP, GO:CC)KEGG (KEGG) TRANSFAC (TF) miRTarBase (MIRNA) CORUM (CORUM) Human phenotype ontology (HP) Human Protein Atlas (HPA)

get results table here

Microglia_2

res_output=generate_output("Microglia_2")

Version Author Date
eaa373d Andreas Chiocchetti 2023-02-16
cfbfcf6 achiocch 2022-06-22
8e44cfc achiocch 2022-04-22
55e7738 achiocch 2022-03-30
87439a3 achiocch 2022-02-21
79dd0b1 achiocch 2022-02-21
858d646 achiocch 2022-02-03
res_output[["results_sig"]] %>% display_tab()
res_output[["plot"]]

Data sources and their abbreviations are: Gene Ontology (GO or by branch GO:MF, GO:BP, GO:CC)KEGG (KEGG) TRANSFAC (TF) miRTarBase (MIRNA) CORUM (CORUM) Human phenotype ontology (HP) Human Protein Atlas (HPA)

get results table here

Microglia_3

res_output=generate_output("Microglia_3")

Version Author Date
eaa373d Andreas Chiocchetti 2023-02-16
cfbfcf6 achiocch 2022-06-22
8e44cfc achiocch 2022-04-22
55e7738 achiocch 2022-03-30
87439a3 achiocch 2022-02-21
79dd0b1 achiocch 2022-02-21
858d646 achiocch 2022-02-03
res_output[["results_sig"]] %>% display_tab()
res_output[["plot"]]

Data sources and their abbreviations are: Gene Ontology (GO or by branch GO:MF, GO:BP, GO:CC)KEGG (KEGG) TRANSFAC (TF) miRTarBase (MIRNA) CORUM (CORUM) Human phenotype ontology (HP) Human Protein Atlas (HPA)

get results table here

Microglia_4

calculation not converging as Celltype not identified in all conditions however also rare in other conditions, no significant difference

idx=samplemeta$Celltype=="Microglia_4"
table(samplemeta$Treatment[idx], samplemeta$Genotype_corr[idx])
        
         WT APPPS1+
  Ctrl    8       0
  Stroke  0       8
table(samplemeta$Treatment[idx], samplemeta$Genotype_corr[idx]) %>% fisher.test()

    Fisher's Exact Test for Count Data

data:  .
p-value = 0.0001554
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 6.787561      Inf
sample estimates:
odds ratio 
       Inf 
#res_output=generate_output("Microglia_4")
#res_output[["results_sig"]] %>% display_tab()
#res_output[["plot"]]

get results table here

Microglia_5

res_output=generate_output("Microglia_5")

Version Author Date
eaa373d Andreas Chiocchetti 2023-02-16
cfbfcf6 achiocch 2022-06-22
8e44cfc achiocch 2022-04-22
55e7738 achiocch 2022-03-30
87439a3 achiocch 2022-02-21
79dd0b1 achiocch 2022-02-21
858d646 achiocch 2022-02-03
[1] "no significant GO terms identified"
res_output[["results_sig"]] %>% display_tab()
res_output[["plot"]]
[1] "no significant enrichment identified"

Data sources and their abbreviations are: Gene Ontology (GO or by branch GO:MF, GO:BP, GO:CC)KEGG (KEGG) TRANSFAC (TF) miRTarBase (MIRNA) CORUM (CORUM) Human phenotype ontology (HP) Human Protein Atlas (HPA) get results table here

Granulozytes

calculation not converging as Celltype not identified in all conditions however also rare in other conditions, no significant difference

idx=samplemeta$Celltype=="Granulocytes"
table(samplemeta$Treatment[idx], samplemeta$Genotype_corr[idx])
        
         WT APPPS1+
  Ctrl    5       0
  Stroke  4      18
table(samplemeta$Treatment[idx], samplemeta$Genotype_corr[idx]) %>% fisher.test()

    Fisher's Exact Test for Count Data

data:  .
p-value = 0.001561
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 2.644232      Inf
sample estimates:
odds ratio 
       Inf 
# res_output=generate_output("Granulocytes ")
# res_output[["results_sig"]] %>% display_tab()
# res_output[["plot"]]

get results table here

Mono/Mac

idx=samplemeta$Celltype=="Mono/Mac"
table(samplemeta$Treatment[idx], samplemeta$Genotype_corr[idx])
        
         WT APPPS1+
  Ctrl    8       5
  Stroke 10      12
table(samplemeta$Treatment[idx], samplemeta$Genotype_corr[idx]) %>% fisher.test()

    Fisher's Exact Test for Count Data

data:  .
p-value = 0.4887
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.3898869 9.9413508
sample estimates:
odds ratio 
  1.884178 
# res_output=generate_output("T/NK")
# res_output[["results_sig"]] %>% display_tab()
# res_output[["plot"]]

get results table here

Pseudotime analysis

colors <- viridis(100)
plotcol <- colors[cut(sce$slingPseudotime_1, breaks=100)]

plot(reducedDims(sce)$UMAP, col = "grey", pch=16, asp = 1)
points(reducedDims(sce)$UMAP, col = plotcol, pch=16, asp = 1)
lines(SlingshotDataSet(sce), lwd=2, col='black', type="l")

Version Author Date
eaa373d Andreas Chiocchetti 2023-02-16
5bba014 achiocch 2022-06-27
cfbfcf6 achiocch 2022-06-22
plot(samplemeta$Pseudotime[samplemeta$condition == "APPPS1+_Ctrl"] %>% density(na.rm=T), col=Dark8[4], lwd=2, xlab="Pseudotime", main="distribution of cells over pseudotime")
lines(samplemeta$Pseudotime[samplemeta$condition == "APPPS1+_Stroke"] %>% density(na.rm=T), col=Dark8[2], lwd=2)
lines(samplemeta$Pseudotime[samplemeta$condition == "WT_Stroke"] %>% density(na.rm=T), col=Dark8[3], lwd=2)
lines(samplemeta$Pseudotime[samplemeta$condition == "WT_Ctrl"] %>% density(na.rm=T), col=Dark8[1], lwd=2)
legend("topright", legend=c("WT_Ctrl","APPPS1+_Stroke","WT_Stroke","APPPS1+_Ctrl"), fill = Dark8[1:4])

Version Author Date
eaa373d Andreas Chiocchetti 2023-02-16
5bba014 achiocch 2022-06-27

Gene expression plot


sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                  LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8        LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8       LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8           LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8      LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8

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

other attached packages:
 [1] gprofiler2_0.2.1            lm.beta_1.7-1               pheatmap_1.0.12             RColorBrewer_1.1-3          kableExtra_1.3.4            slingshot_2.6.0             TrajectoryUtils_1.6.0       SingleCellExperiment_1.20.0 princurve_2.1.6             DT_0.27                     viridis_0.6.2               viridisLite_0.4.1           xlsx_0.6.5                  brms_2.18.0                 Rcpp_1.0.10                 compareGroups_4.6.0         data.table_1.14.6           SingleR_2.0.0               SeuratObject_4.1.3          Seurat_4.3.0                forcats_1.0.0               stringr_1.5.0               dplyr_1.1.0                 purrr_1.0.1                 readr_2.1.4                 tidyr_1.3.0                 tibble_3.1.8                ggplot2_3.4.1               tidyverse_1.3.2             DESeq2_1.38.3               SummarizedExperiment_1.28.0 Biobase_2.58.0              MatrixGenerics_1.10.0       matrixStats_0.63.0          GenomicRanges_1.50.2        GenomeInfoDb_1.34.9         IRanges_2.32.0              S4Vectors_0.36.1            BiocGenerics_0.44.0         limma_3.54.1                workflowr_1.7.0            

loaded via a namespace (and not attached):
  [1] rsvd_1.0.5                ica_1.0-3                 svglite_2.1.1             ps_1.7.2                  lmtest_0.9-40             rprojroot_2.0.3           crayon_1.5.2              MASS_7.3-58.2             nlme_3.1-162              backports_1.4.1           posterior_1.3.1           reprex_2.0.2              colourpicker_1.2.0        rlang_1.0.6               XVector_0.38.0            ROCR_1.0-11               readxl_1.4.2              irlba_2.3.5.1             callr_3.7.3               flextable_0.8.5           BiocParallel_1.32.5       bit64_4.0.5               glue_1.6.2                loo_2.5.1                 sctransform_0.3.5         rstan_2.21.8              parallel_4.2.2            processx_3.8.0            spatstat.sparse_3.0-0     AnnotationDbi_1.60.0      spatstat.geom_3.0-6       haven_2.5.1               tidyselect_1.2.0          fitdistrplus_1.1-8        XML_3.99-0.13             zoo_1.8-11                packrat_0.9.0             distributional_0.3.1      chron_2.3-59              xtable_1.8-4              magrittr_2.0.3            evaluate_0.20             gdtools_0.3.0             cli_3.6.0                 zlibbioc_1.44.0           rstudioapi_0.14           miniUI_0.1.1.1            sp_1.6-0                  whisker_0.4.1             bslib_0.4.2               shinystan_2.6.0           shiny_1.7.4               BiocSingular_1.14.0       xfun_0.37                 askpass_1.1               inline_0.3.19             pkgbuild_1.4.0            cluster_2.1.4             bridgesampling_1.1-2      gfonts_0.2.0              KEGGREST_1.38.0           Brobdingnag_1.2-9         ggrepel_0.9.3             threejs_0.3.3             listenv_0.9.0             xlsxjars_0.6.1            Biostrings_2.66.0         png_0.1-8                 future_1.31.0             withr_2.5.0               bitops_1.0-7              plyr_1.8.8                cellranger_1.1.0          coda_0.19-4               pillar_1.8.1              RcppParallel_5.1.6        cachem_1.0.6              fs_1.6.1                  DelayedMatrixStats_1.20.0 xts_0.12.2                vctrs_0.5.2               ellipsis_0.3.2            generics_0.1.3            dygraphs_1.1.1.6          tools_4.2.2               munsell_0.5.0             DelayedArray_0.24.0       fastmap_1.1.0             compiler_4.2.2            abind_1.4-5               httpuv_1.6.9              plotly_4.10.1             rJava_1.0-6               GenomeInfoDbData_1.2.9    gridExtra_2.3             lattice_0.20-45           deldir_1.0-6              utf8_1.2.3                later_1.3.0               jsonlite_1.8.4            scales_1.2.1              ScaledMatrix_1.6.0        pbapply_1.7-0             sparseMatrixStats_1.10.0  lazyeval_0.2.2            promises_1.2.0.1          goftest_1.2-3             spatstat.utils_3.0-1      reticulate_1.28           checkmate_2.1.0           rmarkdown_2.20            cowplot_1.1.1             webshot_0.5.4             Rtsne_0.16                uwot_0.1.14               igraph_1.4.0              rsconnect_0.8.29          survival_3.5-3            yaml_2.3.7                systemfonts_1.0.4         bayesplot_1.10.0          htmltools_0.5.4           rstantools_2.2.0          memoise_2.0.1             locfit_1.5-9.7            digest_0.6.31             assertthat_0.2.1          mime_0.12                 RSQLite_2.2.20            future.apply_1.10.0       blob_1.2.3                shinythemes_1.2.0         splines_4.2.2             googledrive_2.0.0         RCurl_1.98-1.10           broom_1.0.3               hms_1.1.2                 modelr_0.1.10             colorspace_2.1-0          base64enc_0.1-3           BiocManager_1.30.19       nnet_7.3-18               sass_0.4.5                RANN_2.6.1                mvtnorm_1.1-3             fansi_1.0.4               tzdb_0.3.0                truncnorm_1.0-8           parallelly_1.34.0         R6_2.5.1                  grid_4.2.2                crul_1.3                  ggridges_0.5.4            lifecycle_1.0.3           StanHeaders_2.21.0-7      zip_2.2.2                 writexl_1.4.2             curl_5.0.0                googlesheets4_1.0.1       leiden_0.4.3              jquerylib_0.1.4           Matrix_1.5-3              RcppAnnoy_0.0.20          spatstat.explore_3.0-6    htmlwidgets_1.6.1         officer_0.5.2             beachmat_2.14.0           polyclip_1.10-4           markdown_1.5              crosstalk_1.2.0           timechange_0.2.0          rvest_1.0.3               globals_0.16.2            openssl_2.0.5             patchwork_1.1.2           spatstat.random_3.1-3     tensorA_0.36.2            progressr_0.13.0          codetools_0.2-19          lubridate_1.9.2           gtools_3.9.4              getPass_0.2-2             prettyunits_1.1.1         dbplyr_2.3.0              gtable_0.3.1              DBI_1.1.3                 git2r_0.31.0              tensor_1.5                httr_1.4.4                highr_0.10                KernSmooth_2.23-20        stringi_1.7.12            reshape2_1.4.4            farver_2.1.1              uuid_1.1-0                annotate_1.76.0           mice_3.15.0               xml2_1.3.3                shinyjs_2.1.0             geneplotter_1.76.0        scattermore_0.8           bit_4.0.5                 spatstat.data_3.0-0       pkgconfig_2.0.3           gargle_1.3.0              HardyWeinberg_1.7.5       Rsolnp_1.16               knitr_1.42                httpcode_0.3.0