# CodingGenes — Full Topic & Citation Corpus (llms-full.txt) > Canonical Source: https://codinggenes.com | Tagline: "Learning Bioinformatics in the AI Era." | Contact: contact@codinggenes.com ## About CodingGenes CodingGenes is an open bioinformatics learning platform sharing evidence-bound topics, R and Python statistical workflows, and structured learning tracks for biologists, graduate researchers, and bioinformaticians working in the AI era. ## Core Focus - **Core bioinformatics & omics assay foundations:** Clear, scientist-to-scientist explanations of how bulk RNA-seq, single-cell atlases, and spatial transcriptomics turn molecules into count matrices, manifolds, and statistical models. - **Harnessing LLMs & foundation models responsibly:** Practical workflows for pairing AI assistants (ChatGPT, Gemini) and biological foundation models (ESM-2, scGPT, AlphaFold 3) with R and Python pipelines while verifying experimental design and replication. - **Benchmarks, statistical rigor & ecosystem releases:** Evidence-bound analyses of negative-binomial GLMs, donor pseudobulk, spatial segmentation, on-disk matrices (BPCells, Zarr), and scverse/Bioconductor standards. ## Learning Tracks - **Omics Foundations & Data Types (`omics-foundations`):** Understand how bulk cohorts, barcoded droplets, and tissue imaging turn RNA molecules into count tables—and choose the container (`SummarizedExperiment`, `AnnData`, `SpatialData`) that matches your biological question. - **Bioinformatics with AI & LLMs (`ai-workflows`):** Use ChatGPT, Gemini, and coding agents to accelerate `Scanpy`, `Seurat v5`, and `Nextflow` scripts while auditing sample sizes, covariates, and biological foundation model (`ESM-2`, `scGPT`) assumptions. - **Statistical Modeling in R & Python (`statistical-modeling`):** Fit calibrated generalized linear models where treatment was actually assigned: donor pseudobulk aggregation, batch adjustment, dispersion estimation, and effect-size shrinkage in `DESeq2` and `PyDESeq2`. - **Spatial Omics, Benchmarks & New Methods (`benchmarks`):** Compare imaging (`Xenium`, `CosMx`) against barcoded sequencing (`Visium HD`), scale million-cell atlases on disk (`BPCells`, backed `AnnData`), and evaluate new methods against classical baselines. --- ## Published Topics & Field Notes ### Bulk, Single-Cell or Spatial Transcriptomics: Which One Fits Your Question? - **Canonical URL:** https://codinggenes.com/blog/bulk-vs-single-cell-vs-spatial-transcriptomics-guide/ - **Category:** Principles - **Learning Track:** omics-foundations - **Published:** 2026-11-12 - **In brief:** Choose bulk RNA-seq when tissue-averaged expression answers the biological question and cohort statistical power or isoform coverage is the priority. Choose single-cell or single-nucleus RNA-seq to resolve heterogeneous cell states, rare populations, or trajectories without spatial coordinates. Choose spatial transcriptomics (Xenium, CosMx, Visium HD) when your hypothesis depends on physical cell–cell proximity or histological architecture. - **Key takeaways:** - Higher cellular or spatial resolution reduces per-cell transcript capture depth and typically constrains the number of independent biological samples a budget can support. - Each modality maps to a dedicated data container: SummarizedExperiment (bulk cohorts), Seurat v5 or AnnData (single-cell matrices), and SpatialData or SpatialExperiment (registered tissue images, polygons, and coordinates). - Multi-modality studies gain the most statistical power by pairing deep, well-replicated bulk or pseudobulk cohorts with targeted single-cell and spatial tissue mapping. Every transcriptomics assay converts captured RNA molecules into a matrix of counts. What changes from one platform to the next is **the physical entity represented by each column of that matrix**: an entire homogenized specimen, an isolated cell or nucleus, or a coordinate-indexed location inside intact tissue. ## Comparing physical measurement and statistical trade-offs | Modality | Observation Unit & Sparsity | Questions Answered Best | Primary Container (`R` / `Python`) | Key Analytical Constraint | | :--- | :--- | :--- | :--- | :--- | | **Bulk RNA-seq** | `Genes × Samples` dense integer fragment counts | Well-powered clinical cohorts, time-courses, drug screens, isoform usage [1] | `SummarizedExperiment` [2] / `DeseqDataSet` | Composition shifts between cell types are confounded with per-cell transcriptional changes | | **Single-Cell / Single-Nucleus (`scRNA-seq` / `snRNA-seq`)** | `Genes × Barcoded Droplets` sparse UMI matrix | Resolving cell states, rare subpopulations, and cell-type-specific perturbation responses [3, 4] | `Seurat v5` [4], `SingleCellExperiment` [2] / `AnnData` [3] | Tissue dissociation destroys spatial neighborhood coordinates; high per-cell zero inflation | | **Spatial Transcriptomics (`Xenium`, `CosMx`, `Visium HD`)** | `(x, y)` coordinates + segmentation masks or barcoded bins | Tumor–immune borders, niche organization, and local ligand–receptor proximity [5] | `SpatialExperiment` / `SpatialData` [5] | Panel size vs. resolution trade-off; segmentation spillover at touching cell membranes | ## Matching R and Python containers to the experimental design Once the physical measurement unit is fixed, software selection in R and Python follows directly: 1. **Bulk cohorts (`n` independent samples):** Keep unscaled integer counts in a `SummarizedExperiment` (`R`) or `AnnData` table (`Python`) and model library size offsets and negative-binomial dispersion across biological replicates with `DESeq2` [1] or `PyDESeq2`. When tissue cell-type proportions vary between groups, pair bulk expression with histopathology or reference-based deconvolution rather than attributing every fold change to intracellular regulation. 2. **Single-cell atlases (`cells` nested inside `donors`):** Use `AnnData` with `Scanpy` [3] or `Seurat v5` [4] for quality control, ambient RNA assessment, latent representation learning, and cell-state annotation—then aggregate raw integer unique molecular identifier (`UMI`) counts per donor before testing sample-level conditions. 3. **Spatial tissue sections (`coordinates` + `images` + `tables`):** Store multi-scale pathology images, polygon masks, transcript coordinates, and count tables in one coordinate-aligned `SpatialData` Zarr store [5] so coordinate transformations stay synchronized from segmentation through neighborhood testing. ## Using LLMs effectively when bridging modalities When combining dissociated `scRNA-seq` with bulk cohorts or spatial sections, LLMs such as ChatGPT and Gemini are particularly helpful for translating gene-identifier tables (`Ensembl` IDs vs. `HGNC` symbols), aligning metadata schemas across `SummarizedExperiment` and `AnnData`, and scaffolding diagnostic visualizations. Always verify that gene filtering, normalization, and batch covariates match the assumptions of each modality's downstream statistical model rather than applying single-cell log-normalization pipelines to bulk count tables or spatial coordinate graphs. #### Verified Primary References - Love MI, Huber W, Anders S (2014). Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. *Genome Biology 15, 550*. https://doi.org/10.1186/s13059-014-0550-8 - Huber W, Carey VJ, Gentleman R, Anders S, Carlson M, Carvalho BS, et al. (2015). Orchestrating high-throughput genomic analysis with Bioconductor. *Nature Methods 12, 115–121*. https://doi.org/10.1038/nmeth.3252 - Wolf FA, Angerer P, Theis FJ (2018). SCANPY: large-scale single-cell gene expression data analysis. *Genome Biology 19, 15*. https://doi.org/10.1186/s13059-017-1382-0 - Hao Y, Stuart T, Kowalski MH, Choudhary S, Hoffman P, Hartman A, et al. (2024). Dictionary learning for integrative, multimodal and scalable single-cell analysis. *Nature Biotechnology 42, 293–304*. https://doi.org/10.1038/s41587-023-01767-y - Marconato L, Palla G, Yamauchi KA, Virshup I, Heumos E, Zernia M, et al. (2024). SpatialData: an open and universal data framework for spatial omics. *Nature Methods 21, 589–592*. https://doi.org/10.1038/s41592-024-02212-x #### Common Questions - **Q: Why not use single-cell or spatial transcriptomics for every experiment?** A: Finer spatial or cellular resolution comes at the expense of per-cell sensitivity, per-sample cost, and full-length transcript coverage. A 48-sample perturbation or dose-response experiment measured by bulk RNA-seq often achieves substantially higher statistical power to detect pathway-level shifts than an under-replicated 4-sample single-cell experiment. - **Q: When is single-nucleus RNA-seq preferred over whole-cell scRNA-seq?** A: Single-nucleus RNA-seq (snRNA-seq) is preferred for snap-frozen archival biopsies and tissues containing fragile or elongated cells—such as neurons, adipocytes, or cardiomyocytes—that suffer dissociation bias during enzymatic whole-cell preparation, with the trade-off of capturing primarily nuclear and intronic transcripts. - **Q: How do LLMs and foundation models help across multi-modality designs?** A: LLMs speed up cross-container data reshaping and quality-control plotting across DESeq2, Seurat v5, Scanpy, and SpatialData, while reference-mapping tools transfer cell-state annotations from dissociated scRNA-seq atlases onto targeted spatial panels. --- ### Why Now Is the Best Time to Learn Bioinformatics - **Canonical URL:** https://codinggenes.com/blog/why-now-is-the-best-time-to-learn-bioinformatics/ - **Category:** Principles - **Learning Track:** ai-workflows - **Published:** 2026-11-12 - **In brief:** Standardized data structures (SummarizedExperiment, Seurat v5, AnnData, SpatialData) and large language models (ChatGPT, Gemini, coding agents) now handle routine pipeline syntax in R and Python. Researchers gain the most leverage by mastering three areas: how sequencing and imaging assays generate count matrices, how to audit AI-generated analyses against experimental replication, and where biological foundation models outperform—or trail—classical baselines. - **Key takeaways:** - Interoperable containers in Bioconductor (R) and scverse (Python) allow one mental model of count matrices, sample metadata, and spatial coordinates to transfer across packages. - Large language models accelerate syntax and boilerplate, but the analyst must still specify the biological unit of replication, batch covariates, and count layer. - Biological foundation models (AlphaFold 3, ESM-2, scGPT) complement rather than replace classical alignment and generalized linear models; empirical benchmarks remain essential. For much of the past two decades, entering bioinformatics required months of troubleshooting compilation toolchains, incompatible file formats, and ad hoc parser scripts before running a single statistical test. That barrier obscured what computational biology actually does: connecting molecular measurements to testable biological models. Two shifts have changed how scientists learn and practice the field. First, mature open-source ecosystems—`Bioconductor` and `Seurat v5` in R [1, 3], and `scverse` (`AnnData`, `Scanpy`, `SpatialData`) in Python [2, 4]—have standardized how expression matrices, sample covariates, and tissue coordinates are stored in memory and on disk. Second, general-purpose large language models (LLMs) such as ChatGPT and Gemini, together with procedural research-agent workflows [7], have compressed the time required to write routine data-wrangling and plotting code. When syntax becomes faster to produce, **scientific judgment becomes the limiting step**. Three capabilities now separate reliable bioinformatics analyses from plausible-looking errors. ## 1. Understand the measurement model underneath the container Every omics workflow rests on a small set of physical and statistical questions: * **What physical event produced one count?** In short-read bulk RNA sequencing (`RNA-seq`), read counts reflect fragment abundance pooled across millions of cells; in droplet single-cell RNA-seq (`scRNA-seq`), unique molecular identifiers (`UMIs`) tag transcripts captured from individual cells or nuclei; in targeted spatial assays, optical decoding records `(x, y, z)` coordinates of hybridized probes inside fixed tissue [4]. * **Where do countmatrix, sample metadata, and feature metadata live?** Whether you open a `SummarizedExperiment` in R or an `AnnData` object in Python [1, 2], the core architecture is identical: an integer count matrix linked to observation-level covariates (`colData` or `.obs`) and gene-level annotations (`rowData` or `.var`). * **Which source of variance is biological versus technical?** Library depth, capture efficiency, batch processing, and donor-to-donor variability shape count dispersion before any treatment effect is estimated. Once those relationships are clear, moving between R and Python—or asking an LLM to translate an analysis from `Seurat v5` to `Scanpy`—becomes a transparent mapping between equivalent slots rather than guesswork. ## 2. Harness LLMs for implementation while owning the study design In day-to-day bioinformatics, LLMs are most effective when treated as fast implementation partners under explicit statistical constraints: | Workflow Stage | High-Value Use of ChatGPT / Gemini | Verification Owned by the Researcher | | :--- | :--- | :--- | | **Data ingestion & QC** | Writing reproducible `AnnData` / `Seurat` loaders, metadata joins, and multi-panel diagnostic figures | Confirming raw integer `UMIs` are preserved separately from log-normalized views | | **Hypothesis testing** | Drafting `DESeq2` or `PyDESeq2` design formulas and contrast tables | Ensuring the statistical unit (`n`) matches the randomized donor, animal, or well rather than pooled cells | | **Foundation-model inference** | Scaffolding embedding extraction with `ESM-2`, `scGPT`, or `AlphaFold 3` [5] | Benchmarking zero-shot predictions against sequence-alignment or linear baselines [6] | A language model inspecting `adata.obs` cannot tell on its own whether six samples represent six independent patients or six technical aliquots from a single biopsy. Supplying the experimental hierarchy in your prompt—and checking the degrees of freedom reported by the fitted model—prevents pseudoreplication and unmodeled batch confounding. ## 3. Evaluate biological foundation models with the same rigor as classical algorithms Pretrained biological models have expanded what a single laboratory can compute, from biomolecular complex prediction with `AlphaFold 3` [5] to protein sequence representations and single-cell embeddings [3, 6]. At the same time, independent zero-shot evaluations show that larger or more complex models do not automatically outperform simpler methods across every task; for example, zero-shot single-cell foundation models can trail established integration or feature-selection baselines when evaluated without task-specific fine-tuning [6]. ## Scope and limitations Standardized containers and AI assistants reduce software friction, but they cannot rescue an underpowered cohort, unrecorded batch confounding, or degraded RNA in archival tissue. At **CodingGenes**, our guides, YouTube lessons, and structured learning tracks focus on that intersection: clear visual models of how assays and algorithms work, side-by-side R and Python implementations, and explicit verification checks for working in the AI era. #### Verified Primary References - Huber W, Carey VJ, Gentleman R, Anders S, Carlson M, Carvalho BS, et al. (2015). Orchestrating high-throughput genomic analysis with Bioconductor. *Nature Methods 12, 115–121*. https://doi.org/10.1038/nmeth.3252 - Virshup I, Bredikhin D, Heumos L, Palla G, Sturm G, Gayoso A, et al. (2023). The scverse project provides a computational ecosystem for single-cell omics data analysis. *Nature Biotechnology 41, 604–606*. https://doi.org/10.1038/s41587-023-01733-8 - Hao Y, Stuart T, Kowalski MH, Choudhary S, Hoffman P, Hartman A, et al. (2024). Dictionary learning for integrative, multimodal and scalable single-cell analysis. *Nature Biotechnology 42, 293–304*. https://doi.org/10.1038/s41587-023-01767-y - Marconato L, Palla G, Yamauchi KA, Virshup I, Heumos E, Zernia M, et al. (2024). SpatialData: an open and universal data framework for spatial omics. *Nature Methods 21, 589–592*. https://doi.org/10.1038/s41592-024-02212-x - Abramson J, Adler J, Dunger J, Evans R, Green T, Pritzel A, et al. (2024). Accurate structure prediction of biomolecular interactions with AlphaFold 3. *Nature 630, 493–500*. https://doi.org/10.1038/s41586-024-07487-w - Kedzierska KZ, Crawford L, Amini AP, Lu AX (2025). Zero-shot evaluation reveals limitations of single-cell foundation models. *Genome Biology 26, 101*. https://doi.org/10.1186/s13059-025-03574-x - Kassis T, Agarwal V, He Y, Patel D, Brueckner AM (2026). Scientific Agent Skills: A Library of Procedural Knowledge for Research Agents. *arXiv:2609.00065*. https://doi.org/10.48550/arXiv.2609.00065 #### Common Questions - **Q: What is the most effective way to start learning bioinformatics in the AI era?** A: Begin with the physical measurement and core data container—how sequencing reads or imaging probes become integer counts in SummarizedExperiment, Seurat, AnnData, or SpatialData—and learn experimental replication alongside R and Python scripting. Use ChatGPT or Gemini to explain syntax and draft plots, but verify sample sizes, normalization layers, and model designs yourself. - **Q: How are AI tools used in modern computational biology workflows?** A: AI enters at two distinct layers. General-purpose large language models and procedural coding agents speed up pipeline authoring across Bioconductor, scverse, and Nextflow. Domain-specific biological models—such as AlphaFold 3 for biomolecular complexes, ESM-2 for protein sequences, and scGPT for single-cell expression—provide learned representations that still require task-specific benchmarking. - **Q: Should a biologist learn R or Python first?** A: Either language is a productive starting point when anchored in shared statistical concepts. R (Bioconductor, DESeq2, Seurat v5) remains central for generalized linear modeling and clinical cohort inference, while Python (scverse, Scanpy, PyDESeq2, SpatialData) connects directly to modern machine learning and spatial Zarr stores. --- ### Pseudobulk Differential Expression in DESeq2 and PyDESeq2: Donors Are the Replicates - **Canonical URL:** https://codinggenes.com/blog/pseudobulk-differential-expression-seurat-pydeseq2/ - **Category:** Tutorials - **Learning Track:** statistical-modeling - **Published:** 2026-11-10 - **In brief:** When a disease state, genotype, or treatment is assigned to patients, animals, or independent wells, the biological unit of replication is the sample—not the individual cell. Summing raw integer UMI counts per (sample, cell_type) and fitting a negative-binomial generalized linear model in DESeq2 (R) or PyDESeq2 (Python) aligns the test's degrees of freedom with the study design and controls false discovery rates. - **Key takeaways:** - Cells captured from the same biopsy share host genetics, physiological state, and library preparation; testing pooled cells as independent observations causes pseudoreplication. - Across 18 ground-truth benchmark datasets audited by Squair et al. (2021), pseudobulk aggregation paired with bulk negative-binomial models consistently controlled false discoveries. - When prompting ChatGPT or Gemini for differential expression code, explicitly name the sample replicate column (for example donor_id), require raw integer UMI summation, and verify that the model's sample count equals the number of biological replicates. One foundational rule governs multi-sample omics inference: **the statistical unit of replication must match the biological unit to which the condition or treatment was assigned** [1, 2]. ## Why pooled cells from few donors cause pseudoreplication Consider a worked pedagogical cohort profiling **18,000 cells across 6 individuals** (3 treated patients and 3 controls, ~3,000 cells per biopsy). Because single-cell RNA sequencing (`scRNA-seq`) measures one transcriptomic profile per barcoded droplet, it is tempting—and common in default LLM-generated scripts—to run a two-group rank-sum test directly across all cells in a cluster (`FindMarkers()` in `Seurat` or `sc.tl.rank_genes_groups()` in `Scanpy`). Cells isolated from the same donor share host genotype, physiological environment, tissue dissociation, and ambient RNA background, producing positive within-donor correlation [2]. Treating `18,000` correlated cells as independent replicates understates standard errors and converts ordinary baseline variation between people into minuscule *p*-values: * **Empirical benchmark evidence:** Squair et al. (2021) audited 500 `scRNA-seq` publications and benchmarked 14 differential expression (`DE`) methods across 18 ground-truth datasets; all 6 top-performing workflows aggregated counts into sample-level pseudobulk profiles before testing [1]. In negative-control splits of 14 unstimulated control cohorts (each with ≥ 6 healthy samples divided randomly into two groups), cell-level tests called hundreds of false-positive DE genes in the absence of biological treatment differences [1]. * **Concrete human PBMC example:** In the official `Seurat` differential expression vignette on interferon-stimulated human `CD14` monocytes (`ifnb` dataset), cell-level Wilcoxon testing identifies **1,639** genes at *p* < 0.05 that do not remain statistically significant after donor-level `AggregateExpression` + `DESeq2` modeling; for example, *SRGN*'s *p*-value **increases** from 1.31 × 10−19 at the cell level to 0.182 at the donor level [6]. | Analytical Strategy | Unit Modeled as Independent (`n`) | Primary Use Case | Key Trade-off / Requirement | | :--- | :--- | :--- | :--- | | **Cell-level rank test** (`FindMarkers` / `rank_genes_groups`) | Pooled cells within cluster | Exploratory marker ranking between clusters inside a single specimen | Ignores within-donor correlation; uncalibrated for cross-patient contrasts [1, 2] | | **Donor pseudobulk NB-GLM** (`DESeq2` / `PyDESeq2`) | Biological samples (`donors`, `animals`, `wells`) | Comparing treatments, genotypes, or disease states assigned per sample [1, 3, 4] | Requires ≥ 3 independent samples per group; obscures cell-level variance components | | **Hierarchical mixed model** (`GLMM` with donor random effect) | Cells nested within donors | Modeling continuous cell-level covariates in larger cohorts [2] | Higher computational cost; sensitive to random-effect specification at very small donor counts | ## Prompting ChatGPT or Gemini without falling into the cell-level trap When asked *"find differentially expressed genes between treated and control in my Seurat / Scanpy object"*, general-purpose LLMs frequently return `FindMarkers(ident.1 = "Treated", ident.2 = "Control")` because that function dominates public tutorials. To get a valid implementation on the first pass, specify four facts in your prompt: 1. The column holding independent biological replicates (`donor_id`), 2. The cell-state annotation column (`cell_type`), 3. The raw integer unique molecular identifier (`UMI`) layer (`counts`), and 4. Any technical batch covariates (`~ batch + condition`). ## Summing raw UMI counts in R (`Seurat v5` + `DESeq2`) `DESeq2` estimates size factors and gene-wise negative-binomial dispersion directly from unscaled integer counts [3]: ```r library(Seurat) library(DESeq2) # 1. Sum raw integer UMI counts per (cell_type, donor_id) pb_matrices <- AggregateExpression( object = seurat_obj, assays = "RNA", return.seurat = FALSE, group.by = c("cell_type", "donor_id", "batch", "condition") )$RNA # 2. Fit negative-binomial GLM on a filtered cell state (>= 15 cells & >= 1,000 UMIs per donor) dds <- DESeqDataSetFromMatrix( countData = pb_cd8_counts, colData = pb_cd8_meta, design = ~ batch + condition ) dds <- DESeq(dds) # Shrink noisy low-count log2 fold changes for downstream ranking res <- lfcShrink(dds, coef = "condition_Treated_vs_Control", type = "apeglm") ``` ## Equivalent workflow in Python (`decoupleR` + `PyDESeq2`) In the Python `scverse` ecosystem, `decoupler.get_pseudobulk()` aggregates integer `UMI` counts from `adata.layers["counts"]` [5], and `PyDESeq2` fits the negative-binomial generalized linear model (`GLM`) with Wald statistics and empirical Bayes shrinkage [4]: ```python import decoupler as dc from pydeseq2.dds import DeseqDataSet from pydeseq2.ds import DeseqStats # 1. Aggregate raw integer UMI counts per (donor_id, cell_type) pdata = dc.get_pseudobulk( adata, sample_col="donor_id", groups_col="cell_type", layer="counts", mode="sum", min_cells=15, min_counts=1000, ) # 2. Subset one cell state and fit donor-level NB-GLM cd8 = pdata[pdata.obs["cell_type"] == "CD8_Tem"].copy() dds = DeseqDataSet(adata=cd8, design="~ batch + condition") dds.deseq2() stats = DeseqStats(dds, contrast=["condition", "Treated", "Control"]) stats.summary() ``` ## Diagnostics, limitations, and interpretation 1. **Inspect donor-level principal components before reading *p*-values.** Plot variance-stabilized (`vst`) pseudobulk profiles colored by batch, sex, and total `UMIs` per sample to check whether technical covariates are collinear with treatment. 2. **Plot per-donor stripcharts for top candidate genes.** Verify that estimated fold changes reflect consistent shifts across biological replicates rather than a single high-leverage sample. 3. **Interpret non-significance proportionally.** With small sample sizes (such as 3 vs. 3 donors), a Benjamini–Hochberg adjusted *p* > 0.05 reflects limited statistical power rather than proof of zero biological effect; report shrunken log2 fold-change estimates alongside their standard errors [3]. #### Verified Primary References - Squair JW, Gautier M, Kathe C, Anderson MA, James ND, Hutson TH, et al. (2021). Confronting false discoveries in single-cell differential expression. *Nature Communications 12, 5692*. https://doi.org/10.1038/s41467-021-25960-2 - Zimmerman KD, Espeland MA, Langefeld CD (2021). A practical solution to pseudoreplication bias in single-cell studies. *Nature Communications 12, 738*. https://doi.org/10.1038/s41467-021-21038-1 - Love MI, Huber W, Anders S (2014). Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. *Genome Biology 15, 550*. https://doi.org/10.1186/s13059-014-0550-8 - Muzellec B, Teleńczuk M, Cabeli V, Andreux M (2023). PyDESeq2: a python package for bulk RNA-seq differential expression analysis. *Bioinformatics 39(9), btad547*. https://doi.org/10.1093/bioinformatics/btad547 - Badia-i-Mompel P, Vélez Santiago J, Braunger J, Geiss C, Dimitrov D, Müller-Dott S, et al. (2022). decoupleR: ensemble of computational methods to infer biological activities from omics data. *Bioinformatics Advances 2(1), vbac016*. https://doi.org/10.1093/bioadv/vbac016 - Satija Lab (2024). Seurat v5 Official Vignette: Differential expression testing (ifnb human PBMC dataset). *Seurat Documentation*. https://satijalab.org/seurat/articles/de_vignette #### Common Questions - **Q: How many biological replicates are needed for pseudobulk differential expression?** A: Plan for at least 3 to 4 independent biological samples per condition as a bare minimum for dispersion estimation, with substantially higher statistical power at 6 or more donors per group. Retain a cell type in a given sample only when enough cells and total UMIs are captured (commonly at least 15 to 20 cells and 1,000 total UMIs) to avoid extreme count sparsity. - **Q: Should pseudobulk aggregation sum raw integer UMI counts or log-normalized expression?** A: Always sum unscaled integer UMI counts (the counts layer in Seurat v5 Assay5, or adata.layers['counts'] in AnnData). Negative-binomial generalized linear models such as DESeq2 and PyDESeq2 model library size offsets and count-mean dispersion directly from integer counts. - **Q: Does a non-significant donor pseudobulk p-value prove a gene is unchanged?** A: No. Statistical non-significance (for example p > 0.05) indicates that observed differences are compatible with donor-to-donor variability at the available sample size; in small cohorts (such as n = 3 vs. 3), power to detect modest fold changes is limited, so inspect shrunken log2 fold-change intervals alongside adjusted p-values. --- ### Spatial Transcriptomics Assays: Imaging (Xenium, CosMx) vs. Sequencing (Visium HD) - **Canonical URL:** https://codinggenes.com/blog/spatial-transcriptomics-platforms-xenium-cosmx-visium-hd/ - **Category:** Spatial & Single-Cell - **Learning Track:** benchmarks - **Published:** 2026-11-08 - **In brief:** Subcellular spatial transcriptomics platforms trade transcriptome breadth against transcript localization accuracy. High-density barcoded sequencing (Visium HD) profiles protein-coding genes transcriptome-wide across 2 µm × 2 µm capture squares, supporting unbiased discovery. Targeted in situ imaging assays (Xenium, CosMx) localize individual transcripts optically within cells, making panel design and membrane segmentation accuracy the central analytical priorities. - **Key takeaways:** - Imaging-based assays (Xenium, CosMx) record optical sub-micrometer coordinates for pre-selected probe panels, whereas Visium HD sequences cDNA captured on continuous 2 µm barcoded grids. - In densely packed tissues, nuclear-expansion polygons frequently misassign transcripts across adjacent cell membranes, creating artifactual 'double-positive' or hybrid cell clusters. - Spatial co-localization tests require null permutations restricted to comparable histological compartments rather than across the entire tissue section. Before running spatial clustering, niche discovery, or ligand–receptor scoring, every computational analysis has to account for one physical step: **how RNA molecules inside a tissue section were converted into spatially indexed counts** [1–3]. ## Optical in situ imaging versus high-density spatial barcoding Modern subcellular and near-cellular platforms fall into two physical measurement classes [1–3]: | Assay Property | Targeted In Situ Imaging (`Xenium`, `CosMx`) | High-Density Spatial Barcoding (`Visium HD`) | | :--- | :--- | :--- | | **Physical Capture Mechanism** | Padlock / cyclic in situ hybridization (`ISH`) with optical decoding of individual fluorescent puncta [1, 2] | Probe hybridization on tissue followed by transfer onto a continuous lawn of `2 µm × 2 µm` spatially barcoded squares and sequencing [3] | | **Feature Breadth** | Targeted gene panels (`~300` to multi-thousand pre-selected genes) [1, 2] | Whole human or mouse protein-coding probe set (`~18,000` genes) [3] | | **Primary Experimental Strength** | High molecular detection sensitivity for predefined cell states and pathways; direct intracellular transcript coordinates [1] | Unbiased transcriptome-wide discovery when relevant pathways or markers are not known prior to the experiment [3] | | **Dominant Source of Assignment Error** | Misassigning border transcripts across touching cells when membranes are unstained or poorly segmented | Lateral transcript diffusion and grouping sparse `2 µm` squares (commonly binned to `8 µm` or segmented nuclei) into single cells [3] | | **Open-Source Ecosystem** | `SpatialData` [4] · `Squidpy` [5] · `Seurat v5` · `SpatialExperiment` | `Space Ranger` · `SpatialData` [4] · `Squidpy` [5] · `SpatialExperiment` | ## Three verification checks before trusting LLM-generated spatial pipelines When you ask an LLM assistant to generate a `Squidpy` or `Seurat` spatial workflow, standard code templates treat the segmented cell-by-gene table just like dissociated `scRNA-seq` plus an `(x, y)` centroid column. Run three physical checks before interpreting biological claims: 1. **Treat cell polygons as uncertain estimates, not ground truth.** Whenever an unexpected lineage marker appears in an infiltrating immune or stromal cluster (for example, epithelial *EPCAM* counts inside `CD3E+` T cells), visualize the raw transcript coordinates overlaid on nuclear and membrane channels in `SpatialData` [4]. Transcripts concentrated strictly along the outer polygon rim indicate segmentation spillover from an adjacent cell rather than a novel dual-lineage state. 2. **Condition spatial permutation nulls on tissue anatomy.** Running `sq.gr.nhood_enrichment()` with unconstrained whole-slide label permutations [5] tests whether two cell types deviate from uniform placement across the entire section. If two populations both reside in mucosal crypts or perivascular stroma, whole-slide permutation yields small *p*-values driven by shared macro-anatomy rather than local cell–cell interaction. Permute cell labels *within* matched histological compartments, and replicate across independent tissue donors. 3. **Account for panel censorship in targeted imaging.** Pathway enrichment or ligand–receptor inference on a 400-gene panel reflects both tissue biology and which genes were included during panel design; report the background universe explicitly as the assayed gene panel rather than the full genome. #### Verified Primary References - Janesick A, Shelansky R, Gottscho AD, Wagner F, Williams SR, Rouault M, et al. (2023). High resolution mapping of the tumor microenvironment using integrated single-cell, spatial and in situ analysis. *Nature Communications 14, 8353*. https://doi.org/10.1038/s41467-023-43458-x - He S, Bhatt R, Brown C, Brown EA, Buhr DL, Chantranuvatana K, et al. (2022). High-plex imaging of RNA and proteins at subcellular resolution in fixed tissue by spatial molecular imaging. *Nature Biotechnology 40, 1794–1806*. https://doi.org/10.1038/s41587-022-01483-z - Oliveira MF, Romero JP, Chung M, Williams SR, Gottscho AD, Gupta A, et al. (2025). High-definition spatial transcriptomic profiling of immune cell populations in colorectal cancer. *Nature Genetics 57, 1512–1523*. https://doi.org/10.1038/s41588-025-02193-3 - Marconato L, Palla G, Yamauchi KA, Virshup I, Heumos E, Zernia M, et al. (2024). SpatialData: an open and universal data framework for spatial omics. *Nature Methods 21, 589–592*. https://doi.org/10.1038/s41592-024-02212-x - Palla G, Spitzer H, Klein M, Fischer D, Schaar AC, Kuemmerle LB, et al. (2022). Squidpy: a scalable framework for spatial omics analysis. *Nature Methods 19, 171–178*. https://doi.org/10.1038/s41592-021-01358-2 #### Common Questions - **Q: What tissue quality checks matter most before running FFPE spatial transcriptomics?** A: Evaluate RNA fragment integrity—commonly the percentage of RNA fragments longer than 200 nucleotides (DV200)—and inspect H&E or immunofluorescence morphology on a pilot section. Formalin fixation cross-linking and tissue detachment directly constrain probe hybridization efficiency and membrane segmentation. - **Q: Why do infiltrating T cells or macrophages sometimes appear to express epithelial tumor markers in spatial datasets?** A: When cells touch in dense tumor nests, isotropic nuclear-expansion boundaries extend into neighboring epithelial cytoplasm and capture adjacent EPCAM or keratin transcripts. Overlaying raw molecule coordinates onto a membrane stain distinguishes boundary spillover from genuine co-expression. --- ### Field Notes: ESM-2 Model Scaling, SpatialData Zarr Stores and On-Disk Matrices - **Canonical URL:** https://codinggenes.com/blog/scverse-bioconductor-release-roundup/ - **Category:** Field Notes - **Learning Track:** benchmarks - **Published:** 2026-11-05 - **In brief:** Three practical shifts for everyday bioinformatics workflows: (1) across 217 ProteinGym substitution assays, ESM-2 650M matches 3B and 15B overall while running on a single 16 GB GPU, and classical alignment model GEMME still leads overall; (2) SpatialData unifies pathology images, polygons, and transcripts in one Zarr store; and (3) BPCells and backed AnnData keep million-cell integer matrices on disk. - **Key takeaways:** - On 217 ProteinGym substitution assays (186 proteins), ESM-2 650M reaches mean Spearman 0.415 in 26 GPU-minutes (2.3 GB peak VRAM); scaling to 3B (0.407) or 15B (0.400) is not distinguishable overall and drops on high-depth protein families. - Classical evolutionary coupling / epistatic alignment modeling (GEMME, mean Spearman 0.455) outperforms every zero-shot ESM-2 checkpoint on average across ProteinGym v1.3. - SpatialData Zarr stores and on-disk matrices (BPCells in Seurat v5, backed AnnData) eliminate coordinate drift and high-RAM bottlenecks on standard workstations. Three empirical and infrastructure developments worth building into your `R` and `Python` workflows right now: ## 1. Protein language model scaling: `ESM-2 650M` sits at the zero-shot plateau The `ESM-2` protein language model family spans checkpoints from `8` million (`8M`) to `15` billion (`15B`) parameters, trained with masked-language modeling over UniRef sequences [1]. While atomic-resolution structure prediction fidelity improved up to `15B` in the original `ESM-2` study [1], zero-shot mutational effect prediction across deep mutational scanning (`DMS`) benchmarks follows a different curve. Evaluating masked-marginal log-odds across **217 substitution assays (`186` unique proteins, `2,465,767` variants) in `ProteinGym` v1.3** [2] shows a clear plateau: | Model / Checkpoint | Protein-Averaged Spearman *ρ* (95% Bootstrap CI) | Paired Difference vs. `ESM-2 650M` | Compute Footprint (`217` Assays, RTX 4060 Ti `16 GB`) | | :--- | :--- | :--- | :--- | | **`ESM-2 8M`** | `0.223` `[0.186, 0.262]` | — | `< 5 min` | | **`ESM-2 150M`** | `0.388` `[0.348, 0.425]` | `−0.034` (below `650M`) | `~10 min` | | **`ESM-2 650M`** | **`0.415`** `[0.376, 0.452]` | Reference plateau | **`26 min` · `2.3 GB` peak VRAM** | | **`ESM-2 3B`** | `0.407` `[0.370, 0.443]` | `−0.0027` `[−0.0135, +0.0088]` (not distinguishable) | `82 min` · `6.6 GB` peak VRAM | | **`ESM-2 15B`** *(published)* | `0.400` `[0.368, 0.433]` | `−0.0087` `[−0.0241, +0.0073]` (not distinguishable) | Multi-GPU / high-VRAM server | | **`GEMME`** *(alignment epistatic)* | **`0.455`** `[0.426, 0.484]` | `+0.0444` `[+0.0206, +0.0695]` (ahead overall) | CPU alignment + fast epistatic fit [3] | Stratifying the `186` proteins by multiple sequence alignment (`MSA`) effective depth (*N*eff / *L*) clarifies where larger checkpoints lose ground [2]: on the `63` high-depth protein families (*N*eff / *L* > 100), `ESM-2 3B` scores lower than `650M` by a paired mean difference of `−0.0283` `[−0.0423, −0.0149]`, while on the deepest slice `GEMME` and `ESM-2 650M` are not distinguishable (`−0.0200` `[−0.0448, +0.0065]`). Practically: start with `ESM-2 650M`, run `GEMME` whenever a reliable alignment exists [3], and spend saved compute on experimental validation. ## 2. One versioned Zarr container for spatial omics: `SpatialData` Across `Xenium`, `CosMx`, and `Visium HD` studies, storing multi-scale pathology images as TIFFs, cell boundaries as GeoJSON, and counts as separate `.h5ad` files frequently introduces micron-scale coordinate-system drift during cropping or registration. `SpatialData` stores raster images, vector segmentation shapes, transcript point clouds, and `AnnData` expression tables together inside a single OME-NGFF Zarr store with explicit coordinate transformations [4]. ## 3. On-disk count matrices and audited single-cell embeddings Bit-packed on-disk matrices in `BPCells` (`Seurat v5` in R) [5] and chunked Zarr / HDF5 backing in `AnnData` (`Python`) allow million-cell reference atlases to be filtered, projected, and aggregated into donor pseudobulk tables on a laptop or standard workstation without loading dense matrices into RAM. Similarly, while pretrained single-cell models such as `scGPT` [6] now integrate into `AnnData` pipelines for reference mapping, independent zero-shot evaluations emphasize benchmarking pretrained embeddings against `PCA` / `scVI` on your own cohort rather than assuming zero-shot superiority [7]. #### Verified Primary References - Lin Z, Akin H, Rao R, Hie B, Zhu Z, Lu W, et al. (2023). Evolutionary-scale prediction of atomic-level protein structure with a language model. *Science 379(6637), 1123–1130*. https://doi.org/10.1126/science.ade2574 - Notin P, Kollasch AW, Ritter D, van Niekerk L, Paul S, Spinner H, et al. (2023). ProteinGym: Large-Scale Benchmarks for Protein Fitness Prediction and Design. *Advances in Neural Information Processing Systems 36, 64331–64379*. https://doi.org/10.52202/075280-2810 - Laine E, Karami Y, Carbone A (2019). GEMME: A Simple and Fast Global Epistatic Model Predicting Mutational Effects. *Molecular Biology and Evolution 36(11), 2604–2619*. https://doi.org/10.1093/molbev/msz179 - Marconato L, Palla G, Yamauchi KA, Virshup I, Heumos E, Zernia M, et al. (2024). SpatialData: an open and universal data framework for spatial omics. *Nature Methods 21, 589–592*. https://doi.org/10.1038/s41592-024-02212-x - Hao Y, Stuart T, Kowalski MH, Choudhary S, Hoffman P, Hartman A, et al. (2024). Dictionary learning for integrative, multimodal and scalable single-cell analysis. *Nature Biotechnology 42, 293–304*. https://doi.org/10.1038/s41587-023-01767-y - Cui H, Wang C, Maan H, Pang K, Luo F, Duan N, Wang B (2024). scGPT: toward building a foundation model for single-cell multi-omics using generative AI. *Nature Methods 21, 1470–1480*. https://doi.org/10.1038/s41592-024-02201-0 - Kedzierska KZ, Crawford L, Amini AP, Lu AX (2025). Zero-shot evaluation reveals limitations of single-cell foundation models. *Genome Biology 26, 101*. https://doi.org/10.1186/s13059-025-03574-x #### Common Questions - **Q: Which ESM-2 checkpoint should I start with for zero-shot missense variant scoring?** A: Start with ESM-2 650M (esm2_t33_650M_UR50D). Across 217 ProteinGym substitution assays (186 proteins), 650M reaches a protein-averaged Spearman correlation of 0.415 in 26 GPU-minutes with 2.3 GB peak memory on one 16 GB GPU, whereas 3B (0.407) and 15B (0.400) are not statistically distinguishable overall. - **Q: Should I still run a multiple-sequence alignment baseline alongside a protein language model?** A: Yes. Whenever homologs are available to build a multiple sequence alignment, compare language-model masked marginals against an evolutionary epistatic model such as GEMME, which averages 0.455 across the same ProteinGym benchmark with no deep-learning GPU requirement. ---