Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Gene regulatory networks

🧠 Key takeaways
⚙️ Environment setup
Steps
yml
  1. Install conda:

    • Before creating the environment, ensure that conda is installed on your system.

  2. Save the yml content:

    • Copy the content from the yml tab into a file named environment.yml.

  3. Create the environment:

    • Open a terminal or command prompt.

    • Run the following command:

      conda env create -f environment.yml
  4. Activate the environment:

    • After the environment is created, activate it using:

      conda activate <environment_name>
    • Replace <environment_name> with the name specified in the environment.yml file. In the yml file it will look like this:

      name: <environment_name>
  5. Verify the installation:

    • Check that the environment was created successfully by running:

      conda env list
🗄️ Get data and notebooks

This book uses lamindb to store, share, and load datasets and notebooks using the theislab/sc-best-practices instance. We acknowledge free hosting from Lamin Labs.

  1. Install lamindb

    • Install the lamindb Python package:

    pip install lamindb
  2. Optionally create a lamin account

  3. Verify your setup

    • Run the lamin connect command:

    import lamindb as ln
    
    ln.Artifact.connect("theislab/sc-best-practices").df()

    You should now see up to 100 of the stored datasets.

  4. Accessing datasets (Artifacts)

    • Search for the datasets on the Artifacts page

    • Load an Artifact and the corresponding object:

    import lamindb as ln
    
    af = ln.Artifact.connect("theislab/sc-best-practices").get(
        key="key_of_dataset", is_latest=True
    )
    obj = af.load()

    The object is now accessible in memory and is ready for analysis. Adapt the lamindb.Artifact.connect("theislab/sc-best-practices").get("SOMEIDXXXX") suffix to get respective versions.

  5. Accessing notebooks (Transforms)

    lamin load <notebook url>

    which will download the notebook to the current working directory. Analogously to Artifacts, you can adapt the suffix ID to get older versions.

Motivation

Transcription factors (TFs) control gene expression by binding regulatory elements near their target genes and activating or repressing their transcription. A gene regulatory network (GRN) describes these relationships as a directed graph from TFs to their target genes, where each edge can carry a sign for activation or repression and a weight. The set of targets of a TF is called its regulon. GRNs help to explain which regulators establish and maintain cell identities and which regulators change between conditions.

Inferring gene regulatory networks

GRNs can be inferred from gene expression alone, for example with regression models that score how well each TF predicts every gene, which SCENIC then prunes with TF binding motifs Aibar et al., 2017. Multimodal methods such as SCENIC+ additionally require accessible chromatin at a TF’s binding site near the target Bravo González-Blas et al., 2023, see the chromatin accessibility chapter. Alternatively, prior-knowledge networks collect TF-target interactions that were reported in the literature and in databases, such as DoRothEA Garcia-Alonso et al., 2019 and its successor CollecTRI Müller-Dott et al., 2023.

Networks inferred from expression alone recover known interactions barely better than random ones Pratapa et al., 2020, and even multimodal networks change with seeds and method choices and struggle to predict the effects of perturbations Mompel et al., 2024. Unless the question is about regulation that is not yet known, we therefore recommend estimating TF activities from a prior-knowledge network Mompel et al., 2023. A TF’s activity is inferred from the expression of its targets, its footprint, which is more informative than the TF’s own expression, since TFs are often lowly expressed and regulated after transcription.

Environment setup and data

We continue with sample site4-donor8 of the NeurIPS human bone marrow dataset Luecken et al., 2021 and use the cell type annotations curated for the challenge.

Output
→ connected lamindb: theislab/sc-best-practices
→ loaded Transform('s7XDZUXrhnOD0000', key='gene_regulatory_networks.ipynb'), started new Run('EA2BfGn30QGBaKwk') at 2026-09-29 13:11:49 UTC
→ notebook imports: decoupler==2.2.0 lamindb-core==2.10.0 scanpy==1.12.4

We keep the gene expression of the sample, normalize it with the shifted logarithm and compute a UMAP for visualization.

AnnData object with n_obs × n_vars = 9876 × 13431 obs: 'GEX_pct_counts_mt', 'GEX_n_counts', 'GEX_n_genes', 'GEX_size_factors', 'GEX_phase', 'ATAC_nCount_peaks', 'ATAC_atac_fragments', 'ATAC_reads_in_peaks_frac', 'ATAC_blacklist_fraction', 'ATAC_nucleosome_signal', 'cell_type', 'batch', 'ATAC_pseudotime_order', 'GEX_pseudotime_order', 'Samplename', 'Site', 'DonorNumber', 'Modality', 'VendorLot', 'DonorID', 'DonorAge', 'DonorBMI', 'DonorBloodType', 'DonorRace', 'Ethnicity', 'DonorGender', 'QCMeds', 'DonorSmoker' var: 'feature_types', 'gene_id' uns: 'ATAC_gene_activity_var_names', 'dataset_id', 'genome', 'organism', 'log1p', 'pca', 'neighbors', 'umap' obsm: 'ATAC_gene_activity', 'ATAC_lsi_full', 'ATAC_lsi_red', 'ATAC_umap', 'GEX_X_pca', 'GEX_X_umap', 'X_pca', 'X_umap' varm: 'PCs' obsp: 'distances', 'connectivities' layers: 'counts', None (.X)
<Figure size 320x320 with 1 Axes>

A prior-knowledge network

We use CollecTRI, which gathers signed TF-target interactions for 1,186 TFs from curated databases and text mining Müller-Dott et al., 2023, and which we already loaded in the gene set enrichment chapter. Each row is an edge from a TF (source) to a target gene (target), with a weight of 1 for activation and -1 for repression.

Loading...

Transcription factor activities

decoupler Mompel et al., 2022 infers the activity of every TF in every cell with a univariate linear model (ULM) that regresses the cell’s gene expression on the weights of the TF’s regulon. The t-value of the slope is the activity score: it is positive if the targets that the TF activates are expressed higher, and the targets it represses lower, than the other genes in that cell.

AnnData object with n_obs × n_vars = 9876 × 593 obs: 'GEX_pct_counts_mt', 'GEX_n_counts', 'GEX_n_genes', 'GEX_size_factors', 'GEX_phase', 'ATAC_nCount_peaks', 'ATAC_atac_fragments', 'ATAC_reads_in_peaks_frac', 'ATAC_blacklist_fraction', 'ATAC_nucleosome_signal', 'cell_type', 'batch', 'ATAC_pseudotime_order', 'GEX_pseudotime_order', 'Samplename', 'Site', 'DonorNumber', 'Modality', 'VendorLot', 'DonorID', 'DonorAge', 'DonorBMI', 'DonorBloodType', 'DonorRace', 'Ethnicity', 'DonorGender', 'QCMeds', 'DonorSmoker' uns: 'ATAC_gene_activity_var_names', 'dataset_id', 'genome', 'organism', 'log1p', 'pca', 'neighbors', 'umap', 'cell_type_colors' obsm: 'ATAC_gene_activity', 'ATAC_lsi_full', 'ATAC_lsi_red', 'ATAC_umap', 'GEX_X_pca', 'GEX_X_umap', 'X_pca', 'X_umap', 'score_ulm', 'padj_ulm' layers: None (.X)

TF activities can be visualized like gene expression, here for the B cell regulator PAX5, the erythroid regulator GATA1 and the myeloid regulator SPI1.

<Figure size 1159.2x320 with 6 Axes>

Transcription factors characteristic of cell types

To find the TFs whose activity distinguishes each cell type, we rank the activity scores of every cell type against all other cells.

<Figure size 1096.8x612 with 4 Axes>

Many of these are well-known regulators, such as PAX5 and EBF1 in B cells and lymphoid progenitors, GATA1 and NFE2 in erythroid cells, HOXA9 and MECOM in HSCs, XBP1 in plasma cells, TCF7 in naive CD4+ T cells and BCL11A in pDCs. Others, such as the circadian regulators CLOCK and BMAL1 in CD14+ monocytes, are less expected and may reflect targets they share with other TFs, so candidate regulators should be checked against known biology before they are interpreted.

Inspecting a regulon

To see which targets drive an activity score, we plot the regulons of PAX5 and EBF1 together with the mean expression of their targets in naive B cells.

<Figure size 600x600 with 4 Axes>

PAX5 and EBF1 activate each other and share targets such as BLK, and EBF1 also activates the B cell receptor components CD19 and CD79B. Several of these targets are detected in only a few cells of this dataset, so no single target decides the activity score, which combines the evidence from the whole regulon.

Quiz

Theory

Loading...

Transcription factor activity

Loading...

Contributors

We gratefully acknowledge the contributions of:

Authors

  • Ignacio Ibarra

Reviewers

  • Lukas Heumos

  • Anna Schaar

References
  1. Aibar, S., González-Blas, C. B., Moerman, T., Huynh-Thu, V. A., Imrichova, H., Hulselmans, G., Rambow, F., Marine, J.-C., Geurts, P., Aerts, J., van den Oord, J., Atak, Z. K., Wouters, J., & Aerts, S. (2017). SCENIC: single-cell regulatory network inference and clustering. Nat. Methods, 14(11), 1083–1086.
  2. Bravo González-Blas, C., De Winter, S., Hulselmans, G., Hecker, N., Matetovici, I., Christiaens, V., Poovathingal, S., Wouters, J., Aibar, S., & Aerts, S. (2023). SCENIC+: single-cell multiomic inference of enhancers and gene regulatory networks. Nature Methods, 20(9), 1355–1367. 10.1038/s41592-023-01938-4
  3. Garcia-Alonso, L., Holland, C. H., Ibrahim, M. M., Turei, D., & Saez-Rodriguez, J. (2019). Benchmark and integration of resources for the estimation of human transcription factor activities. Genome Res., 29(8), 1363–1375.
  4. Müller-Dott, S., Tsirvouli, E., Vazquez, M., Ramirez Flores, R. O., Badia-i Mompel, P., Fallegger, R., Türei, D., Lægreid, A., & Saez-Rodriguez, J. (2023). Expanding the coverage of regulons from high-confidence prior knowledge for accurate estimation of transcription factor activities. Nucleic Acids Research, 51(20), 10934–10949. 10.1093/nar/gkad841
  5. Pratapa, A., Jalihal, A. P., Law, J. N., Bharadwaj, A., & Murali, T. M. (2020). Benchmarking algorithms for gene regulatory network inference from single-cell transcriptomic data. Nat. Methods, 17(2), 147–154.
  6. Badia-i Mompel, P., Casals-Franch, R., Wessels, L., Müller-Dott, S., Trimbour, R., Yang, Y., Ramirez Flores, R. O., & Saez-Rodriguez, J. (2024). Comparison and evaluation of methods to infer gene regulatory networks from multimodal single-cell data. bioRxiv. 10.1101/2024.12.20.629764
  7. Badia-i Mompel, P., Wessels, L., Müller-Dott, S., Trimbour, R., Ramirez Flores, R. O., Argelaguet, R., & Saez-Rodriguez, J. (2023). Gene regulatory network inference in the era of single-cell multi-omics. Nature Reviews Genetics, 24(11), 739–754. 10.1038/s41576-023-00618-5
  8. Luecken, M. D., Burkhardt, D. B., Cannoodt, R., Lance, C., Agrawal, A., Aliee, H., Chen, A. T., Deconinck, L., Detweiler, A. M., Granados, A. A., Huynh, S., Isacco, L., Kim, Y. J., Klein, D., KUMAR, B. D., Kuppasani, S., Lickert, H., McGeever, A., Mekonen, H., … Bloom, J. M. (2021). A sandbox for prediction and integration of DNA, RNA, and proteins in single cells. Thirty-Fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2). https://openreview.net/forum?id=gN35BGa1Rt
  9. Badia-i Mompel, P., Vélez Santiago, J., Braunger, J., Geiss, C., Dimitrov, D., Müller-Dott, S., Taus, P., Dugourd, A., Holland, C. H., Ramirez Flores, R. O., & Saez-Rodriguez, J. (2022). decoupleR: ensemble of computational methods to infer biological activities from omics data. Bioinformatics Advances, 2(1), vbac016. 10.1093/bioadv/vbac016