Code and analysis related to Singhal, Ryan, Rose, Styers et al manuscript about ablation of the basal state in PDAC.
This repo is organized into directories reflecting Rmd or Jupyter notebooks (notebooks), processing scripts (scripts), or functions/modules (src).
Below is a description of the directory contents.
DE
Code related to differential expression in Fig S4A.
niche_emb
Code related to filtering and construction of niche trajectories from niche embedding outputs of Wormhole. Notebooks relate to either the untreated setting (notebooks/niche_emb/BA_mingle_untreated_niche_trajectory.ipynb, Fig. 4B) or after ablation setting (notebooks/niche_emb/BA_mingle_full_epi_trajectory_responsePruned.ipynb, notebooks/niche_emb/BA_mingle_classical_niche_trajectory.ipynb, Fig. 6A-C).
rl
Code related to ligand and receptor, effector cell frequency or composition, and gene to DC correlation analysis along untreated or classical response axis referenced in Fig. 4C-F, Fig. 5A, S3, S5, S7, S8.
state_composition
Code related to cancer cell-state composition in the Flex scRNA-seq cohorts. Each cancer cell is scored against the Basal / Classical / Mesenchymal PDAC signatures; scores are normalized onto a common scale and passed through a softmax to give a probabilistic state composition (summing to 1 per cell), visualized on a ternary simplex. Three parallel notebooks apply the identical baseline to the three cohorts:
notebooks/state_composition/gemm_basal_tracing_state_composition.ipynb— GEMM (KPF) basal lineage-tracing cohort, EGFP-labeled for 3 vs 14 days, faceted byterm(Fig. 2E).notebooks/state_composition/gemm_classical_tracing_state_composition.ipynb— GEMM (KPF) classical lineage-tracing cohort, faceted byterm(Fig. 2H).notebooks/state_composition/transplant_treatment_state_composition.ipynb— orthotopic transplant of basal-traced KPF cells treated with vehicle (VEH), FOLFIRI (FOLF), MRTX1133 (MRTX), or the combination (FOLFMRTX), faceted bytreatment(Fig. 7D).
Cell annotation
Code used for general cell clustering and annotation of cell lineage (i.e. Myeloid) in Xenium data (cluster_lineage.py) or cancer state classifier using CellTypist (train_cancer_state_classifier.py).
niche_emb
Code used to generate Wormhole embeddings in the untreated (train_model_BA_untreated_20260514_a0.4_m25.py) or ablation response (train_model_BA_responsePruned_20260511_a0.4_m25.py)settings.
preprocessing
Scripts to:
- aggregate information from spatial neighborhoods (
define_nhoods_gpu.py) - annotate lymph node and parenchyma (
in_silico_dissection.py) - compute modPCs (
NMF_Pleio_BA_untreated.py,NMF_Pleio_BA_responsePruned.py,pleiotropy.py,run_hotspot_modPCA.py,symNMF.py) - segger preprocessing commands (
sbatch_segger.sh)
Two packages: xenium_utils (Xenium analyses) and flex_utils (Flex scRNA-seq state composition), each organized into scanpy-style pp (preprocessing) and pl (plotting) submodules.
pl
Helper functions for plotting ligand-receptor heatmaps.
pp
Functions related to niche filtering for trajectory construcion (niche_purity.py), cell clustering (preprocess_rapids.py), or scoring gene set expression (signature_score.py).
pp
Numeric baseline for cancer cell-state composition (lineage_composition.py): signature scoring (compute_signature_scores), cross-cell normalization (normalize_scores), and softmax compositional probabilities (softmax_composition).
pl
Ternary-simplex plotting helpers (plot_ternary.py): filled KDE contours (plot_ternary) and per-cell density-colored scatter (plot_ternary_scatter_density).