Tutorials › Multi-Omics Data Integration › A Worked Bayesian Clustering Analysis of RNA and Protein Data

Bayesian Integrative Clustering · Tutorial 290 of 597

A Worked Bayesian Clustering Analysis of RNA and Protein Data

Build and assess a shared-cluster Bayesian model for matched RNA and protein data, and interpret its posterior sample assignments.

Advanced 12 min read

What You'll Learn

  • Specify a joint likelihood for matched RNA and protein measurements with shared sample-level cluster labels.
  • Set priors and describe the posterior target for a Gaussian mixture model.
  • Calculate conditional posterior cluster probabilities from concrete RNA and protein values.
  • Separate the contribution of each modality to a joint assignment.
  • Summarize posterior assignments across retained MCMC draws.
  • Use posterior predictive checks to assess whether the fitted model reproduces relevant data features.

From Matched Measurements to Shared Clusters

When RNA and protein measurements are collected on the same biological samples, a joint clustering analysis can ask whether both modalities support a common partition of those samples. The key modeling choice is to give each sample one latent cluster label, while allowing RNA and protein to have different cluster-specific profiles. This is not the same as assuming that the two modalities have identical measurements or identical noise.

The analysis below uses a small hypothetical data set with two standardized RNA features and two standardized protein features measured on each sample. Standardization puts the features on comparable scales for this example; it does not make their measurement errors equal or guarantee that a Gaussian model is appropriate. In an application, matching sample identifiers and checking the preprocessing are prerequisites to fitting any joint model.

Definition: Let \(x_{ij}\) be the standardized value of RNA feature \(j\) for sample \(i\), and let \(y_{i\ell}\) be the standardized value of protein feature \(\ell\) for sample \(i\). A shared-cluster model assigns one latent label \(z_i\in\{1,\ldots,K\}\) to sample \(i\); conditional on \(z_i=k\), the sample's RNA and protein measurements follow cluster-specific distributions. The label is shared, but the modality-specific profiles and variances may differ.

A Joint Gaussian Mixture Model

For a concrete specification, suppose there are \(n\) matched samples, \(p\) RNA features, \(q\) protein features, and a fixed number \(K\) of clusters. Let the mixing proportions be \(\boldsymbol{\pi}=(\pi_1,\ldots,\pi_K)\), with \(\pi_k\geq0\) and \(\sum_k\pi_k=1\). Assume \(z_i\mid\boldsymbol{\pi}\sim\text{Categorical}(\boldsymbol{\pi})\). Conditional on \(z_i=k\), take the features to be independent Gaussian measurements:

$$ x_{ij}\mid z_i=k,\mu^{(R)}_{kj},(\sigma^{(R)}_j)^2 \sim N\!\left(\mu^{(R)}_{kj},(\sigma^{(R)}_j)^2\right),\qquad y_{i\ell}\mid z_i=k,\mu^{(P)}_{k\ell},(\sigma^{(P)}_\ell)^2 \sim N\!\left(\mu^{(P)}_{k\ell},(\sigma^{(P)}_\ell)^2\right). $$

Here \(R\) denotes RNA and \(P\) denotes protein. Variances are feature-specific and shared across clusters in this basic model; the means are cluster-specific. Conditional independence means that, given the cluster label and model parameters, the likelihood factors across features and modalities. It is a substantive assumption, not a consequence of measuring the modalities on the same samples.

The complete-data likelihood, including the labels, is

$$ p(X,Y,\mathbf z\mid\boldsymbol{\pi},\boldsymbol{\mu},\boldsymbol{\sigma}^2) = \prod_{i=1}^{n}\pi_{z_i} \prod_{j=1}^{p} f_N(x_{ij};\mu^{(R)}_{z_i j},(\sigma^{(R)}_j)^2) \prod_{\ell=1}^{q} f_N(y_{i\ell};\mu^{(P)}_{z_i\ell},(\sigma^{(P)}_\ell)^2), $$

where \(f_N(\cdot;\mu,\sigma^2)\) is the normal density with mean \(\mu\) and variance \(\sigma^2\). One possible prior specification is \(\boldsymbol{\pi}\sim\text{Dirichlet}(\alpha_1,\ldots,\alpha_K)\), independent normal priors on the cluster means, and independent inverse-gamma priors on the feature variances. The prior hyperparameters must be chosen on scales appropriate to the standardized data and examined for sensitivity.

The Bayesian target is the posterior distribution of labels and parameters given the observed data:

$$ p(\mathbf z,\boldsymbol{\pi},\boldsymbol{\mu},\boldsymbol{\sigma}^2\mid X,Y) \propto p(X,Y\mid\mathbf z,\boldsymbol{\mu},\boldsymbol{\sigma}^2)\, p(\mathbf z\mid\boldsymbol{\pi})\, p(\boldsymbol{\pi})p(\boldsymbol{\mu})p(\boldsymbol{\sigma}^2). $$

A fit can be obtained with the earlier material on Gibbs sampling for joint cluster assignments, collapsed sampling, or variational inference. Regardless of the fitting method, the number of clusters, priors, data preprocessing, and likelihood assumptions define what the posterior means. Since mixture labels are interchangeable, label-specific summaries require consistent alignment of labels across retained draws, as in the earlier material on label switching.

Why the Joint Assignment Has This Form

For fixed parameters, the conditional probability that sample \(i\) belongs to cluster \(k\) is proportional to its prior cluster probability times its RNA and protein likelihoods. Normalizing over all clusters gives

$$ P(z_i=k\mid x_i,y_i,\boldsymbol{\pi},\boldsymbol{\mu},\boldsymbol{\sigma}^2) = \frac{\pi_k L^{(R)}_{ik}L^{(P)}_{ik}} {\sum_{h=1}^{K}\pi_h L^{(R)}_{ih}L^{(P)}_{ih}}, $$

where \(L^{(R)}_{ik}\) and \(L^{(P)}_{ik}\) are the products of the corresponding feature densities. This expression follows directly from Bayes' rule: the numerator is the joint density of the observations and label \(k\), and the denominator sums that quantity over all possible labels. In computation, log densities are generally used to avoid numerical underflow.

With two clusters, equal mixing proportions, and unit variances for every feature, suppose every cluster-1 mean is \(-0.8\) and every cluster-2 mean is \(+0.8\). The conditional log posterior odds for cluster 2 versus cluster 1 simplify to

$$ \log\frac{P(z_i=2\mid x_i,y_i,\theta)}{P(z_i=1\mid x_i,y_i,\theta)} = 1.6\left(\sum_{j=1}^{p}x_{ij}+\sum_{\ell=1}^{q}y_{i\ell}\right), $$

where \(\theta\) denotes the fixed parameters. To verify the feature contribution, the log density ratio for one observed value \(v\) is \(\{(v+0.8)^2-(v-0.8)^2\}/2=1.6v\). Summing those ratios across RNA and protein features gives the displayed expression. This derivation shows how evidence accumulates under the conditional-independence assumption; it does not establish that the features are truly independent.

Worked Example: Conditional Assignment for a Matched Sample

Use the two-cluster parameters just specified. A hypothetical sample A has RNA values \(0.6,0.3\) and protein values \(0.4,0.1\). Calculate its conditional probability of cluster 2.

The sum of its four feature values is \(0.6+0.3+0.4+0.1=1.4\). Therefore the log posterior odds are \(1.6(1.4)=2.24\), and the posterior odds are \(\exp(2.24)\approx9.40\). With equal mixing proportions, the posterior probability is

$$ P(z_A=2\mid x_A,y_A,\theta) =\frac{\exp(2.24)}{1+\exp(2.24)} \approx \frac{9.40}{10.40} =0.904. $$

Thus, conditional on these parameter values, sample A has about a 0.904 probability of cluster 2. This is not yet a probability averaged over uncertainty in the means, variances, and mixing proportions; that distinction matters when reporting results from a full Bayesian fit.

Worked Analysis of a Small Matched Data Set

The following hypothetical observations use the same two RNA and two protein features. For transparent arithmetic, take the fitted representative parameter values from the preceding section. The table gives the conditional probability of cluster 2 at those values, calculated from the log-odds formula. These calculations demonstrate the likelihood and assignment mechanics; actual reported Bayesian assignments should integrate parameter uncertainty using posterior draws.

SampleRNA valuesProtein valuesSum of four valuesConditional \(P(z_i=2\mid x_i,y_i,\theta)\)
A0.6, 0.30.4, 0.11.40.904
B0.7, 0.4-0.2, -0.10.80.782
C-0.4, -0.6-0.5, -0.3-1.80.0531
D0.1, -0.10.05, -0.0500.500
E0.4, 0.2-0.5, -0.4-0.30.382

Worked Example: Reading a Conflicting RNA and Protein Signal

For sample E, the RNA values sum to \(0.4+0.2=0.6\), while the protein values sum to \(-0.5-0.4=-0.9\). Under the stated model, the RNA log-odds contribution is \(1.6(0.6)=0.96\), and the protein contribution is \(1.6(-0.9)=-1.44\). The combined log odds are \(0.96-1.44=-0.48\), so

$$ P(z_E=2\mid x_E,y_E,\theta) =\frac{1}{1+\exp(0.48)} \approx 0.382. $$

RNA favors cluster 2 and protein favors cluster 1, but the protein contribution is larger in magnitude under these model parameters. The joint conditional probability therefore favors cluster 1, without implying certainty or a causal relationship. This decomposition is useful for interpretation, but it inherits the model's feature-independence and equal-variance assumptions.

From Conditional Probabilities to Posterior Assignments

In a full fit, parameters are unknown. If \(M\) retained, label-aligned posterior draws are available, a posterior assignment probability can be estimated by the fraction of draws assigning sample \(i\) to cluster \(k\):

$$ \widehat{P}(z_i=k\mid X,Y) = \frac{1}{M}\sum_{m=1}^{M} I(z_i^{(m)}=k), $$

where \(I(\cdot)\) is 1 when its argument is true and 0 otherwise. Each draw reflects uncertainty in labels and parameters jointly. The most probable cluster may be reported as a concise summary, but the probability itself should accompany it when uncertainty is meaningful.

Worked Example: Summarizing Posterior Draws

Suppose a hypothetical, converged, label-aligned run retains \(M=2{,}000\) draws. Sample B is assigned to cluster 2 in 1,558 draws and to cluster 1 in 442 draws. Its estimated posterior assignment probabilities are

$$ \widehat{P}(z_B=2\mid X,Y)=\frac{1558}{2000}=0.779, \qquad \widehat{P}(z_B=1\mid X,Y)=\frac{442}{2000}=0.221. $$

The estimated probability difference is \(0.779-0.221=0.558\), so cluster 2 is the modal assignment, with appreciable remaining uncertainty. The value 0.779 is a Monte Carlo estimate of a posterior probability, not a frequentist confidence level. It can vary with finite simulation, so convergence and Monte Carlo precision must be assessed before treating small differences as meaningful.

Checks, Alternatives, and Limits

A credible analysis checks both the computation and the adequacy of the model. The earlier material on convergence diagnostics for clustered omics chains provides tools for assessing mixing and Monte Carlo stability. For this application, inspect trace behavior for cluster proportions and representative means, compare assignment summaries across chains after label alignment, and examine whether small clusters or near-empty clusters recur. Posterior predictive checks ask whether replicated data from the fitted model reproduce important features of the observed matched data.

For example, compare observed and replicated within-cluster feature spreads, RNA-protein discordance, and marginal distributions for each feature. If replicated data systematically show less cross-modality disagreement than the observed data, the conditional-independence/shared-label specification may be too restrictive. Strong within-modality correlations can also make a product of independent feature likelihoods overstate the amount of evidence. A useful check is to compare residual correlations within inferred clusters with those in posterior predictive replicates.

The shared-label model is attractive when the scientific target is one joint partition. Separate modality-specific clustering allows different partitions and can reveal that no single grouping is supported across layers; it does not directly answer the same shared-cluster question. A model that explicitly represents cross-modal dependence can be more flexible, but requires additional parameters and stronger data support. Model choice should follow the scientific target and the observed fit, not a presumption that integration is always preferable.

Important limitations remain. The number \(K\) is fixed in this specification; choosing it requires separate model assessment. Gaussian feature distributions may be poor for counts, heavy-tailed measurements, or outliers. Standardizing features does not remove batch effects, dependence, or errors in sample matching. Finally, a shared label forces a common grouping even when RNA and protein genuinely indicate different structures. Posterior probabilities quantify uncertainty within the chosen model; they do not measure uncertainty about every possible modeling assumption.

Key takeaway: A joint assignment combines the prior cluster weight with both modality likelihoods, while posterior assignment probabilities average label uncertainty over the fitted model's posterior. Report the assumptions, uncertainty, and predictive checks alongside the most probable cluster.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. Under the two-cluster, unit-variance model, a sample has four feature values that sum to \(0.5\). What are its conditional log odds for cluster 2 versus cluster 1, and its conditional probability of cluster 2?
  2. A sample has posterior assignment probabilities 0.52 for cluster 1 and 0.48 for cluster 2. Why is reporting only its modal cluster potentially misleading?
  3. Why does a shared-cluster model not imply that RNA and protein features have the same cluster means?
  4. What does a posterior predictive check assess, and name one data feature that could be checked in this setting.

Solutions. 1. The log odds are \(1.6(0.5)=0.8\). Thus \(P(z_i=2\mid x_i,y_i,\theta)=\exp(0.8)/(1+\exp(0.8))\approx0.690\). 2. Cluster 1 is only slightly more probable; the 0.52 probability indicates substantial assignment uncertainty, hidden by a hard label alone. 3. The shared label represents one sample-level grouping, while the model has separate modality-specific means \(\mu^{(R)}_{kj}\) and \(\mu^{(P)}_{k\ell}\). 4. It assesses whether data replicated from the fitted posterior predictive distribution resemble relevant aspects of the observed data; for example, one can compare within-cluster feature spreads or RNA-protein discordance.

Clinical Biostats