Last updated: 2025-02-07

Checks: 7 0

Knit directory: paed-airway-allTissues/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). 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(20230811) 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 fc1fda5. 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:    .RData
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    data/.DS_Store
    Ignored:    data/RDS/
    Ignored:    output/.DS_Store
    Ignored:    output/CSV/.DS_Store
    Ignored:    output/G000231_Neeland_batch1/
    Ignored:    output/G000231_Neeland_batch2_1/
    Ignored:    output/G000231_Neeland_batch2_2/
    Ignored:    output/G000231_Neeland_batch3/
    Ignored:    output/G000231_Neeland_batch4/
    Ignored:    output/G000231_Neeland_batch5/
    Ignored:    output/G000231_Neeland_batch9_1/
    Ignored:    output/RDS/
    Ignored:    output/plots/

Untracked files:
    Untracked:  analysis/03_Batch_Integration.Rmd
    Untracked:  analysis/Age_proportions.Rmd
    Untracked:  analysis/Age_proportions_AllBatches.Rmd
    Untracked:  analysis/All_Batches_QCExploratory_v2.Rmd
    Untracked:  analysis/All_metadata.Rmd
    Untracked:  analysis/Annotation_BAL.Rmd
    Untracked:  analysis/Annotation_Bronchial_brushings.Rmd
    Untracked:  analysis/Annotation_Nasal_brushings.Rmd
    Untracked:  analysis/BatchCorrection_Adenoids.Rmd
    Untracked:  analysis/BatchCorrection_Nasal_brushings.Rmd
    Untracked:  analysis/BatchCorrection_Tonsils.Rmd
    Untracked:  analysis/Batch_Integration_&_Downstream_analysis.Rmd
    Untracked:  analysis/Batch_correction_&_Downstream.Rmd
    Untracked:  analysis/Cell_cycle_regression.Rmd
    Untracked:  analysis/Clustering_Tonsils_v2.Rmd
    Untracked:  analysis/Master_metadata.Rmd
    Untracked:  analysis/Pediatric_Vs_Adult_Atlases.Rmd
    Untracked:  analysis/Preprocessing_Batch1_Nasal_brushings.Rmd
    Untracked:  analysis/Preprocessing_Batch2_Tonsils.Rmd
    Untracked:  analysis/Preprocessing_Batch3_Adenoids.Rmd
    Untracked:  analysis/Preprocessing_Batch4_Bronchial_brushings.Rmd
    Untracked:  analysis/Preprocessing_Batch5_Nasal_brushings.Rmd
    Untracked:  analysis/Preprocessing_Batch6_BAL.Rmd
    Untracked:  analysis/Preprocessing_Batch7_Bronchial_brushings.Rmd
    Untracked:  analysis/Preprocessing_Batch8_Adenoids.Rmd
    Untracked:  analysis/Preprocessing_Batch9_Tonsils.Rmd
    Untracked:  analysis/TonsilsVsAdenoids.Rmd
    Untracked:  analysis/cell_cycle_regression.R
    Untracked:  analysis/testing_age_all.Rmd
    Untracked:  code/pseudobulk_analysis.R
    Untracked:  data/Cell_labels_Gunjan_v2/
    Untracked:  data/Cell_labels_Mel/
    Untracked:  data/Cell_labels_Mel_v2/
    Untracked:  data/Cell_labels_Mel_v3/
    Untracked:  data/Cell_labels_modified_Gunjan/
    Untracked:  data/Gene_sets/
    Untracked:  data/Hs.c2.cp.reactome.v7.1.entrez.rds
    Untracked:  data/Raw_feature_bc_matrix/
    Untracked:  data/cell_labels_Mel_v4_Dec2024/
    Untracked:  data/celltypes_Mel_GD_v3.xlsx
    Untracked:  data/celltypes_Mel_GD_v4_no_dups.xlsx
    Untracked:  data/celltypes_Mel_modified.xlsx
    Untracked:  data/celltypes_Mel_v2.csv
    Untracked:  data/celltypes_Mel_v2.xlsx
    Untracked:  data/celltypes_Mel_v2_MN.xlsx
    Untracked:  data/celltypes_for_mel_MN.xlsx
    Untracked:  data/col_palette.xlsx
    Untracked:  data/earlyAIR_sample_sheets_combined.xlsx
    Untracked:  figure/DGE_Tonsils_CD8.Rmd/
    Untracked:  output/CSV/All_tissues.propeller.xlsx
    Untracked:  output/CSV/Bronchial_brushings/
    Untracked:  output/CSV/Bronchial_brushings_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/
    Untracked:  output/CSV/G000231_Neeland_Adenoids.propeller.xlsx
    Untracked:  output/CSV/G000231_Neeland_Bronchial_brushings.propeller.xlsx
    Untracked:  output/CSV/G000231_Neeland_Nasal_brushings.propeller.xlsx
    Untracked:  output/CSV/G000231_Neeland_Tonsils.propeller.xlsx
    Untracked:  output/CSV/Nasal_brushings/
    Untracked:  output/DGE/Adenoids_B_memory/
    Untracked:  output/DGE/Adenoids_CD4/
    Untracked:  output/DGE/Adenoids_CD8/
    Untracked:  output/DGE/Adenoids_Cycling_GCB/
    Untracked:  output/DGE/Adenoids_IFN/
    Untracked:  output/DGE/Tonsil_Atlas_CD4/
    Untracked:  output/DGE/Tonsils/DGE_Age_summary_Tonsils.xlsx
    Untracked:  output/DGE/Tonsils/Tonsils_Naïve B cells/
    Untracked:  output/DGE/Tonsils/~$DGE_Age_summary_Tonsils.xlsx
    Untracked:  output/DGE/Tonsils_CD4/
    Untracked:  output/DGE/Tonsils_CD8/
    Untracked:  output/DGE/Tonsils_IFN/
    Untracked:  test_col.csv
    Untracked:  test_col.txt
    Untracked:  test_col.xlsx

Unstaged changes:
    Deleted:    02_QC_exploratoryPlots.Rmd
    Deleted:    02_QC_exploratoryPlots.html
    Modified:   analysis/00_AllBatches_overview.Rmd
    Modified:   analysis/01_QC_emptyDrops.Rmd
    Modified:   analysis/02_QC_exploratoryPlots.Rmd
    Modified:   analysis/Adenoids.Rmd
    Modified:   analysis/Adenoids_v2.Rmd
    Modified:   analysis/Age_modeling.Rmd
    Modified:   analysis/AllBatches_QCExploratory.Rmd
    Modified:   analysis/BAL.Rmd
    Modified:   analysis/BAL_v2.Rmd
    Modified:   analysis/Bronchial_brushings.Rmd
    Modified:   analysis/Bronchial_brushings_v2.Rmd
    Modified:   analysis/Nasal_brushings.Rmd
    Modified:   analysis/Nasal_brushings_v2.Rmd
    Modified:   analysis/Subclustering_Adenoids.Rmd
    Modified:   analysis/Subclustering_BAL.Rmd
    Modified:   analysis/Subclustering_Bronchial_brushings.Rmd
    Modified:   analysis/Subclustering_Nasal_brushings.Rmd
    Modified:   analysis/Subclustering_Tonsils.Rmd
    Modified:   analysis/Tonsils.Rmd
    Modified:   analysis/Tonsils_v2.Rmd
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c0.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c1.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c10.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c11.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c12.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c13.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c14.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c15.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c16.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c17.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c2.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c3.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c4.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c5.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c6.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c7.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c8.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/REACTOME-cluster-limma-c9.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c0.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c1.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c10.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c11.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c12.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c13.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c14.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c15.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c16.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c17.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c2.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c3.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c4.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c5.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c6.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c7.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c8.csv
    Modified:   output/CSV/BAL_Marker_gene_clusters.limmaTrendRNA_snn_res.0.4/up-cluster-limma-c9.csv

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/DGE_TonsilAtlas.Rmd) and HTML (docs/DGE_TonsilAtlas.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 fc1fda5 Gunjan Dixit 2025-02-07 wflow_publish("analysis/DGE_TonsilAtlas.Rmd")
Rmd 9fe8c18 Gunjan Dixit 2025-02-07 Added DGE analysis for Tonsil Atlas
html 9fe8c18 Gunjan Dixit 2025-02-07 Added DGE analysis for Tonsil Atlas

suppressPackageStartupMessages({
  library(here)
  library(glue)
  library(patchwork)
  library(Seurat)
  library(dplyr)
  library(tidyverse)
  library(gridExtra)
  library(paletteer)
  library(viridis)
  library(tidyverse)
  library(scran)
  library(scater)
  library(ggridges)
  library(speckle)
  library(edgeR)
  library(limma)
  library(knitr)
  library(BiocStyle)
  library(org.Hs.eg.db)
  library(Glimma)
})

Load Data

seu <- readRDS(here("output/RDS/Other_Atlas_SEUs/Tonsil_Atlas_3P_SEU.rds"))

Tonsils DGE

sce <- SingleCellExperiment(list(counts = seu@assays$RNA@layers$counts),
colData = seu@meta.data)
Loading required package: HDF5Array
Loading required package: DelayedArray
Loading required package: Matrix

Attaching package: 'Matrix'
The following object is masked from 'package:S4Vectors':

    expand
The following objects are masked from 'package:tidyr':

    expand, pack, unpack
Loading required package: S4Arrays
Loading required package: abind

Attaching package: 'S4Arrays'
The following object is masked from 'package:abind':

    abind
The following object is masked from 'package:base':

    rowsum
Loading required package: SparseArray

Attaching package: 'DelayedArray'
The following object is masked from 'package:purrr':

    simplify
The following objects are masked from 'package:base':

    apply, scale, sweep
Loading required package: rhdf5

Attaching package: 'HDF5Array'
The following object is masked from 'package:rhdf5':

    h5ls
rownames(sce) <- rownames(seu)

celltypes_to_subset <- "Memory B cells"
pb <- aggregateAcrossCells(sce[, sce$cell_labels_v2 %in% celltypes_to_subset],id = colData(sce[, sce$cell_labels_v2 %in% celltypes_to_subset])[, c("donor_id")])
pb <- pb[, pb$ncells>=50]
pb
class: SingleCellExperiment 
dim: 37378 17 
metadata(0):
assays(1): counts
rownames(37378): AL627309.1 AL627309.3 ... AC136616.1 AC023491.2
rowData names(0):
colnames(17): BCLL-10-T BCLL-11-T ... BCLL-8-T BCLL-9-T
colData names(46): orig.ident nCount_RNA ... ids ncells
reducedDimNames(0):
mainExpName: NULL
altExpNames(0):
pb <- SingleCellExperiment(list(counts = counts(pb)),
colData = colData(pb) %>%
data.frame %>%
dplyr::select(c("donor_id", "age", "age_group", "sex")) %>%
DataFrame) %>%
addPerCellQCMetrics

pb <- logNormCounts(pb) %>%
runPCA()
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
dge <- DGEList(counts = counts(pb),
samples = colData(pb) %>% data.frame)
keep <- rowSums(dge$counts) > 0
dge <- dge[keep, ]
dim(dge)
[1] 27367    17
dge <- calcNormFactors(dge)
glimmaMDS(dge)
design <- model.matrix(~dge$samples$age + dge$samples$sex)
design
   (Intercept) dge$samples$age dge$samples$sexmale
1            1               3                   1
2            1               5                   0
3            1               3                   0
4            1               5                   0
5            1              26                   1
6            1              33                   1
7            1              65                   1
8            1              23                   1
9            1              19                   0
10           1              22                   0
11           1              63                   1
12           1              25                   0
13           1              56                   1
14           1              28                   1
15           1              35                   1
16           1               4                   1
17           1               5                   1
attr(,"assign")
[1] 0 1 2
attr(,"contrasts")
attr(,"contrasts")$`dge$samples$sex`
[1] "contr.treatment"
v <- voom(dge, design, plot = T)

Version Author Date
9fe8c18 Gunjan Dixit 2025-02-07
fit <- lmFit(v, design)
fit <- eBayes(fit)
dt <- decideTests(fit)
summary(dt)
       (Intercept) dge$samples$age dge$samples$sexmale
Down         13519            1137                  14
NotSig        1793           25281               27333
Up           12055             949                  20
sce <- sce[, !is.na(sce$cell_labels_v2)]
sce <- SingleCellExperiment(
  assays = list(counts = counts(sce)),
  colData = colData(sce)
)

celltypes_list <- readRDS(here("output/RDS/celltype_list_TonsilAtlas.rds"))

summary_list <- list()
summary_list1 <- list()
# Remove "Cycling GCB" from the list
celltypes_list <- celltypes_list[celltypes_list != c("Cycling GCB","MAIT cells","T-IFN" )]
Warning in celltypes_list != c("Cycling GCB", "MAIT cells", "T-IFN"): longer
object length is not a multiple of shorter object length
for (celltype in celltypes_list) {
  cat("Processing:", celltype, "\n")
  
  pb <- aggregateAcrossCells(sce[, sce$cell_labels_v2 == celltype], 
                             id = colData(sce[, sce$cell_labels_v2 == celltype])[, "donor_id"])

  pb <- pb[, pb$ncells >= 50]
  
  pb <- SingleCellExperiment(list(counts = counts(pb)), 
                             colData = colData(pb) %>% 
                               data.frame %>% 
                               dplyr::select(c("donor_id", "age_years" ,"sex", "age_group")) %>% 
                               DataFrame) %>% 
    addPerCellQCMetrics()
  
  #pb$age_category <- ifelse(pb$age_years <= 5, 'preschool', 
   #                         ifelse(pb$age_years > 5 & pb$age_years <= 11, 'early_childhood', 
    #                               ifelse(pb$age_years > 11, 'adolescent', NA)))
  
  pb <- logNormCounts(pb) %>% runPCA()
  
  dge <- DGEList(counts = counts(pb), samples = colData(pb) %>% data.frame)  
  keep <- rowSums(dge$counts) > 0
  dge <- dge[keep, ]
  dge <- calcNormFactors(dge)

  design <- model.matrix(~ dge$samples$age_years + dge$samples$sex)

  v <- voom(dge, design, plot = FALSE)
  fit <- lmFit(v, design)
  fit <- eBayes(fit)
  dt <- decideTests(fit)
  
  top_genes <- topTable(fit, coef = 2, number = Inf, adjust.method = "BH")
  dge_res <- summary(dt)
  
  summary_list[[celltype]] <- top_genes
  summary_list1[[celltype]] <- dge_res
}
Processing: Monocytes/macrophages/neutrophils 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Plasmacytoid DCs 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Other 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Cycling T 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Follicular dendritic cells 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: interferon-activated naïve B cells 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: NK cells 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: CD8 TF 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: CD8 TN 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Gamma delta T 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Double negative T 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: TFH-LZ-GC 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: CD4 TN 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: CD4 TCM 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: CD4 Treg 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: CD4 TFH 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: CD4 Treg-eff 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Early PC precursor 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: DZtoLZ GCB transition 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Plasma B cells 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Memory B cells 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Early GC-committed NBC 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: Naïve B cells 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: DZ GCB Noproli-memory like 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: DZ early G2Mphase 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: DZ early Sphase 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: DZ late Sphase 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
Processing: DZ late G2Mphase 
Warning in check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) - : more
singular values/vectors requested than available
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth =
TRUE, : You're computing too large a percentage of total singular values, use a
standard svd instead.
summary_table <- do.call(rbind, lapply(names(summary_list), function(x) 
  data.frame(CellType = x, summary_list[[x]])))

summary_table1 <- do.call(rbind, lapply(names(summary_list1), function(x) 
  data.frame(CellType = x, summary_list1[[x]])))

#print(head(summary_table))
print(summary_list1)
$`Monocytes/macrophages/neutrophils`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down            27                   107                   2
NotSig        8750                 21199               21319
Up           12556                    27                  12

$`Plasmacytoid DCs`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down            54                  4056                   2
NotSig       10073                 17761               22093
Up           11980                   290                  12

$Other
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         10982                  2918                  28
NotSig        3032                 16929               25981
Up           12012                  6179                  17

$`Cycling T`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down          7090                   158                  12
NotSig        4070                 22602               22894
Up           11760                   160                  14

$`Follicular dendritic cells`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down             0                    46                  71
NotSig        5165                 19211               19198
Up           14120                    28                  16

$`interferon-activated naïve B cells`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down          3520                     3                   2
NotSig        6423                 21084               21078
Up           11148                     4                  11

$`NK cells`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down             0                     1                   2
NotSig        3598                 19110               19104
Up           15517                     4                   9

$`CD8 TF`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down          2644                    90                   6
NotSig        7914                 22041               22200
Up           11662                    89                  14

$`CD8 TN`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down          7888                   174                   6
NotSig        3825                 22390               22855
Up           11163                   312                  15

$`Gamma delta T`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down             0                    11                   3
NotSig         432                 16053               16070
Up           15652                    20                  11

$`Double negative T`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down             0                    15                  11
NotSig        4030                 17577               17575
Up           13569                     7                  13

$`TFH-LZ-GC`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         12429                  1847                   8
NotSig        2314                 22925               26736
Up           12020                  1991                  19

$`CD4 TN`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         10699                    81                   6
NotSig        2826                 24519               24721
Up           11217                   142                  15

$`CD4 TCM`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down            20                  1138                   4
NotSig       11882                 21496               22883
Up           10995                   263                  10

$`CD4 Treg`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down             0                    72                   2
NotSig        8469                 21369               21515
Up           13057                    85                   9

$`CD4 TFH`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down             5                    85                   7
NotSig        8123                 19637               19841
Up           11731                   137                  11

$`CD4 Treg-eff`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down             0                    17                   4
NotSig        8962                 20743               20765
Up           11817                    19                  10

$`Early PC precursor`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         10591                   593                   8
NotSig        2400                 22578               24135
Up           11166                   986                  14

$`DZtoLZ GCB transition`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         12801                   685                  14
NotSig        1767                 18496               26402
Up           11868                  7255                  20

$`Plasma B cells`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         12037                   825                   8
NotSig        1966                 22599               24191
Up           10209                   788                  13

$`Memory B cells`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         13519                  1137                  14
NotSig        1793                 25281               27333
Up           12055                   949                  20

$`Early GC-committed NBC`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         12075                   506                   8
NotSig        2329                 25156               25945
Up           11564                   306                  15

$`Naïve B cells`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         12816                   154                  10
NotSig        1890                 25956               26201
Up           11522                   118                  17

$`DZ GCB Noproli-memory like`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down          9255                   534                  14
NotSig        2782                 17216               23566
Up           11560                  5847                  17

$`DZ early G2Mphase`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         10261                   476                  12
NotSig        2165                 18274               23755
Up           11359                  5035                  18

$`DZ early Sphase`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         10379                   548                  18
NotSig        2425                 18403               24465
Up           11696                  5549                  17

$`DZ late Sphase`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         11312                   500                  11
NotSig        2024                 20112               24892
Up           11588                  4312                  21

$`DZ late G2Mphase`
       (Intercept) dge$samples$age_years dge$samples$sexmale
Down         10385                   548                  11
NotSig        2285                 18673               24111
Up           11468                  4917                  16
age_summary_table <- summary_table1 %>%
  filter(grepl("dge\\$samples\\$age_years", Var2)) %>%
  pivot_wider(names_from = Var1, values_from = Freq, values_fill = list(Freq = 0))


print(knitr::kable(age_summary_table, caption = "DGE Age summary: Tonsil Atlas"))


Table: DGE Age summary: Tonsil Atlas

|CellType                           |Var2                  | Down| NotSig|   Up|
|:----------------------------------|:---------------------|----:|------:|----:|
|Monocytes/macrophages/neutrophils  |dge$samples$age_years |  107|  21199|   27|
|Plasmacytoid DCs                   |dge$samples$age_years | 4056|  17761|  290|
|Other                              |dge$samples$age_years | 2918|  16929| 6179|
|Cycling T                          |dge$samples$age_years |  158|  22602|  160|
|Follicular dendritic cells         |dge$samples$age_years |   46|  19211|   28|
|interferon-activated naïve B cells |dge$samples$age_years |    3|  21084|    4|
|NK cells                           |dge$samples$age_years |    1|  19110|    4|
|CD8 TF                             |dge$samples$age_years |   90|  22041|   89|
|CD8 TN                             |dge$samples$age_years |  174|  22390|  312|
|Gamma delta T                      |dge$samples$age_years |   11|  16053|   20|
|Double negative T                  |dge$samples$age_years |   15|  17577|    7|
|TFH-LZ-GC                          |dge$samples$age_years | 1847|  22925| 1991|
|CD4 TN                             |dge$samples$age_years |   81|  24519|  142|
|CD4 TCM                            |dge$samples$age_years | 1138|  21496|  263|
|CD4 Treg                           |dge$samples$age_years |   72|  21369|   85|
|CD4 TFH                            |dge$samples$age_years |   85|  19637|  137|
|CD4 Treg-eff                       |dge$samples$age_years |   17|  20743|   19|
|Early PC precursor                 |dge$samples$age_years |  593|  22578|  986|
|DZtoLZ GCB transition              |dge$samples$age_years |  685|  18496| 7255|
|Plasma B cells                     |dge$samples$age_years |  825|  22599|  788|
|Memory B cells                     |dge$samples$age_years | 1137|  25281|  949|
|Early GC-committed NBC             |dge$samples$age_years |  506|  25156|  306|
|Naïve B cells                      |dge$samples$age_years |  154|  25956|  118|
|DZ GCB Noproli-memory like         |dge$samples$age_years |  534|  17216| 5847|
|DZ early G2Mphase                  |dge$samples$age_years |  476|  18274| 5035|
|DZ early Sphase                    |dge$samples$age_years |  548|  18403| 5549|
|DZ late Sphase                     |dge$samples$age_years |  500|  20112| 4312|
|DZ late G2Mphase                   |dge$samples$age_years |  548|  18673| 4917|
#writexl::write_xlsx(age_summary_table, path = here("output/DGE/Tonsils/DGE_Age_summary_Tonsils.xlsx"))

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS 15.3

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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

time zone: Australia/Melbourne
tzcode source: internal

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

other attached packages:
 [1] HDF5Array_1.30.1            rhdf5_2.46.1               
 [3] DelayedArray_0.28.0         SparseArray_1.2.4          
 [5] S4Arrays_1.2.0              abind_1.4-5                
 [7] Matrix_1.6-5                Glimma_2.12.0              
 [9] org.Hs.eg.db_3.18.0         AnnotationDbi_1.64.1       
[11] BiocStyle_2.30.0            knitr_1.45                 
[13] edgeR_4.0.16                limma_3.58.1               
[15] speckle_1.2.0               ggridges_0.5.6             
[17] scater_1.30.1               scran_1.30.2               
[19] scuttle_1.12.0              SingleCellExperiment_1.24.0
[21] SummarizedExperiment_1.32.0 Biobase_2.62.0             
[23] GenomicRanges_1.54.1        GenomeInfoDb_1.38.6        
[25] IRanges_2.36.0              S4Vectors_0.40.2           
[27] BiocGenerics_0.48.1         MatrixGenerics_1.14.0      
[29] matrixStats_1.2.0           viridis_0.6.5              
[31] viridisLite_0.4.2           paletteer_1.6.0            
[33] gridExtra_2.3               lubridate_1.9.3            
[35] forcats_1.0.0               stringr_1.5.1              
[37] purrr_1.0.2                 readr_2.1.5                
[39] tidyr_1.3.1                 tibble_3.2.1               
[41] ggplot2_3.5.0               tidyverse_2.0.0            
[43] dplyr_1.1.4                 Seurat_5.0.1.9009          
[45] SeuratObject_5.0.1          sp_2.1-3                   
[47] patchwork_1.2.0             glue_1.7.0                 
[49] here_1.0.1                  workflowr_1.7.1            

loaded via a namespace (and not attached):
  [1] fs_1.6.3                  spatstat.sparse_3.0-3    
  [3] bitops_1.0-7              httr_1.4.7               
  [5] RColorBrewer_1.1-3        tools_4.3.2              
  [7] sctransform_0.4.1         utf8_1.2.4               
  [9] R6_2.5.1                  lazyeval_0.2.2           
 [11] uwot_0.1.16               rhdf5filters_1.14.1      
 [13] withr_3.0.0               progressr_0.14.0         
 [15] cli_3.6.2                 spatstat.explore_3.2-6   
 [17] fastDummies_1.7.3         sass_0.4.8               
 [19] spatstat.data_3.0-4       pbapply_1.7-2            
 [21] parallelly_1.37.0         rstudioapi_0.15.0        
 [23] RSQLite_2.3.5             generics_0.1.3           
 [25] ica_1.0-3                 spatstat.random_3.2-2    
 [27] ggbeeswarm_0.7.2          fansi_1.0.6              
 [29] lifecycle_1.0.4           whisker_0.4.1            
 [31] yaml_2.3.8                Rtsne_0.17               
 [33] grid_4.3.2                blob_1.2.4               
 [35] promises_1.2.1            dqrng_0.3.2              
 [37] crayon_1.5.2              miniUI_0.1.1.1           
 [39] lattice_0.22-5            beachmat_2.18.1          
 [41] cowplot_1.1.3             KEGGREST_1.42.0          
 [43] pillar_1.9.0              metapod_1.10.1           
 [45] future.apply_1.11.1       codetools_0.2-19         
 [47] leiden_0.4.3.1            getPass_0.2-4            
 [49] data.table_1.15.0         vctrs_0.6.5              
 [51] png_0.1-8                 spam_2.10-0              
 [53] gtable_0.3.4              rematch2_2.1.2           
 [55] cachem_1.0.8              xfun_0.42                
 [57] mime_0.12                 survival_3.5-8           
 [59] statmod_1.5.0             bluster_1.12.0           
 [61] ellipsis_0.3.2            fitdistrplus_1.1-11      
 [63] ROCR_1.0-11               nlme_3.1-164             
 [65] bit64_4.0.5               RcppAnnoy_0.0.22         
 [67] rprojroot_2.0.4           bslib_0.6.1              
 [69] irlba_2.3.5.1             vipor_0.4.7              
 [71] KernSmooth_2.23-22        colorspace_2.1-0         
 [73] DBI_1.2.2                 DESeq2_1.42.1            
 [75] tidyselect_1.2.0          processx_3.8.3           
 [77] bit_4.0.5                 compiler_4.3.2           
 [79] git2r_0.33.0              BiocNeighbors_1.20.2     
 [81] plotly_4.10.4             scales_1.3.0             
 [83] lmtest_0.9-40             callr_3.7.5              
 [85] digest_0.6.34             goftest_1.2-3            
 [87] spatstat.utils_3.0-4      rmarkdown_2.25           
 [89] XVector_0.42.0            htmltools_0.5.7          
 [91] pkgconfig_2.0.3           sparseMatrixStats_1.14.0 
 [93] highr_0.10                fastmap_1.1.1            
 [95] rlang_1.1.3               htmlwidgets_1.6.4        
 [97] shiny_1.8.0               DelayedMatrixStats_1.24.0
 [99] jquerylib_0.1.4           zoo_1.8-12               
[101] jsonlite_1.8.8            BiocParallel_1.36.0      
[103] BiocSingular_1.18.0       RCurl_1.98-1.14          
[105] magrittr_2.0.3            GenomeInfoDbData_1.2.11  
[107] dotCall64_1.1-1           Rhdf5lib_1.24.2          
[109] munsell_0.5.0             Rcpp_1.0.12              
[111] reticulate_1.35.0         stringi_1.8.3            
[113] zlibbioc_1.48.0           MASS_7.3-60.0.1          
[115] plyr_1.8.9                parallel_4.3.2           
[117] listenv_0.9.1             ggrepel_0.9.5            
[119] deldir_2.0-2              Biostrings_2.70.2        
[121] splines_4.3.2             tensor_1.5               
[123] hms_1.1.3                 locfit_1.5-9.8           
[125] ps_1.7.6                  igraph_2.0.2             
[127] spatstat.geom_3.2-8       RcppHNSW_0.6.0           
[129] reshape2_1.4.4            ScaledMatrix_1.10.0      
[131] evaluate_0.23             BiocManager_1.30.22      
[133] tzdb_0.4.0                httpuv_1.6.14            
[135] RANN_2.6.1                polyclip_1.10-6          
[137] future_1.33.1             scattermore_1.2          
[139] rsvd_1.0.5                xtable_1.8-4             
[141] RSpectra_0.16-1           later_1.3.2              
[143] memoise_2.0.1             beeswarm_0.4.0           
[145] cluster_2.1.6             timechange_0.3.0         
[147] globals_0.16.2