Skip to content

Repository files navigation

RaCInG

R-CMD-check pkgdown

RaCInG (Random Cell-cell Interaction Generator) reconstructs patient-specific cell-cell communication networks from bulk RNA-seq data and extracts network-level features using either a kernel-based or Monte Carlo workflow.

This package is the R implementation of the original RaCInG Python framework, as described in van Santvoort et al. (2025), repackaged for seamless integration with R/Bioconductor analysis pipelines. It is additionally coupled with multideconv for deconvolution and cell-type subgroup identification, and with OmnipathR/liana for ligand-receptor prior knowledge.

Installation

Install from GitHub

# install.packages("remotes")
remotes::install_github("VeraPancaldiLab/RaCInG_package")
library(RaCInG)

Install from a local clone

# install.packages("devtools")
devtools::install(".")

Optional preprocessing dependencies

If you want to start directly from raw counts with prepare_input_files(), install the optional helper packages used during deconvolution and prior-network construction:

install.packages(c("ggplot2", "nnls"))
# ADImpute and OmnipathR are available from Bioconductor:
BiocManager::install(c("ADImpute", "OmnipathR"))
# liana and multideconv are GitHub-only:
remotes::install_github(c("saezlab/liana", "VeraPancaldiLab/multideconv"))

Workflow at a glance

Goal Function Output
Build input matrices from raw counts prepare_input_files() Named list with L, R, C, LR matrices and labels
Run deterministic features compute_racing_kernel() Kernel arrays + feature matrix
Run simulation-based features compute_racing_montecarlo() Monte Carlo summaries
Compare patient groups wilcox_group_test() Statistics table for downstream plots

Quick start

library(RaCInG)

# Build input matrices from a real bulk RNA-seq counts matrix
# (bundled with the optional `multideconv` dependency)
data(raw_counts, package = "multideconv")
counts_matrix <- as.matrix(raw_counts)

input <- prepare_input_files(
  counts = counts_matrix,
  output_folder = "Results/",
  file_name = "example"
)

# Run kernel method (from raw counts)
kernel_res <- compute_racing_kernel(
  counts = counts_matrix,
  file_name = "example",
  output_folder = tempdir(),
  communication_type = "W"
)

# Or pass pre-computed inputs to skip preprocessing
kernel_res <- compute_racing_kernel(
  input_data = input,
  communication_type = "W"
)

# Monte Carlo method
mc_res <- compute_racing_montecarlo(
  input_data = input,
  file_name = "example",
  output_folder = tempdir(),
  communication_type = "W",
  Ncells = 100,
  Ngraphs = 10,
  Ndegree = 3
)

# Compare clinical groups or correlate features with a continuous score
grouping <- c("Responder", "Responder", "Non-responder", "Non-responder")
wilcox_results <- wilcox_group_test(kernel_res$features, grouping)
top_features_plot(wilcox_results)

Both compute_racing_kernel() and compute_racing_montecarlo() also accept communication_type as a vector (e.g. c("D", "W", "TT", "GSCC")), extracting every requested feature family from the same computed kernel / same simulated graphs in one call, instead of repeating the expensive step per type. compute_racing_montecarlo() additionally takes ncores to parallelize independent patients across cores.

Documentation

Citation

If you use this package, please cite the RaCInG publication:

van Santvoort M, Lapuente-Santana Ó, Zopoglou M, Zackl C, Finotello F, van der Hoorn P & Eduati F (2025). Mathematically mapping the network of cells in the tumor microenvironment. Cell Reports Methods, 5(2), 100985.

R Package Development

This R package implementation was developed by Marcelo Hurtado from the Pancaldi team, led by Vera Pancaldi. Marcelo is currently the primary maintainer of the package.

About

RaCInG 2.0: Integrating multiple deconvolution methods for fine-grained cell-cell communication network inference in the tumor microenvironment from bulk RNA-seq data

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages