Last updated: 2023-12-04

Checks: 2 0

Knit directory: DEanalysis/

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! 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 39196a3. 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:


Untracked files:
    Untracked:  .DS_Store
    Untracked:  .Rhistory
    Untracked:  data/.Rhistory
    Untracked:  data/10X_Kang_DEresult.RData
    Untracked:  data/10X_inputdata.RData
    Untracked:  data/10X_inputdata_DEresult.RData
    Untracked:  data/10X_inputdata_cpm.RData
    Untracked:  data/10X_inputdata_integrated.RData
    Untracked:  data/10X_inputdata_lognorm.RData
    Untracked:  data/10Xdata_annotate.rds
    Untracked:  data/Bcells.Rmd
    Untracked:  data/Bcellsce.rds
    Untracked:  data/data2sce.RData
    Untracked:  data/permutation.RData
    Untracked:  data/vstcounts.Rdata

Unstaged changes:
    Modified:   analysis/CD14+ Monocytes.Rmd
    Modified:   code/DE_methods.R
    Modified:   code/functions_in_rmd.R

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/methods_details.Rmd) and HTML (docs/methods_details.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 39196a3 C-HW 2023-12-04 fix log2FC sign
html f1d8375 C-HW 2023-12-01 Build site.
html 65985ff C-HW 2023-12-01 Build site.
Rmd 3803697 C-HW 2023-12-01 upload rmd
html 3803697 C-HW 2023-12-01 upload rmd
html 59872e4 C-HW 2023-11-13 update methods
html 366cd53 C-HW 2023-06-06 add group8_17&2_19
html 2107af3 C-HW 2023-05-24 add methods_details

In this project, we compare a few methods performing the DE analysis results. Each of them might use different input data ,different statistical model and different FDR control on p-values.

Poisson-glmm Binomial-glmm Pb-DESeq2 Pb-edgeR MAST Wilcox MMvst MMpoisson
Package Our method Our method Muscat Muscat MAST Seurat Muscat Muscat
Input UMI zero proportion UMI CPM CPM Integrated/Log normalized VST UMI
Model base Poisson glmm Binomial glmm Negative binomial model Negative binomial model Zero-inflated model Rank-sum test Linear mixed model Poisson glmm
Normalization X X V V V V V V
Normalization method Median of ratio size factor, variance stabilizing transformation in model In data, trimmed mean of M values (TMM) in model In data In data In data Library size factor as offset

Poisson GLMM

  • Input:
    • sce: A SingleCellExpreriment object containing raw counts generated by 10X protocol
    • cellgroups: A vector labeling the cell groups
    • repgroups: A vector labeling the replicates (donors)
    • freq_expressed: A threshold value of gene expression frequency (default = \(0.05\))
  • Details:
    • Only genes that pass the threshold for gene expression frequency will be considered as inputs.

    • For each gene, we run a poisson glmm method (glmmPQL) on the raw counts with cellgroups as fixed effect and repgroups as random effect \[ \begin{aligned} X_{cgk}|\lambda_{cgk} & \sim Poisson(\lambda_{cgk})\\ \log \lambda_{cgk} & = \mu_g + X_c{\beta_g} + \epsilon_{gk}\\ \end{aligned} \]

    • If the algorithm doesn’t converge, the gene will be excluded.

  • Output:
    • mu: The base line log mean count for the first cell group
    • beta_cellgroup: The coefficient of cellgroups
    • log2FC: log2 fold change \(\log_2(e^{\beta_g})\) of counts between the two groups. Positive values indicate that the gene is more expressed in the second group.
    • pval: Unadjusted p-value
    • BH: Adjusted p-value by Benjamini-Hochberg procedure
    • REvariation:
    • FEvariation:
    • RESvariation:
    • hits: Indicating whether the gene is a DEG based on the new criteria

Binomial GLMM

  • Input:
    • sce: A SingleCellExpreriment object containing raw counts generated by 10X protocol
    • cellgroups: A vector labeling the cell groups
    • repgroups: A vector labeling the replicates (donors)
    • freq_expressed: A threshold value of gene expression frequency (default = \(0.05\))
  • Details:
    • Only genes that pass the threshold for gene expression frequency will be considered as inputs.

    • We take the zero proportion of each gene as the response in the binomial model. (\(1\) if the read count is zero; otherwise \(0\).)

    • For each gene, we run a binomial glmm method (glmmPQL) on the zero proportion with cellgroups as fixed effect and repgroups as random effect \[ \begin{aligned} \mathbb{1}_{X_{cgk}=0}|p_{cgk} & \sim Bernoulli(p_{cgk})\\ \log \frac{p_{cgk}}{1-p_{cgk}} & = \mu_g + X_c\beta_{g} + \epsilon_{gk}\\ \end{aligned} \]

    • If the algorithm doesn’t converge, the gene will be excluded.

  • Output:
    • mu: The base line of logit zero proportion for the first cell group
    • beta_cellgroup: The coefficient of cellgroups
    • log2FC: In Binomial GLMM, \(\log_2(e^{\beta_g})\) represents the log2 odds ratio change between group1 and group2. Positive values indicate that the gene is more expressed in the second group.
    • pval: Unadjusted p-value
    • BH: Adjusted p-value by Benjamini-Hochberg procedure
    • hits: Indicating whether the gene is a DEG based on the new criteria

Pseudobulk DEseq2

  • Input:
    • sce: A SingleCellExpreriment object containing raw counts generated by 10X protocol
    • group_id: A feature labeling the cell groups or states
    • sample_id: A feature labeling the replicates (donors)
  • Details:
    • Aggregate the counts within same donor and same cell group.
    • Run Muscat::pbDS(pb, method = “DESeq2”) on the pseudobulk counts
    • DESeq2 performs an internal normalization and use the median of ratios as the size factor.
    • DESeq2 fits negative binomial generalized linear models for each gene and uses the Wald test for significance testing.
    • Ref
  • Output:
    • log2FC: log2 fold change of counts between the two groups. Positive values indicate that the gene is more expressed in the second group.
    • pval: Unadjusted p-value
    • BH: Adjusted p-value by Benjamini-Hochberg procedure.
    • hits: Indicating whether the gene is a DEG. TRUE if BH is smaller than 0.05 and absolute log2FC is greater than the predetermined threshold.

Pseudobulk edgeR

  • Input:
    • sce: A SingleCellExpreriment object containing CPM counts
    • cellgroups: A vector labeling the cell groups
    • repgroups: A vector labeling the replicates (donors) (NA if without donor effect)
  • Details:
    • Aggregate the CPM counts within same donor and same cell group.
    • Run Muscat::pbDS(pb, method = “edgeR”) on the pseudobulk counts
    • EdgeR uses TMM method to compute normalization factors which are multiplied by the library size to yield the effective library size.
    • EdgeR fits negative binomial generalized linear models.
    • Ref
  • Output:
    • log2FC: log2 fold change of counts between the two groups. Positive values indicate that the gene is more expressed in the second group.
    • pval: Unadjusted p-value
    • BH: Adjusted p-value by Benjamini-Hochberg procedure.
    • hits: Indicating whether the gene is a DEG. TRUE if BH is smaller than 0.05 and absolute log2FC is greater than the predetermined threshold.

MAST

  • Input:
    • sce: A SingleCellExpreriment object containing raw counts generated by 10X protocol
    • cellgroups: A vector labeling the cell groups
    • repgroups: A vector labeling the replicates (donors) (NA if without donor effect)
    • freq_expressed: A threshold value of gene expression frequency (default = \(0.05\))
  • Details:
    • Only genes that pass the threshold for gene expression frequency will be considered as inputs.
    • Transform the raw counts to log2 (CPM + 1).
    • Compute cdr(cellular detection rate).
    • Run MAST methods on the log2 transformed counts with cellgroups, repgroups and cdr as covaraites.
    • MAST fits zero inflated generalized linear models for each gene and use likelihood ratio test for significance testing. -Ref
  • Output:
    • log2FC: log2 fold change of counts between the two groups. Positive values indicate that the gene is more expressed in the second group.
    • pval: Unadjusted p-value
    • BH: Adjusted p-value by Benjamini-Hochberg procedure.
    • hits: Indicating whether the gene is a DEG. TRUE if the padj is smaller than 0.05 and absolute log2FC is greater than the predetermined threshold.

Wilcox

  • Input:
    • object: A Seurat object containing normalized/integrated counts obtained from Seurat package
    • ident.1: Indices of the first group
    • ident.2: Indices of the second group
    • test.use: Denotes which test to use. (“wilcox”:Wilcoxon Rank Sum test)
    • min.pct: Only test genes that are detected in a minimum fraction of min.pct cells in either of the two populations. (Default is 0.1)
    • logfc.threshold: Limit testing to genes which show, on average, at least X-fold difference (log-scale) between the two groups of cells. (Default is 0.25.)
  • Details:
    • Rand-sum test
    • Run Wilcox methods (Seurat::FindMarkers) on the normalized/integrated counts.
    • Ref
  • Output:
    • avg_log2FC: log2 fold change of mean counts between the two groups. Positive values indicate that the gene is more expressed in the first group. \(\log_2(mean_1+1)-\log_2(mean_2+1)\)
    • p_val: Unadjusted p-value
    • p_val_adj: Adjusted p-value by Bonferroni correction.
    • hits: Indicating whether the gene is a DEG. TRUE if the p_val_adj is smaller than 0.05 and absolute log2FC is greater than the predetermined threshold.

MMvst

  • Input:
    • sce: A SingleCellExpreriment object containing VST counts provided by sctransform.
    • group_id: A feature labeling the cell groups or states
    • sample_id: A feature labeling the replicates (donors)
  • Details:
    • Fitting linear mixed models (∼1+group_id+(1|sample_id)) on VST data.
    • Ref
  • Output:
    • log2FC: log2 fold change of counts between the two groups. Positive values indicate that the gene is more expressed in the second group.
    • pval: Unadjusted p-value
    • BH: Adjusted p-value by Benjamini-Hochberg procedure.
    • hits: Indicating whether the gene is a DEG. TRUE if BH is smaller than 0.05 and absolute log2FC is greater than the predetermined threshold.

MMpoisson

  • Input:
    • sce: A SingleCellExpreriment object containing VST counts provided by sctransform.
    • group_id: A feature labeling the cell groups or states
    • sample_id: A feature labeling the replicates (donors)
  • Details:
    • Fitting Poisson generalized linear mixed models (∼1+group_id+(1|sample_id)) on raw UMI counts.
    • Library size factors are computed and used as the offset in the model.
    • Ref
  • Output:
    • log2FC: log2 fold change of counts between the two groups. Positive values indicate that the gene is more expressed in the second group.
    • pval: Unadjusted p-value
    • BH: Adjusted p-value by Benjamini-Hochberg procedure.
    • hits: Indicating whether the gene is a DEG. TRUE if BH is smaller than 0.05 and absolute log2FC is greater than the predetermined threshold.