7  Differential analyses

module_differential_analyses/targets.R filters aggregations that enabled the module, joins their module config, attaches symbols for accepted WNN metadata and pseudobulk inputs, and maps the composition, pseudobulk, GSEA, and cross-modality target fragments. The generic pseudobulk model family is instantiated for DGE, DCA, DTFA, and expression-derived CollecTRI activity (DCTA). DCTA first converts filtered, normalized GEX pseudobulks to signed ULM scores and then reuses the same model and contrast machinery.

DTFA uses the 233 official JASPAR2026 CORE vertebrate familial root motifs as its complete feature universe. The pipeline scans those family-level profiles directly, rather than scanning individual motifs and taking the union of their peak matches.

The cross-modality fragment creates a CollecTRI-to-JASPAR family crosswalk, a detailed regulator-level table containing DCTA, DTFA, and TF-expression results, a family-level comparison table, a contrast-level concordance summary, and its plot. CollecTRI complexes remain intact in DCTA; complex-member mappings are introduced only by the comparison crosswalk.

The graph below is an orientation view. Inspect setup_and_DCTC_targets.R, psbulk_DX_targets.R, GSEA_targets.R, and cross_modality_targets.R for the complete model and plotting commands. The user-facing prerequisites and module selector are documented in Differential analyses.

%%{init: {
  'theme': 'base',
  'themeVariables': {
    'primaryTextColor': '#1f2937',
    'lineColor': '#4b5563',
    'clusterBkg': '#f8fafc',
    'clusterBorder': '#cbd5e1',
    'edgeLabelBackground': '#ffffff00',
    'fontFamily': 'Helvetica, Arial, sans-serif'
  },
  'flowchart': {
    'defaultRenderer': 'elk'
  },
  'themeCSS': '.cluster rect { fill: #f8fafc !important; stroke: #cbd5e1 !important; } .cluster-label text, .cluster-label span { font-weight: 700 !important; font-size: 16px !important; fill: #475569 !important; color: #475569 !important; }'
}}%%
%%{init: {'flowchart': {'defaultRenderer': 'elk'}}}%%
flowchart TB
  peak_TF_motif_family_matrix.ATAC.immune_human_2x(["peak_TF_motif_family_matrix.ATAC.<aggregation_name>"]):::none --> chromVAR_TF_motif_family_matrix.ATAC.immune_human_2x(["chromVAR_TF_motif_family_matrix.ATAC.<aggregation_name>"]):::none
  CollecTRI_human_network_csv(["CollecTRI_human_network_csv"]):::none --> CollecTRI_human_network_tibble(["CollecTRI_human_network_tibble"]):::none
  JASPAR_motif_family_members_tibble(["JASPAR_motif_family_members_tibble"]):::none --> CollecTRI_JASPAR_family_map.differential_analyses.immune_human_2x(["CollecTRI_JASPAR_family_map.<module_name>.<aggregation_name>"]):::none
  CollecTRI_human_network_tibble(["CollecTRI_human_network_tibble"]):::none --> CollecTRI_JASPAR_family_map.differential_analyses.immune_human_2x(["CollecTRI_JASPAR_family_map.<module_name>.<aggregation_name>"]):::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> donor_id_metadata_tibble.analysis.differential_analyses.immune_human_2x(["donor_id_metadata_tibble.analysis.<module_name>.<aggregation_name>"]):::none
  donor_id_metadata_tibble.extended.differential_analyses.immune_human_2x(["donor_id_metadata_tibble.extended.<module_name>.<aggregation_name>"]):::none --> donor_id_metadata_tibble.analysis.differential_analyses.immune_human_2x(["donor_id_metadata_tibble.analysis.<module_name>.<aggregation_name>"]):::none
  donor_id_metadata_tibble.analysis.differential_analyses.immune_human_2x(["donor_id_metadata_tibble.analysis.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DCA.differential_analyses.immune_human_2x["feature_matrix_fit.DCA.<module_name>.<aggregation_name>"]:::none
  donor_id_metadata_tibble.analysis.differential_analyses.immune_human_2x(["donor_id_metadata_tibble.analysis.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DCTA.differential_analyses.immune_human_2x["feature_matrix_fit.DCTA.<module_name>.<aggregation_name>"]:::none
  donor_id_metadata_tibble.analysis.differential_analyses.immune_human_2x(["donor_id_metadata_tibble.analysis.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DGE.differential_analyses.immune_human_2x["feature_matrix_fit.DGE.<module_name>.<aggregation_name>"]:::none
  donor_id_metadata_tibble.analysis.differential_analyses.immune_human_2x(["donor_id_metadata_tibble.analysis.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DTFA.differential_analyses.immune_human_2x["feature_matrix_fit.DTFA.<module_name>.<aggregation_name>"]:::none
  JASPAR2026_vertebrate_familial_root_motifs_tf(["JASPAR2026_vertebrate_familial_root_motifs_tf"]):::none --> JASPAR_familial_root_motif_matrix_list(["JASPAR_familial_root_motif_matrix_list"]):::none
  JASPAR_familial_root_motif_matrix_list(["JASPAR_familial_root_motif_matrix_list"]):::none --> JASPAR_motif_family_members_tibble(["JASPAR_motif_family_members_tibble"]):::none
  JASPAR2026_vertebrate_motif_families_tsv(["JASPAR2026_vertebrate_motif_families_tsv"]):::none --> JASPAR_motif_family_members_tibble(["JASPAR_motif_family_members_tibble"]):::none
  donor_id_metadata_tibble.analysis.differential_analyses.immune_human_2x(["donor_id_metadata_tibble.analysis.<module_name>.<aggregation_name>"]):::none --> model_results.DCTC.differential_analyses.immune_human_2x(["model_results.DCTC.<module_name>.<aggregation_name>"]):::none
  JASPAR_familial_root_motif_matrix_list(["JASPAR_familial_root_motif_matrix_list"]):::none --> peak_TF_motif_family_matrix.ATAC.immune_human_2x(["peak_TF_motif_family_matrix.ATAC.<aggregation_name>"]):::none
  CollecTRI_human_network_tibble(["CollecTRI_human_network_tibble"]):::none --> pseudobulk_CollecTRI_TF_activity_matrix.GEX.differential_analyses.immune_human_2x(["pseudobulk_CollecTRI_TF_activity_matrix.GEX.<module_name>.<aggregation_name>"]):::none
  chromVAR_TF_motif_family_matrix.ATAC.immune_human_2x(["chromVAR_TF_motif_family_matrix.ATAC.<aggregation_name>"]):::none --> pseudobulk_motif_family_accessibility_matrix.ATAC.immune_human_2x(["pseudobulk_motif_family_accessibility_matrix.ATAC.<aggregation_name>"]):::none
  feature_matrix_fit.DCA.differential_analyses.immune_human_2x["feature_matrix_fit.DCA.<module_name>.<aggregation_name>"]:::none --> results_tibble.DCA.differential_analyses.immune_human_2x["results_tibble.DCA.<module_name>.<aggregation_name>"]:::none
  feature_matrix_fit.DCTA.differential_analyses.immune_human_2x["feature_matrix_fit.DCTA.<module_name>.<aggregation_name>"]:::none --> results_tibble.DCTA.differential_analyses.immune_human_2x["results_tibble.DCTA.<module_name>.<aggregation_name>"]:::none
  feature_matrix_fit.DGE.differential_analyses.immune_human_2x["feature_matrix_fit.DGE.<module_name>.<aggregation_name>"]:::none --> results_tibble.DGE.differential_analyses.immune_human_2x["results_tibble.DGE.<module_name>.<aggregation_name>"]:::none
  feature_matrix_fit.DTFA.differential_analyses.immune_human_2x["feature_matrix_fit.DTFA.<module_name>.<aggregation_name>"]:::none --> results_tibble.DTFA.differential_analyses.immune_human_2x["results_tibble.DTFA.<module_name>.<aggregation_name>"]:::none
  feature_matrix_fit.DGE.differential_analyses.immune_human_2x["feature_matrix_fit.DGE.<module_name>.<aggregation_name>"]:::none --> results.CP_REACTOME.GSEA.DGE.differential_analyses.immune_human_2x["results.CP_REACTOME.GSEA.DGE.<module_name>.<aggregation_name>"]:::none
  feature_matrix_fit.DGE.differential_analyses.immune_human_2x["feature_matrix_fit.DGE.<module_name>.<aggregation_name>"]:::none --> results.H.GSEA.DGE.differential_analyses.immune_human_2x["results.H.GSEA.DGE.<module_name>.<aggregation_name>"]:::none
  TF_activity_family_comparison_tibble.CollecTRI_DTFA.differential_analyses.immune_human_2x(["TF_activity_family_comparison_tibble.CollecTRI_DTFA.<module_name>.<aggregation_name>"]):::none --> TF_activity_concordance_tibble.CollecTRI_DTFA.differential_analyses.immune_human_2x(["TF_activity_concordance_tibble.CollecTRI_DTFA.<module_name>.<aggregation_name>"]):::none
  TF_activity_source_comparison_tibble.CollecTRI_DTFA.differential_analyses.immune_human_2x(["TF_activity_source_comparison_tibble.CollecTRI_DTFA.<module_name>.<aggregation_name>"]):::none --> TF_activity_family_comparison_tibble.CollecTRI_DTFA.differential_analyses.immune_human_2x(["TF_activity_family_comparison_tibble.CollecTRI_DTFA.<module_name>.<aggregation_name>"]):::none
  results_tibble.DCTA.differential_analyses.immune_human_2x["results_tibble.DCTA.<module_name>.<aggregation_name>"]:::none --> TF_activity_source_comparison_tibble.CollecTRI_DTFA.differential_analyses.immune_human_2x(["TF_activity_source_comparison_tibble.CollecTRI_DTFA.<module_name>.<aggregation_name>"]):::none
  CollecTRI_JASPAR_family_map.differential_analyses.immune_human_2x(["CollecTRI_JASPAR_family_map.<module_name>.<aggregation_name>"]):::none --> TF_activity_source_comparison_tibble.CollecTRI_DTFA.differential_analyses.immune_human_2x(["TF_activity_source_comparison_tibble.CollecTRI_DTFA.<module_name>.<aggregation_name>"]):::none
  results_tibble.DGE.differential_analyses.immune_human_2x["results_tibble.DGE.<module_name>.<aggregation_name>"]:::none --> TF_activity_source_comparison_tibble.CollecTRI_DTFA.differential_analyses.immune_human_2x(["TF_activity_source_comparison_tibble.CollecTRI_DTFA.<module_name>.<aggregation_name>"]):::none
  results_tibble.DTFA.differential_analyses.immune_human_2x["results_tibble.DTFA.<module_name>.<aggregation_name>"]:::none --> TF_activity_source_comparison_tibble.CollecTRI_DTFA.differential_analyses.immune_human_2x(["TF_activity_source_comparison_tibble.CollecTRI_DTFA.<module_name>.<aggregation_name>"]):::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DCA.differential_analyses.immune_human_2x["feature_matrix_fit.DCA.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> results_tibble.DCA.differential_analyses.immune_human_2x["results_tibble.DCA.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DCTA.differential_analyses.immune_human_2x["feature_matrix_fit.DCTA.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> results_tibble.DCTA.differential_analyses.immune_human_2x["results_tibble.DCTA.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DGE.differential_analyses.immune_human_2x["feature_matrix_fit.DGE.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> results_tibble.DGE.differential_analyses.immune_human_2x["results_tibble.DGE.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> results.CP_REACTOME.GSEA.DGE.differential_analyses.immune_human_2x["results.CP_REACTOME.GSEA.DGE.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> results.H.GSEA.DGE.differential_analyses.immune_human_2x["results.H.GSEA.DGE.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DTFA.differential_analyses.immune_human_2x["feature_matrix_fit.DTFA.<module_name>.<aggregation_name>"]:::none
  models.differential_analyses.immune_human_2x(["models.<module_name>.<aggregation_name>"]):::none --> results_tibble.DTFA.differential_analyses.immune_human_2x["results_tibble.DTFA.<module_name>.<aggregation_name>"]:::none
  pseudobulk_counts_BPCells_matrix_dir.ATAC.immune_human_2x(["pseudobulk_counts_BPCells_matrix_dir.ATAC.<aggregation_name>"]):::none --> feature_matrix_fit.DCA.differential_analyses.immune_human_2x["feature_matrix_fit.DCA.<module_name>.<aggregation_name>"]:::none
  pseudobulk_CollecTRI_TF_activity_matrix.GEX.differential_analyses.immune_human_2x(["pseudobulk_CollecTRI_TF_activity_matrix.GEX.<module_name>.<aggregation_name>"]):::none --> feature_matrix_fit.DCTA.differential_analyses.immune_human_2x["feature_matrix_fit.DCTA.<module_name>.<aggregation_name>"]:::none
  pseudobulk_counts_BPCells_matrix_dir.ATAC.immune_human_2x(["pseudobulk_counts_BPCells_matrix_dir.ATAC.<aggregation_name>"]):::none --> feature_matrix_fit.DCTA.differential_analyses.immune_human_2x["feature_matrix_fit.DCTA.<module_name>.<aggregation_name>"]:::none
  pseudobulk_counts_BPCells_matrix_dir.GEX.immune_human_2x(["pseudobulk_counts_BPCells_matrix_dir.GEX.<aggregation_name>"]):::none --> feature_matrix_fit.DGE.differential_analyses.immune_human_2x["feature_matrix_fit.DGE.<module_name>.<aggregation_name>"]:::none
  pseudobulk_counts_BPCells_matrix_dir.ATAC.immune_human_2x(["pseudobulk_counts_BPCells_matrix_dir.ATAC.<aggregation_name>"]):::none --> feature_matrix_fit.DGE.differential_analyses.immune_human_2x["feature_matrix_fit.DGE.<module_name>.<aggregation_name>"]:::none
  pseudobulk_motif_family_accessibility_matrix.ATAC.immune_human_2x(["pseudobulk_motif_family_accessibility_matrix.ATAC.<aggregation_name>"]):::none --> feature_matrix_fit.DTFA.differential_analyses.immune_human_2x["feature_matrix_fit.DTFA.<module_name>.<aggregation_name>"]:::none
  pseudobulk_counts_BPCells_matrix_dir.ATAC.immune_human_2x(["pseudobulk_counts_BPCells_matrix_dir.ATAC.<aggregation_name>"]):::none --> feature_matrix_fit.DTFA.differential_analyses.immune_human_2x["feature_matrix_fit.DTFA.<module_name>.<aggregation_name>"]:::none
  pseudobulk_counts_BPCells_matrix_dir.ATAC.immune_human_2x(["pseudobulk_counts_BPCells_matrix_dir.ATAC.<aggregation_name>"]):::none --> pseudobulk_motif_family_accessibility_matrix.ATAC.immune_human_2x(["pseudobulk_motif_family_accessibility_matrix.ATAC.<aggregation_name>"]):::none
  pseudobulk_counts_BPCells_matrix_dir.GEX.immune_human_2x(["pseudobulk_counts_BPCells_matrix_dir.GEX.<aggregation_name>"]):::none --> pseudobulk_CollecTRI_TF_activity_matrix.GEX.differential_analyses.immune_human_2x(["pseudobulk_CollecTRI_TF_activity_matrix.GEX.<module_name>.<aggregation_name>"]):::none

7.1 Method details

The DCTA branch infers signed TF or TF-complex activity from normalized GEX pseudobulks with CollecTRI regulons and the decoupleR univariate linear model (ULM). Genes are filtered for expression across cell-type pseudobulks, and each retained regulator must have at least five measured targets. Its inferred activities then use the same configured donor-level models and contrasts as DGE, DCA, and DTFA. The published human CollecTRI network is downloaded from the OmniPath rescue archive and accepted only when it matches the pipeline’s pinned SHA-256 checksum.

DTFA tests the 233 sequence-similarity families in the official JASPAR2026 CORE vertebrate clustering rather than individual TF motifs. Each family is represented by its published root motif, which is scanned directly against the consensus peaks; individual member motifs are used only as family metadata. The same family-level accessibility matrix supports marker plots and the Seurat compatibility export. The CollecTRI-DTFA comparison maps individual CollecTRI regulators to these JASPAR families and compares model t-statistics, not raw activity scales. AP1 and NFKB remain intact as complex regulons during activity inference; their canonical members are used only to associate the complexes with motif families for comparison. Detailed source-level results retain TF expression as a third reference, while family-level summaries use the median CollecTRI regulator t-statistic and report whether any mapped source is FDR-significant.

Each gene-set collection is tested independently with cameraPR, inter.gene.cor = 0.01, and a minimum of 10 genes represented in the contrast-specific universe. A significant set is more strongly associated with the contrast than the remaining tested genes, rather than merely showing any collective change. Open Targets evidence annotation is optional.

7.2 Metadata used by the models

For each aggregation, the module retains its own file and full-tibble targets, then projects a canonical analysis view containing only donors in that aggregation and columns required by its configured models and composition plots. Rows are ordered by donor_id and non-key columns by name. Changes to unused columns, out-of-aggregation donors, or source row and column order therefore stop at this inexpensive projection boundary.