Cell-cell communication is usually inferred from the co-expression of a ligand in one cell type and its receptor in another. Co-expression, however, is not evidence of a causal signal: shared regulators, tissue composition and technical factors all induce correlations between cell types without any signalling taking place. MRCCC implements MR-CCC (Sarkar and Ni 2026), a Bayesian Mendelian randomization framework that uses cis-eQTL genotypes as instrumental variables for ligand expression in a sender cell type and for receptor expression in a receiver cell type. It asks whether the genetically predicted ligand level, modulated by the genetically predicted receptor level, shifts the activity of a downstream pathway in the receiver.
The unit of analysis is a ligand-receptor-pathway triplet. For each triplet the package returns a posterior inclusion probability (PIP) that summarises the evidence for a causal signal. It also returns effect estimates, credible intervals, posterior sign probabilities and the receptor level at which the ligand effect reverses sign, with the Monte Carlo and convergence diagnostics needed to trust these numbers. Across many triplets, the PIPs can be thresholded with Bayesian false discovery rate control (Newton et al. 2004).
Existing tools for cell-cell communication score ligand-receptor
co-expression. CellPhoneDB (Efremova et al.
2020) tests whether a pair is expressed together more than
expected by chance. In Bioconductor, scTensor
finds patterns of ligand-receptor co-expression across cell types by
tensor decomposition, and CCPlotR
visualises the interactions such tools report. These methods describe
association and cannot separate a causal signal from confounding.
Mendelian randomization software, such as the CRAN package MendelianRandomization
(Yavorska and Burgess 2017), estimates
causal effects of an exposure on an outcome, mostly from summary
statistics of separate studies, without the cell-type structure of
communication or a ligand-by-receptor interaction. MRCCC combines the
two ideas. It uses individual-level genotypes of the same donors as
instruments for both the ligand and the receptor, models the
receptor-modulated ligand effect explicitly, and gives a PIP for each
triplet. It works on Bioconductor data structures. Donor-level
expression is held in SummarizedExperiment objects, which
can be built from a SingleCellExperiment. Genotypes are
held in a RangedSummarizedExperiment, which can be read
from a VCF file. Gene and SNP positions are given as
GRanges.
MR-CCC is a one-sample method: expression and genotypes come from the same donors, as in population-scale single-cell studies such as OneK1K (Yazar et al. 2022). Three objects are needed, each with donors in columns and identified by the same column names.
RangedSummarizedExperiment of donor-level (pseudo-bulk)
expression in the sender cell type, genes in rows. Typically counts are
summed over the cells of that type for each donor and normalised for
library size. The rowRanges give gene positions, which are
used to find cis-SNPs.RangedSummarizedExperiment with SNPs in rows, identified by
row names and positioned by rowRanges. The assay holds
allele dosages, the number of copies of the alternative
allele carried by each donor (0, 1 or 2, or an imputed value in
between).Donor covariates, such as sex, age and genotype principal components,
are read from colData.
The instruments are therefore not SNP-gene pairs taken from an
external eQTL catalogue. For each ligand and receptor gene,
selectInstruments() finds cis-SNPs in the same donors. SNPs
within 200 kb of the transcription start site are screened by regressing
the gene’s donor-level expression on dosage, adjusted for the
covariates. They are ranked by p-value and retained greedily, subject to
a linkage-disequilibrium bound (\(r^2 \le
0.8\)), until at most ten are kept. This is the procedure of the
MR-CCC paper (Sarkar and Ni 2026).
Single-cell data are usually held in a
SingleCellExperiment, with one column per cell. Summing the
counts of each cell type within each donor, for example with
aggregateAcrossCells() from scuttle
(McCarthy et al. 2017), gives the
donor-level objects that MRCCC needs. The small example below has two
cell types and twelve donors.
library(SingleCellExperiment)
library(scuttle)
set.seed(2)
cells <- data.frame(donor = rep(sprintf("donor%02d", 1:12), each = 40),
cellType = rep(c("NK", "Monocyte"), times = 240))
counts <- matrix(rpois(3 * nrow(cells), 5), nrow = 3,
dimnames = list(c("LIG1", "REC1", "PW01"), NULL))
sce <- SingleCellExperiment(assays = list(counts = counts),
colData = cells)
pseudo <- aggregateAcrossCells(sce,
ids = colData(sce)[, c("donor", "cellType")])
#> Warning in .local(x, ...): 'aggregateAcrossCells' is deprecated.
#> Use 'scrapper::aggregateAcrossCells.se' instead.
#> See help("Deprecated")
## One object per cell type, with donors as column names and counts divided
## by a library-size factor, as in the paper.
byCellType <- function(type) {
x <- pseudo[, pseudo$cellType == type]
colnames(x) <- x$donor
sizeFactor <- colSums(counts(x)) / median(colSums(counts(x)))
assay(x, "normcounts") <- sweep(counts(x), 2, sizeFactor, "/")
x
}
sender <- byCellType("NK")
sender
#> class: SingleCellExperiment
#> dim: 3 12
#> metadata(0):
#> assays(2): counts normcounts
#> rownames(3): LIG1 REC1 PW01
#> rowData names(0):
#> colnames(12): donor01 donor02 ... donor11 donor12
#> colData names(5): donor cellType donor cellType ncells
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):Gene positions are then attached with
rowRanges(sender) <- ..., using a GRanges
object of the genes, for example from a TxDb or
EnsDb annotation package. Donor covariates are added to
colData.
Genotypes stored in a VCF file can be read with VariantAnnotation
(Obenchain et al. 2014). The
GT field is converted to the number of alternative alleles.
When the file holds imputed dosages, the DS field can be
used directly instead.
library(VariantAnnotation)
vcfFile <- system.file("extdata", "chr22.vcf.gz",
package = "VariantAnnotation")
vcf <- readVcf(vcfFile, "hg19")
gt <- geno(vcf)$GT
toDosage <- function(g) {
alleles <- strsplit(g, "[|/]")
vapply(alleles, function(a) {
if (any(a == ".")) NA_real_ else sum(a != "0")
}, numeric(1))
}
dosage <- matrix(toDosage(gt), nrow = nrow(gt), dimnames = dimnames(gt))
vcfGenotypes <- SummarizedExperiment(assays = list(dosage = dosage),
rowRanges = rowRanges(vcf))
vcfGenotypes
#> class: RangedSummarizedExperiment
#> dim: 10376 5
#> metadata(0):
#> assays(1): dosage
#> rownames(10376): rs7410291 rs147922003 ... rs144055359 rs114526001
#> rowData names(5): paramRangeID REF ALT QUAL FILTER
#> colnames(5): HG00096 HG00097 HG00099 HG00100 HG00101
#> colData names(0):
assay(vcfGenotypes, "dosage")[1:3, ]
#> HG00096 HG00097 HG00099 HG00100 HG00101
#> rs7410291 0 0 1 0 0
#> rs147922003 0 0 0 0 0
#> rs114143073 0 0 0 0 0The column names of the genotype object must match those of the expression objects. Missing dosages are allowed and are imputed by the SNP’s mean dosage.
simulateMRCCC() generates data in exactly the layout
above. Its donors carry an unmeasured confounder that affects the
ligand, the receptor and the pathway, which is the situation in which a
plain co-expression analysis is misled.
sim <- simulateMRCCC(n = 300, betaX = 0.3, betaXZ = 0.3, seed = 1)
sim$sender
#> class: RangedSummarizedExperiment
#> dim: 5 300
#> metadata(0):
#> assays(1): logcounts
#> rownames(5): LIG1 SGENE1 SGENE2 SGENE3 SGENE4
#> rowData names(1): gene_id
#> colnames(300): donor001 donor002 ... donor299 donor300
#> colData names(4): sex age PC1 PC2
sim$genotypes
#> class: RangedSummarizedExperiment
#> dim: 40 300
#> metadata(0):
#> assays(1): dosage
#> rownames(40): rsL0006 rsL0001 ... rsR0019 rsR0020
#> rowData names(0):
#> colnames(300): donor001 donor002 ... donor299 donor300
#> colData names(0):
head(colData(sim$receiver))
#> DataFrame with 6 rows and 4 columns
#> sex age PC1 PC2
#> <factor> <numeric> <numeric> <numeric>
#> donor001 female 60 0.893674 -0.341067
#> donor002 male 26 -1.047298 1.502425
#> donor003 female 50 1.971337 0.528308
#> donor004 female 48 -0.383632 0.542191
#> donor005 male 43 1.654145 -0.136673
#> donor006 female 79 1.512213 -1.136734The ligand LIG1 is expressed in the sender and the
receptor REC1 in the receiver, and the downstream pathway
consists of the genes PW01, PW02, PW03, PW04, PW05, PW06, PW07, PW08 in
the receiver.
covs <- c("sex", "age", "PC1", "PC2")
ligandSNPs <- selectInstruments(sim$sender, "LIG1", sim$genotypes,
covariates = covs)
ligandSNPs
#> DataFrame with 10 rows and 3 columns
#> snp estimate pvalue
#> <character> <numeric> <numeric>
#> 1 rsL0010 1.3408366 7.35000e-19
#> 2 rsL0013 1.7090243 2.03985e-17
#> 3 rsL0004 0.9699855 4.40573e-09
#> 4 rsL0005 1.3014549 6.60170e-09
#> 5 rsL0007 0.3993678 1.91400e-02
#> 6 rsL0006 0.1734196 3.15926e-01
#> 7 rsL0008 0.1831984 3.98231e-01
#> 8 rsL0002 -0.1276890 4.98052e-01
#> 9 rsL0011 -0.0735230 7.11621e-01
#> 10 rsL0012 -0.0154821 9.37810e-01Each row is a selected SNP with its screening coefficient (the change in expression per copy of the alternative allele) and p-value. Rare SNPs, SNPs outside the window and SNPs in strong linkage disequilibrium with a better one are excluded. No p-value threshold is imposed. The strength of the selected set is reported by the fitted model as a first-stage F statistic.
buildTriplet() matches donors across the three objects,
reads the ligand, the receptor and the covariates, scores the pathway,
and selects the instruments of both genes. The result is an
MRCCCData object whose validity method checks that every
component refers to the same donors and that genotypes are dosages.
dat <- buildTriplet(sim$sender, sim$receiver, sim$genotypes,
ligand = "LIG1", receptor = "REC1",
pathway = sim$pathwayGenes, covariates = covs,
pathwayName = "Simulated pathway",
senderName = "Sender", receiverName = "Receiver")
dat
#> MRCCCData: one ligand-receptor-pathway triplet
#> ligand: LIG1 (sender: Sender)
#> receptor: REC1 (receiver: Receiver)
#> pathway: Simulated pathway
#> donors: 300
#> instruments: 10 SNP(s) for the ligand, 10 for the receptor
#> covariates (4): sexmale, age, PC1, PC2The pathway score is the mean expression of the pathway genes by
default. pathwayMethod = "pc1" uses their first principal
component instead. A precomputed score, for example from AUCell (Aibar et al. 2017),
UCell (Andreatta and Carmona 2021), ssGSEA
(Barbie et al.
2009) or GSVA (Hänzelmann et al.
2013), can be stored as a column of
colData(receiver) and named in pathway, or
passed as a numeric vector named by donor. The analysis in the paper
computed six such scores for each pathway and used the one most strongly
correlated, in absolute value, with ligand expression.
The components of the triplet are read with accessors, and the
instrument-selection tables are kept in its metadata():
head(ligandExpression(dat))
#> donor001 donor002 donor003 donor004 donor005 donor006
#> 3.081786 7.284914 2.561202 6.057107 7.595047 4.735235
dim(ligandGenotypes(dat))
#> [1] 300 10
head(covariates(dat), 3)
#> sexmale age PC1 PC2
#> donor001 0 60 0.8936737 -0.3410670
#> donor002 1 26 -1.0472981 1.5024245
#> donor003 0 50 1.9713374 0.5283077
metadata(dat)$receptorInstruments
#> DataFrame with 10 rows and 3 columns
#> snp estimate pvalue
#> <character> <numeric> <numeric>
#> 1 rsR0014 1.3100677 3.85620e-15
#> 2 rsR0013 1.5381963 8.89341e-15
#> 3 rsR0007 1.0904312 1.06745e-12
#> 4 rsR0006 0.9327585 9.01307e-09
#> 5 rsR0012 -0.2859285 9.65094e-02
#> 6 rsR0010 -0.2624905 1.39392e-01
#> 7 rsR0008 0.2325483 2.29859e-01
#> 8 rsR0015 0.0951474 5.78297e-01
#> 9 rsR0001 -0.0943011 5.96187e-01
#> 10 rsR0009 -0.0359832 8.59334e-01When the data are already aligned vectors and matrices,
MRCCCData() builds the same object directly. Donors are
matched by name, so components given in a different donor order are
aligned:
dat2 <- MRCCCData(ligandExpression = ligandExpression(dat),
receptorExpression = rev(receptorExpression(dat)),
pathwayActivity = pathwayActivity(dat),
ligandGenotypes = ligandGenotypes(dat),
receptorGenotypes = receptorGenotypes(dat),
covariates = covariates(dat))
identical(receptorExpression(dat2), receptorExpression(dat))
#> [1] TRUEFor donor \(i\), let \(X_i\) be ligand expression in the sender cell type, \(Z_i\) receptor expression in the receiver cell type, and \(Y_i\) pathway activity in the receiver cell type. Let \(G_i\) and \(H_i\) be the dosages of the ligand and receptor instruments and \(V_i\) the covariates. The first stage predicts each exposure from its instruments, \(X_i^* = E[X_i \mid G_i, V_i]\) and \(Z_i^* = E[Z_i \mid H_i, V_i]\). The second stage models the outcome as \[ Y_i = \mu + \beta_X X_i^* + \beta_Z Z_i^* + \beta_{XZ} X_i^* Z_i^* + \alpha_Y^\top V_i + \tilde\varepsilon_{Yi}. \] The causal block \((\beta_X, \beta_{XZ})\) has a spike-and-slab prior with inclusion indicator \(\gamma \in \{0, 1\}\). Under \(\gamma = 0\) its prior variance is shrunk by a small factor, so the two coefficients are held close to zero. Because \(X^*\) and \(Z^*\) depend only on genotype and the observed covariates, they are unaffected by the unmeasured confounders that distort a naive regression of \(Y\) on \(X\) and \(Z\). All stages are estimated jointly by a blocked Gibbs sampler.
The PIP \(P(\gamma = 1 \mid \text{data})\) is the communication score. The receptor-modulated ligand effect is \(\beta_X + \beta_{XZ} z\), which changes sign at \(\tau = -\beta_X / \beta_{XZ}\): when \(\tau\) lies inside the observed receptor range, the ligand activates the pathway in some donors and suppresses it in others. All inputs are centred internally, and effects are reported on a standardised scale (per standard deviation of \(X\) and \(Z\), in standard deviations of \(Y\)) as well as on the input scale.
The prior hyperparameters are set with
mrcccHyperparameters() and passed to mrccc()
through its hyper argument. The defaults are those of the
paper. For example, a wider spike:
mrccc() runs four chains from dispersed starting values
and pools them. The default chain length is used here.
fit <- mrccc(dat, seed = 1)
fit
#> MRCCCFit: LIG1 -> REC1 (Simulated pathway)
#> Chains: 4, retained draws per chain: 18000 (nIter = 20000, burnIn = 2000, thin = 1)
#> Posterior inclusion probability: 1 (MCSE NA, ESS NA)
#> First-stage F: ligand = 52.7 (10 SNPs), receptor = 48 (10 SNPs)
#> Standardised posterior means: beta_X = 0.281, beta_XZ = 0.581, beta_Z = 0.366
#> Max R-hat: 1The fit is an MRCCCFit object, and its contents are read
with accessors:
pip(fit)
#> [1] 1
pipMCSE(fit)
#> mcse ess
#> NA NA
effectSizes(fit)
#> parameter mean
#> 1 beta_X 0.2812946
#> 2 beta_XZ 0.5809515
#> 3 beta_Z 0.3660098
instrumentStrength(fit)
#> exposure nInstruments F weak
#> 1 ligand 10 52.72617 FALSE
#> 2 receptor 10 48.02059 FALSE
convergence(fit)
#> parameter rhat
#> 1 beta_X 0.9999962
#> 2 beta_XZ 1.0000013
#> 3 gamma NA
#> 4 loglik 0.9999858The largest Gelman-Rubin statistic in convergence() is
1, below 1.01, so the four chains agree. mrccc() warns when
any of them exceeds 1.01, and when the PIP is within two Monte Carlo
standard errors of the discovery threshold. In either case the chains
should be lengthened before the result is reported. A statistic is
NA when every chain holds the same constant value, as
happens for \(\gamma\) when the PIP is
one. The Monte Carlo standard error and effective sample size of the PIP
are then NA as well, because the indicator never changes
value. The statistic is the classic Gelman-Rubin potential scale
reduction factor (Gelman and Rubin 1992),
as in the paper. The threshold 1.01 is the one recommended for the
rank-normalised split \(\hat R\) (Vehtari et al. 2021). For the classic
statistic, it is stricter than the conventional 1.1.
summary() collects the main quantities:
summary(fit)
#> MR-CCC fit summary: LIG1 -> REC1 (Simulated pathway)
#> Chains: 4, retained draws per chain: 18000
#> Posterior inclusion probability: 1 (MCSE NA, ESS NA)
#> Discovery threshold: 0.5
#> First-stage F: ligand = 52.7, receptor = 48
#>
#> Standardised effects (posterior mean and 95% credible interval):
#> beta_X 0.281 [0.17, 0.396]
#> beta_XZ 0.581 [0.444, 0.728]
#> beta_Z 0.366 [0.255, 0.48]
#>
#> Gelman-Rubin R-hat (NA unless nChains >= 2):
#> beta_X 1
#> beta_XZ 1
#> gamma NA
#> loglik 1credibleIntervals(fit)
#> parameter lower median upper
#> 1 beta_X 0.1699057 0.2807240 0.3956130
#> 2 beta_XZ 0.4435394 0.5793795 0.7276235
#> 3 beta_Z 0.2549693 0.3656364 0.4803576
signProbabilities(fit)
#> pip pPositive pNegative pPositiveIncluded pNegativeIncluded nIncluded
#> 1 1 1 0 1 0 72000
signReversal(fit)
#> tauMedian tauLower tauUpper level nDraws zMin zMax pInRange
#> 1 -0.4836491 -0.7379449 -0.2832502 0.95 72000 -2.447494 2.772796 1The prior on \((\beta_X,
\beta_{XZ})\) is a spike-and-slab mixture, so the marginal
posterior of \(\beta_{XZ}\) mixes draws
taken while \(\gamma = 0\)
(concentrated near zero) with draws taken while \(\gamma = 1\). The marginal sign
probabilities combine the evidence that there is an effect with the
evidence about its direction. The conditional probabilities describe the
direction given that the ligand acts on the pathway.
signReversal() reports \(\tau\) in standard deviations of receptor
expression from its mean, with pInRange, the posterior
probability that the reversal happens within the observed receptor
range. The true threshold in this simulation is -0.46 standard
deviations from the mean.
plotEffectCurve(), also available as
plot(fit), draws the posterior mean of \(\beta_X + \beta_{XZ} z\) with a pointwise
credible band built from paired draws.
Receptor-modulated ligand effect with a 95 percent pointwise credible band.
onek1kExample() loads a small subset of the OneK1K
cohort (Yazar et al.
2022) that ships with the package. It covers the NK cells to
monocytes axis analysed in the paper, restricted to the ligand-receptor
pairs that CellPhoneDB classifies as “Signaling by Interleukin”. The
help page ?onek1kExample describes how it was derived from
the public data of the paper.
ex <- onek1kExample()
ex$sender
#> class: RangedSummarizedExperiment
#> dim: 5 651
#> metadata(0):
#> assays(1): normcounts
#> rownames(5): IL23A IL15 IL18 IL1B IL6
#> rowData names(1): gene_id
#> colnames(651): 1_1 4_4 ... 1079_1080 1081_1082
#> colData names(5): sex ageBin PC1 PC2 PC3
ex$receiver
#> class: RangedSummarizedExperiment
#> dim: 8 651
#> metadata(0):
#> assays(1): normcounts
#> rownames(8): IL12RB1 IL15RA ... IL6R IL6ST
#> rowData names(1): gene_id
#> colnames(651): 1_1 4_4 ... 1079_1080 1081_1082
#> colData names(7): sex ageBin ... interleukinPC1 interleukinMean
ex$triplets
#> ligand receptor pathway
#> 1 IL23A IL12RB1 Signaling by Interleukin
#> 2 IL15 IL15RA Signaling by Interleukin
#> 3 IL15 IL2RB Signaling by Interleukin
#> 4 IL18 IL18R1 Signaling by Interleukin
#> 5 IL18 IL18RAP Signaling by Interleukin
#> 6 IL1B IL1RAP Signaling by Interleukin
#> 7 IL6 IL6R Signaling by Interleukin
#> 8 IL6 IL6ST Signaling by InterleukinThe receiver colData holds the covariates of the paper
(sex, age in seven groups and three genotype principal components) and
the first principal component of the Reactome interleukin gene set,
which the paper used as the pathway activity of the IL-18 triplets. We
fit the paper’s lead finding, the effect of NK-cell IL18 on
monocyte interleukin signalling, modulated by the receptor chain
IL18R1.
realCovs <- c("sex", "ageBin", "PC1", "PC2", "PC3")
il18 <- buildTriplet(ex$sender, ex$receiver, ex$genotypes,
ligand = "IL18", receptor = "IL18R1",
pathway = "interleukinPC1", covariates = realCovs,
pathwayName = "Signaling by Interleukin",
senderName = "NK cells", receiverName = "Monocytes")
il18
#> MRCCCData: one ligand-receptor-pathway triplet
#> ligand: IL18 (sender: NK cells)
#> receptor: IL18R1 (receiver: Monocytes)
#> pathway: Signaling by Interleukin
#> donors: 651
#> instruments: 10 SNP(s) for the ligand, 10 for the receptor
#> covariates (5): sexmale, ageBin, PC1, PC2, PC3
fitIL18 <- mrccc(il18, nIter = 50000, seed = 1)
#> First-stage F below 10 for the ligand (F = 4.14) and receptor (F = 2.59): the instruments are weak by the two-stage least-squares heuristic. MR-CCC does not require F > 10, but posterior inclusion probabilities are less decisive in this regime and longer chains may be needed. See instrumentStrength().
fitIL18
#> MRCCCFit: IL18 -> IL18R1 (Signaling by Interleukin)
#> Chains: 4, retained draws per chain: 48000 (nIter = 50000, burnIn = 2000, thin = 1)
#> Posterior inclusion probability: 0.944 (MCSE 0.0135, ESS 354)
#> First-stage F: ligand = 4.14 (10 SNPs), receptor = 2.59 (10 SNPs) [weak: F < 10]
#> Standardised posterior means: beta_X = 0.334, beta_XZ = 2.13, beta_Z = -0.0517
#> Max R-hat: 1The message about weak instruments is expected. As in the paper, the cis-eQTLs of these genes explain little of their expression, which is typical of single-cell eQTL data. MR-CCC does not require strong instruments, but its PIPs are then less decisive, and the paper ran four chains of 100,000 iterations per triplet. With the shorter chains used here, the PIP is 0.94, compared with 0.90 in the paper. The estimated effects of the individual instruments on expression, the direction of the interaction, and the credible intervals given that the causal block is included, as reported in the paper, are:
firstStageEffects(fitIL18)
#> exposure snp mean lower upper
#> 1 ligand rs1946518 -0.76335662 -1.522327745 0.022072087
#> 2 ligand rs187238 0.24621573 -0.942712465 1.376455518
#> 3 ligand rs4937100 0.26308239 -0.277307615 0.772540292
#> 4 ligand rs2250417 0.04115474 -0.712149996 0.824091959
#> 5 ligand rs2091289 -0.18128555 -0.517137861 0.139950988
#> 6 ligand GSA-rs77302491 0.34813163 -0.216479292 0.898494485
#> 7 ligand rs11821811 0.05862584 -0.185750759 0.315748170
#> 8 ligand rs544354 0.20487624 -0.754850763 1.135762399
#> 9 ligand GSA-rs11214110 -0.94084514 -1.521631366 -0.361361343
#> 10 ligand rs1834481 -0.09947584 -0.935263363 0.740528229
#> 11 receptor GSA-rs76326130 0.07231338 -0.006324562 0.162547751
#> 12 receptor GSA-rs6758936 -0.04752915 -0.122759562 0.037307141
#> 13 receptor rs3771172 -0.02250738 -0.098128740 0.059385689
#> 14 receptor rs3752659 -0.04221098 -0.095652568 0.007692924
#> 15 receptor rs3771166 0.03279227 -0.046723364 0.107753179
#> 16 receptor GSA-rs1115282 0.03598227 -0.021964085 0.091966749
#> 17 receptor rs1420101 0.03569626 -0.045962988 0.116283924
#> 18 receptor rs6543146 0.03229868 0.004200165 0.062647083
#> 19 receptor rs12712141 0.01740335 -0.050336571 0.086132875
#> 20 receptor rs12475055 -0.03046899 -0.071336315 0.010475774
signProbabilities(fitIL18)
#> pip pPositive pNegative pPositiveIncluded pNegativeIncluded nIncluded
#> 1 0.9441302 0.9589583 0.04104167 0.9828656 0.01713438 181273
credibleIntervals(fitIL18, included = TRUE)
#> parameter lower median upper
#> 1 beta_X 0.03994428 0.34742051 0.7029006
#> 2 beta_XZ 0.20626111 2.20954718 4.5775618
#> 3 beta_Z -0.46541046 -0.05061595 0.3525777
signReversal(fitIL18)
#> tauMedian tauLower tauUpper level nDraws zMin zMax pInRange
#> 1 -0.1493287 -0.8962608 0.3050713 0.95 192000 -0.1996705 14.98327 0.6636823A positive interaction means that the ligand effect is larger in donors whose monocytes express more IL18R1. The paper discusses this finding, its sensitivity to single instruments and to the pathway representation, and its biological interpretation (Sarkar and Ni 2026).
In a full analysis every candidate triplet is fitted, and the set of
discoveries is chosen with Bayesian false discovery rate control. For a
declared set \(S\) the Bayesian false
discovery rate is \[
\mathrm{bFDR}(S) = |S|^{-1} \sum_{j \in S} (1 - \mathrm{PIP}_j),
\] the posterior expected proportion of false discoveries (Newton et al. 2004). mrcccScreen()
fits a list of triplets, and screenTable() summarises them,
ranked by PIP, with the bFDR of each nested set and the largest set
whose bFDR does not exceed a target level. The triplets are fitted in
parallel when BPPARAM is, for example,
BiocParallel::MulticoreParam().
To keep this document fast, the screen below uses four simulated triplets with strong instruments: one with a ligand main effect and an interaction, one with a main effect only, and two nulls.
settings <- data.frame(betaX = c(0.3, 0.3, 0, 0), betaXZ = c(0.3, 0, 0, 0))
simTriplets <- lapply(seq_len(nrow(settings)), function(k) {
s <- simulateMRCCC(n = 300, betaX = settings$betaX[k],
betaXZ = settings$betaXZ[k], seed = 10 + k)
buildTriplet(s$sender, s$receiver, s$genotypes,
ligand = "LIG1", receptor = "REC1",
pathway = s$pathwayGenes, covariates = covs,
pathwayName = "Simulated pathway")
})
names(simTriplets) <- c("main+interaction", "main only", "null 1", "null 2")
fits <- mrcccScreen(simTriplets, nIter = 20000, nChains = 2, seed = 1)
screenTable(fits, alpha = 0.10)
#> triplet ligand receptor pathway pip pipMCSE
#> 1 main+interaction LIG1 REC1 Simulated pathway 1.00000000 NA
#> 2 main only LIG1 REC1 Simulated pathway 1.00000000 NA
#> 3 null 1 LIG1 REC1 Simulated pathway 0.06036111 0.007775987
#> 4 null 2 LIG1 REC1 Simulated pathway 0.03177778 0.005744095
#> maxRhat bFDR selected
#> 1 1.000037 0.0000000 TRUE
#> 2 1.000004 0.0000000 TRUE
#> 3 1.000185 0.3132130 FALSE
#> 4 1.002841 0.4769653 FALSEbayesFDR() and bfdrSelect() take the same
list of fits, or a numeric vector of PIPs:
The same call screens the eight interleukin triplets of the real
example. Because their instruments are weak, the chains must be much
longer than above for every triplet to converge, so the code is shown
without being run. With chains as long as in the paper it takes about 20
minutes on one core of a recent laptop, and less with a parallel
BPPARAM.
realTriplets <- lapply(seq_len(nrow(ex$triplets)), function(k) {
buildTriplet(ex$sender, ex$receiver, ex$genotypes,
ligand = ex$triplets$ligand[k],
receptor = ex$triplets$receptor[k],
pathway = "interleukinPC1", covariates = realCovs,
pathwayName = "Signaling by Interleukin")
})
names(realTriplets) <- paste(ex$triplets$ligand, ex$triplets$receptor,
sep = "-")
realFits <- mrcccScreen(realTriplets, nIter = 100000, seed = 1,
BPPARAM = BiocParallel::MulticoreParam(4))
screenTable(realFits, alpha = 0.10)In the paper, the two IL-18 triplets are the discoveries of this pathway class on this axis. There, each triplet used the pathway representation most strongly correlated, in absolute value, with ligand expression. The PIPs of the other triplets can therefore differ from those obtained here with the first principal component for all.
The PIP is the mean of an autocorrelated binary chain, so its Monte
Carlo standard error (MCSE) is estimated by non-overlapping batch means
within each chain and combined across chains. The effective sample size
(ESS) is the number of independent draws that would give the same
precision. Pooling \(C\) chains of
nIter iterations, each discarding burnIn,
carries about the same standard error as one chain that retains \(C \times\) (nIter \(-\) burnIn) draws, and several
chains also yield \(\hat R\). Each
chain has its own seed, derived from seed, so the chains
can run in parallel through the BPPARAM argument of
mrccc() without changing the result.
When the PIP lies close to the discovery threshold, or the
instruments are weak, much longer chains are needed to resolve it. The
real-data analysis in the paper pools four chains of 100,000 iterations
per triplet. Its simulation studies run one chain per fit, of 20,000
iterations when the instruments are strong and of 400,000 iterations
when they are weak or otherwise misspecified. A single chain is run with
nChains = 1, and its effects start at zero.
posteriorDraws() returns the retained draws with their
chain index for trace plots and further checks, and
fitSettings() returns the settings of a fit.
head(posteriorDraws(fit))
#> chain beta_X beta_XZ beta_Z gamma mu loglik
#> 1 1 0.3800145 0.3390039 0.4244369 1 -0.138619665 -1603.725
#> 2 1 0.3152147 0.3350747 0.3983553 1 -0.211486986 -1599.532
#> 3 1 0.4315014 0.3558719 0.5822952 1 -0.065651911 -1608.655
#> 4 1 0.3887979 0.3945619 0.4070996 1 -0.170981678 -1605.403
#> 5 1 0.3687083 0.3521043 0.4350566 1 -0.002798167 -1612.359
#> 6 1 0.4035886 0.3248228 0.4827068 1 0.086314617 -1608.823sessionInfo()
#> R version 4.6.2 (2026-10-29)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04.1 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats4 stats graphics grDevices utils datasets methods
#> [8] base
#>
#> other attached packages:
#> [1] VariantAnnotation_1.59.4 Rsamtools_2.29.0
#> [3] Biostrings_2.81.9 XVector_0.53.0
#> [5] scuttle_1.23.2 SingleCellExperiment_1.35.2
#> [7] SummarizedExperiment_1.43.0 Biobase_2.73.2
#> [9] GenomicRanges_1.67.0 Seqinfo_1.3.2
#> [11] IRanges_2.47.5 S4Vectors_0.51.10
#> [13] BiocGenerics_0.59.13 generics_0.1.4
#> [15] MatrixGenerics_1.25.0 matrixStats_1.5.0
#> [17] MRCCC_1.1.0 BiocStyle_2.41.0
#>
#> loaded via a namespace (and not attached):
#> [1] KEGGREST_1.53.6 gtable_0.3.6 rjson_0.2.23
#> [4] xfun_0.62 bslib_0.12.0 ggplot2_4.0.4
#> [7] lattice_0.23-1 vctrs_0.7.3 tools_4.6.2
#> [10] bitops_1.1-0 curl_8.1.0 parallel_4.6.2
#> [13] AnnotationDbi_1.77.0 RSQLite_3.53.3 blob_1.3.0
#> [16] BiocBaseUtils_1.15.1 Matrix_1.7-6 BSgenome_1.83.0
#> [19] RColorBrewer_1.1-3 cigarillo_1.3.1 S7_1.0.0
#> [22] lifecycle_1.0.5 compiler_4.6.2 farver_2.1.2
#> [25] codetools_0.2-20 htmltools_0.5.9 sys_3.4.3
#> [28] buildtools_1.0.0 sass_0.5.0 RCurl_1.98-1.20
#> [31] yaml_2.3.12 crayon_1.5.3 jquerylib_0.1.4
#> [34] BiocParallel_1.47.0 DelayedArray_0.39.8 cachem_1.1.0
#> [37] abind_1.4-8 digest_0.6.39 restfulr_0.0.17
#> [40] labeling_0.4.3 maketools_1.3.2 fastmap_1.2.0
#> [43] grid_4.6.2 cli_3.6.6 SparseArray_1.13.5
#> [46] S4Arrays_1.13.3 GenomicFeatures_1.65.2 XML_3.99-0.25
#> [49] withr_3.0.3 scales_1.4.0 bit64_4.8.6
#> [52] httr_1.4.9 rmarkdown_2.32 bit_4.6.0
#> [55] otel_0.3.0 png_0.1-9 beachmat_2.29.3
#> [58] memoise_2.0.1 evaluate_1.0.5 knitr_1.52
#> [61] BiocIO_1.23.3 rtracklayer_1.73.0 rlang_1.3.0
#> [64] Rcpp_1.1.2 glue_1.8.1 DBI_1.3.0
#> [67] BiocManager_1.30.27 jsonlite_2.0.0 R6_2.6.1
#> [70] GenomicAlignments_1.51.0