Reproducible scripts for analyzing public human myocardial infarction single-nucleus data. The workflow keeps only the core analysis: extraction of Cardiomyocyte raw RNA counts, count-based pseudobulk differential expression, and pathway scoring with curated mitochondrial and inflammatory gene sets.
The formal differential-expression analysis uses raw Cardiomyocyte RNA counts from the public Seurat RDS. Counts are aggregated by sample and priority region, normalized with edgeR TMM, and modeled with limma-voom. The primary contrast is IZ_vs_Control.
Mixed anatomical regions are assigned by priority:
Control > FZ > IZ > BZ > RZ
Thus IZ_vs_Control should be interpreted as IZ-associated Cardiomyocyte change, not a pure infarct-zone-only comparison.
Pathway scoring is performed on Control and IZ-associated cells from the processed H5AD using UCell-like and AUCell-like rank-based scores.
Primary contrast sample inclusion:
| Group | Sample | Patient | Source region label | Cardiomyocyte RNA nuclei |
|---|---|---|---|---|
| Control | CK158 | P1 | control_P1 | 2,637 |
| Control | CK357 | P7 | control_P7 | 4,460 |
| Control | CK358 | P8 | control_P8 | 2,715 |
| Control | CK374 | P17 | control_P17 | 3,173 |
| IZ-associated | CK165 | P2 | IZ/BZ_P2 | 601 |
| IZ-associated | CK361 | P10 | IZ_P10 | 705 |
| IZ-associated | CK363 | P9 | GT/IZ_P9 | 810 |
| IZ-associated | CK371 | P15 | GT/IZ_P15 | 305 |
| IZ-associated | CK372 | P9 | GT/IZ_P9_rep2 | 159 |
Public data files are downloaded by the workflow and are not committed to GitHub:
results/raw/snRNA-seq-submission.h5ad
results/raw/Cardiomyocyte_snRNA_snATAC.Rds
The gene-set preparation step expects these source files under gene_sets_official/raw/:
h.all.v2025.1.Hs.symbols.gmt
c2.cp.reactome.v2025.1.Hs.symbols.gmt
c2.cp.kegg_legacy.v2025.1.Hs.symbols.gmt
c5.go.bp.v2025.1.Hs.symbols.gmt
human.mitocarta3.0.html
Human.MitoPathways3.0.gmx
MSigDB GMT files must be obtained by users under the MSigDB terms of use. MitoCarta and MitoPathways files are available from the Broad Institute MitoCarta resource.
The environment is managed with pixi:
pixi installpixi.lock is included for reproducibility on Linux. R scripts run in the r environment; Python scripts run in the analysis environment.
Run all commands from the repository root:
pixi run download-data
pixi run -e r extract-counts
pixi run -e r pseudobulk
pixi run -e analysis prepare-gene-sets
pixi run -e analysis score-pathwaysCardiomyocyte RNA counts:
results/processed/Cardiomyocyte_RNA_counts_only.seurat.rds
results/processed/Cardiomyocyte_RNA_counts_only.metadata.tsv.gz
results/processed/Cardiomyocyte_RNA_counts_only.summary.tsv
Pseudobulk differential expression:
results/pseudobulk_cardiomyocyte/tables/pseudobulk_sample_metadata.tsv
results/pseudobulk_cardiomyocyte/tables/cardiomyocyte_pseudobulk_counts_matrix.rds
results/pseudobulk_cardiomyocyte/tables/edgeR_voom_Cardiomyocyte_IZ_vs_Control.tsv
results/pseudobulk_cardiomyocyte/tables/deg_counts_by_group.tsv
results/pseudobulk_cardiomyocyte/figures/volcano_Cardiomyocyte_IZ_vs_Control.png
results/pseudobulk_cardiomyocyte/figures/heatmap_sig_degs_Cardiomyocyte_IZ_vs_Control.png
Curated gene sets:
gene_sets_official/mitochondria/*.txt
gene_sets_official/inflammation/*.txt
gene_sets_official/metadata/manifest.tsv
Pathway scores:
results/pathway_scores_control_iz/tables/pathway_scores_per_cell_control_iz.tsv.gz
results/pathway_scores_control_iz/tables/pathway_scores_by_sample_celltype_control_iz.tsv
results/pathway_scores_control_iz/tables/pathway_ucell_cardiomyocyte_matrix.tsv
results/pathway_scores_control_iz/tables/pathway_aucell_cardiomyocyte_matrix.tsv
results/pathway_scores_control_iz/figures/heatmap_pathway_ucell_cardiomyocyte.png
results/pathway_scores_control_iz/figures/heatmap_pathway_aucell_cardiomyocyte.png
results/pathway_scores_control_iz/figures/violin_top_cardiomyocyte_ucell_control_iz.png
results/pathway_scores_control_iz/figures/violin_top_cardiomyocyte_aucell_control_iz.png
The pseudobulk DEG analysis is the primary statistical layer because it uses raw counts and sample-level replication. Pathway scores provide supporting cell-level evidence for coordinated biological programs.
A cautious summary is:
IZ-associated Cardiomyocytes show reduced mitochondrial oxidative phosphorylation programs and increased inflammatory or cytokine-related programs compared with Control Cardiomyocytes.
00_download_public_data.sh
01_extract_cardiomyocyte_counts.R
02_pseudobulk_edgeR_voom.R
03_prepare_official_gene_sets.py
04_score_pathways_ucell_aucell.py
pixi.toml
pixi.lock
CITATION.md
LICENSE
README.md
Public data, generated results, and restricted gene-set source files are excluded by .gitignore.