# Andrology Public Data Analysis Specification (Draft 0.1)

Date established: 2026-10-26. Scope: public single-cell, single-nucleus, spatial, and bulk RNA data related to ED/corpus cavernosum and male infertility.

**The current deliverable is a data catalog and pre-analysis specification, not completed biological analysis.** `pipeline/validate_design.py` only checks comparison design metadata; it does not read expression matrices, fit models, output differential genes, or compute P values. Passing pre-checks does not equal completing statistical validation. All disease grouping, cell annotation, and study conclusions still have independent expert review status.

## Data Sources and Analysis Units

- Record paper DOI/PMID, repository accession, source URL, retrieval time, source file checksum, data license, and access level. Public metadata, downloadable matrices, and redistributable matrices should be recorded separately.
- Establish four-level relationships: `study_id → donor_id → biological_sample_id → sample_id/library_id → cell_id`. `cell_id` is unique within a study and retains the original barcode; cross-sample matching must not rely on barcode alone. Spatial data additionally stores `section_id, spot_id, coordinates, image_id`.
- `donor_id` is a traceable donor or animal individual identifier and is not equivalent to a GSM, library, tissue section, or cell cluster. To avoid mistakenly merging "P1" across different papers, use verified canonical donor identifiers; record evidence separately for correspondences of the same donor across papers.
- Multiple database accession numbers from the same study, reused controls, and repeated publications cannot serve as new independent cohorts. Literature count, repository project count, sample count, donor count, cell count, and spatial spot count are tallied separately. When the number of independent donors cannot be established, retain `null`; do not fill it in with the sample count.
- Repeated sequencing of the same biological material may be merged into raw counts after verification; repeated sampling, different time points, and different anatomical regions from the same donor are not automatically summed as technical replicates. When pairing, repeated measures, or multilevel models are needed, enter a dedicated workflow.
- When multiple animals are pooled to produce one library, the pool is an identifiable experimental unit; the number of animals contributing to the pool cannot be treated as independent expression replicates. The first-version independent donor checker does not automatically clear this.

## Clinical and Experimental Metadata

Retain original fields and standardized fields, noting standardization rules, evidence, and reviewer. At minimum curate species, sex/sex chromosome status (when public), tissue and sampling region, age and unit, disease diagnosis/etiology, group, treatment and sampling time, sequencing type and platform, library batch, and donor relationships. Diabetes, BMI, medication, hormone levels, semen parameters, pathological type, etc. are filled in only when explicitly reported in the original text or public records; missing values are not inferred.

Labels for ED such as diabetic, aging-related, and nerve-injury-related require original diagnostic evidence. Young normal versus elderly ED comparisons change both age and disease and cannot be interpreted as a pure age effect or a pure ED effect. Testicular disease controls may come from obstructive azoospermia, tumor-adjacent tissue, or organ donors; preserve their specific source and do not uniformly rename them "healthy". Materials such as KS, AZF deletion, and transgender hormone therapy should retain their original clinical context; do not assume identical biological mechanisms from labels.

## Single-Cell/Single-Nucleus Processing and Annotation

1. First distinguish UMI from non-UMI, scRNA from snRNA, and raw counts from normalized values. Preserve an immutable raw count layer, record the reference genome and annotation version; use Ensembl IDs as stable primary keys and gene symbols as updatable display fields to avoid loss from one-to-many mapping.
2. Inspect detected gene count, UMI/reads, mitochondrial proportion, cell complexity, and population distribution per sample before setting QC. Testicular germ cells, mature sperm, somatic cells, and cavernosal cells have different RNA characteristics; do not apply the same hard thresholds to all data. Record cell counts before and after filtering and the reason for each step.
3. Doublet detection combines platform loading, each library, and cell population structure; ambient RNA correction is decided based on whether empty droplets/unfiltered matrices and contamination evidence exist, and processed data are not mechanically re-corrected. Model scores are supporting evidence; review possible real transitional cells.
4. Clustering, UMAP, and marker exploration use version-pinned Seurat or Scanpy workflows. Retain both author original annotation and platform standard annotation columns, with markers, confidence, and modification records. Cell state and cell type are kept separate; spermatogenesis stage annotation must be reviewed by andrology experts.
5. Batch integration for visualization/reference mapping should evaluate both batch mixing and preservation of biological differences. When disease and batch are completely confounded, algorithms cannot recover the missing experimental design, nor should confounders be arbitrarily deleted to obtain significant results.
6. Integrated expression values, scaled values, and regression residuals cannot directly replace raw counts as input to edgeR/DESeq2. Disease comparisons retain single-study analyses first, then consider cross-study aggregation.

## Differential Expression and Cross-Cohort Evidence

- The preferred analysis unit for single-cell disease DE is raw count aggregation (pseudobulk) by **independent donor × reviewed cell type**. Re-examine donor coverage, minimum cell number, library size, and group comparability for each cell type; do not apply the overall study donor count to every cell population.
- Project default: each of the two groups must have at least 3 identifiable independent donors to enter inferential model checks; otherwise only descriptive exploration is allowed. **This is the project's conservative admission rule, not a statistical law that "3 cases are enough."** Whether precision is sufficient depends on effect size, variance, model parameters, and experimental design; increase samples or lower conclusion strength when necessary.
- The initial formal model preferentially uses edgeR quasi-likelihood; DESeq2 may serve as a prespecified alternative or sensitivity analysis. Bulk RNA is handled under the same sample/donor design principles. Tool choice, filtering rules, comparisons, and covariates are fixed before viewing significant results.
- Filtering uses methods compatible with the experimental design, such as edgeR `filterByExpr`; normalization uses library-size correction consistent with the model. Record reference/test; a positive log2FC explicitly means increased in test relative to reference.
- Before model fitting, check one-to-one correspondence between expression matrix and metadata, valid counts, model matrix rank, estimable contrasts, residual degrees of freedom, confounding of continuous and categorical variables, outlier samples, sample distances, and group balance. Missing covariates must not be silently deleted or default-filled with zero.
- Report complete effect sizes, raw P values, BH-adjusted values, tested gene set, number of independent donors per group, and confidence intervals (when supported by the method). Retain genes that failed filtering or could not be estimated, with reasons. Clearly distinguish descriptive plots from inferential results.
- If the goal is to test whether effects exceed a prespecified fold-change threshold, use the corresponding threshold hypothesis test (e.g., edgeR `glmTreat` or DESeq2 `lfcThreshold`); do not present post hoc simultaneous filtering by FDR and fold change as equivalent threshold-hypothesis FDR control.
- For cross-cohort analysis, first compute effects and uncertainty per study and per cell type, and test direction and heterogeneity. Confirm study/donor independence before meta-analysis; the same control cannot count as independent replicate evidence. Display groups that cannot be harmonized side by side; do not force-merge P values.
- Cell proportion changes are compositional data problems and should use a separate model consistent with donor structure; one cannot infer that a cell proportion changed from "a cell type has many differential genes."

## Enrichment, Spatial, and Advanced Modules

- ORA uses as background the genes that actually entered testing in this comparison and can map to annotations, with an explicit enrichment library version; do not default to the whole genome as background.
- GSEA uses all tested genes that can define a ranking statistic, not only significant genes; state the ranking metric, handling of duplicate IDs, gene set size, and multiple-testing scope. Gene set scores are not equivalent to causal mechanisms.
- Spatial data retain original images, scale bars, coordinate systems, resolution, tissue regions, and section-donor correspondence. A spot is usually not a single cell; multiple sections are not multiple donors. Deconvolution proportions, spatial colocalization, and inferred communication are each labeled as model results.
- Normal tissue spatial references can support location queries only and cannot replace disease spatial case-control. Spatial statistics account for autocorrelation; disease inference at the donor level still requires independent biological replicates.
- Communication analysis describes candidate ligand-receptor relationships, and pseudotime describes continuous states inferred by a model; neither directly constitutes evidence of functional mechanism, real time, or cell lineage.
- For cross-species analysis, analyze independently first, then compare comparable cell types using version-noted one-to-one ortholog relationships; preserve one-to-many and missing relationships, and do not mix matrices by identical symbol names. Age, tissue region, and scRNA/snRNA technical differences must be displayed.

## Versioning, Reproducibility, and Release

Each analysis result is linked to input checksums, metadata and annotation versions, exact tool versions, locked environment/container digests, parameters, random seeds, complete logs, execution date, and review records. Distinguish "registered," "matrix downloaded," "QC completed," "pending expert review," and "approved result." The website does not display randomly generated expression or significance results as measured data.

The first-version checker performs metadata pre-screening. Production analysis also requires matrix validation, full design rank checks, statistical fitting and diagnostics, independent sample reproduction, and expert review. The following standards are the basis for subsequent implementation and acceptance and do not mean these modules are now online.

Primary references:

- Squair et al. *Nature Communications* (2021), [Confronting false discoveries in single-cell differential expression](https://doi.org/10.1038/s41467-021-25960-2).
- Luecken et al. *Nature Methods* (2022), [Benchmarking atlas-level data integration in single-cell genomics](https://doi.org/10.1038/s41592-021-01336-8).
- [edgeR official documentation and user guide](https://bioconductor.org/packages/release/bioc/html/edgeR.html), [DESeq2 official documentation](https://bioconductor.org/packages/release/bioc/html/DESeq2.html), [Scanpy official documentation](https://scanpy.readthedocs.io/en/stable/), [Seurat official documentation](https://satijalab.org/seurat/). When deployed, the locked-version documentation prevails.

