Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Investigate the h5ad object

To investigate the contents of the adata_Uninj_tdtom_ext_subset_LEC_subset.h5ad object, we inspected its dimensions, metadata fields, expression matrices, available layers, and the grouping variable used for the analysis. The following contents were identified:

Component Contents
Shape 970 cells × 2,000 genes
obs n_counts, log_counts, n_genes, mt_frac, scrublet_scores, predicted_doublets, size_factors, S_score, G2M_score, phase, leiden_r1, annotation_pre, annotation_pre2, batch, Amp_location, annotation_pre3, TdtomStatus, groups, _scvi_batch, _scvi_labels, scvi_leiden10, scvi_leiden08, scvi_leiden06, scvi_leiden04, annotation_int, annotation_int2
var highly_variable, highly_variable_rank, means, variances, variances_norm
uns Amp_location_colors, _scvi_manager_uuid, _scvi_uuid, annotation_int2_colors, annotation_pre2_colors, batch_colors, hvg, leiden, log1p, neighbors, pca, umap
obsm X_draw_graph_fr, X_pca, X_pca_org, X_scVI, X_scVI_MDE, X_umap, X_umap_org
varm PCs
layers X_scVI_normalizedCounts, counts
obsp connectivities, distances
adata.X Shape: (970, 2000); min: 0.0; max: 7.3707; mean: 0.1552; zeros: 1,696,300 / 1,940,000
counts layer Shape: (970, 2000); min: 0.0; max: 1433.0; mean: 0.5599
adata.X vs counts Not identical; not approximately equal
log1p metadata {}
Grouping variable adata.obs["Amp_location"]
Group counts P2: 612; P3: 358

Our best interpretation is that the Amp_location column was used to define the P2 and P3 groups for differential gene expression analysis, while annotation_int2 was used to identify and select the LEC cell population for the subset analysis.

Relationship between Amp_location and batch

To investigate the experimental structure of the data, we examined the relationship between Amp_location and batch.

The cross-tabulation showed that each batch label was associated exclusively with either P2 or P3:

Amp_location B_P2X_2 B_P2X_3 B_P2_1 B_P3X_1 B_P3X_2 JS_P3_1 MS_P3_1 MS_P3_2 UninjP2_Tdtom UninjP3_Tdtom
P2 182 215 128 0 0 0 0 0 87 0
P3 0 0 0 53 36 127 27 7 0 108

and Amp_location × Batch

Amp_location Batch Number of cells
P2 B_P2X_3 215
P2 B_P2X_2 182
P2 B_P2_1 128
P3 JS_P3_1 127
P3 UninjP3_Tdtom 108
P2 UninjP2_Tdtom 87
P3 B_P3X_1 53
P3 B_P3X_2 36
P3 MS_P3_1 27
P3 MS_P3_2 7

Amp_location

Amp_location Number of cells
P2 612
P3 358

Total: 970 cells

Gene filtering

Genes detected in fewer than 10 cells were removed before the downstream analyses. A gene was retained if it was detected in at least 10 cells.

  • Genes before filtering: 2,000
  • Minimum number of cells in which a gene had to be detected: 10
  • Genes retained after filtering: 1,443

Wilcoxon vs MAST for differential gene expression

Given this multi-sample and multi-study structure, a simple Wilcoxon rank-sum test treating individual cells as independent observations is not ideal, because it does not account for replicate-level groups as the experimental unit and may therefore overstate the evidence for P2–P3 differences by treating thousands of cells as independent replicates.

For this reason, MAST was selected as an alternative differential expression method. The key difference is that the Wilcoxon rank-sum test compares the P2 and P3 cells directly, without incorporating the fact that these cells come from multiple distinct samples. Therefore, variation between samples is not separately accounted for in the P2–P3 comparison.

MAST allows the P2–P3 comparison to be modelled while also incorporating the sample labels into the model. This means that differences between the 10 samples can be taken into account when estimating the difference between P2 and P3. The MAST analysis therefore provides a way to assess the P2–P3 difference while considering the sample structure, which the cell-level Wilcoxon test does not do.

Differential gene expression: MAST GLM vs MAST GLMER

The appropriate MAST model depends on the replicate structure of the dataset and on whether the replicate-level groups represent a source of variation that should be accounted for in the analysis.

A standard generalized linear model (GLM) estimates the difference between P2 and P3 while accounting for cell-level covariates such as cellular detection rate, but it does not explicitly model variation between replicate-level groups. Consequently, differences between replicate-level groups may contribute to the apparent P2–P3 difference.

A generalized linear mixed-effects model (GLMER) can be used when the dataset contains multiple replicate-level groups, whether these represent biological replicates or technical replicates. The replicate-level grouping variable is included as a random effect, allowing the model to account for variation between these groups while estimating the P2–P3 difference.

Therefore, the choice between GLM and GLMER depends on the experimental design and on whether the replicate-level grouping variable represents a source of variation that should be modelled. In the present dataset, the 10 batch labels represent distinct sample-level groups. The GLMER formulation was therefore used to account for variation associated with these groups, assuming that batch represents the relevant replicate-level structure.

Umap of LEC P2/P3

💡💡 Differential Gene Expression using MAST GLMER: recommended if batch represents replicate-level variation

Pearson Correlation

Pearson correlation is also a reasonable similarity measure to report. In addition, we could report cosine similarity and optimal transport as complementary measures of similarity, as they capture different aspects of similarity between the datasets.

Cosine similarity score

Cosine similarity measures the similarity in the overall direction of the expression profiles, independent of their magnitude. A higher score indicates more similar expression profiles.

  • Cosine similarity: 0.8963411658224881

OT similarity score

Optimal transport measures the similarity between the distributions of cells in the two datasets by estimating the minimum cost of transforming one distribution into the other. A higher similarity score indicates greater similarity between the two datasets.

  • OT distance: 0.8979
  • OT-derived similarity score: 0.5269

💡💡 Differential Gene Expression MAST GLM: Original analysis approach - does not account for replicate-level variation and is included for comparison.

🚨🚨 Why GLM and GLMER Show Different Significance

GLM can produce more significant results because it does not explicitly distinguish P2–P3 variation from replicate-level variation. GLMER accounts for replicate-level variation and therefore tests whether the P2–P3 difference remains after accounting for differences between replicates.

About

LEC

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages