---
title: Connectivity Score (CS) Overview
url: https://www.emergentmind.com/topics/connection-score-cs
type: topic
---

# Connectivity Score (CS) Overview

The Connectivity Score (CS) is a quantitative metric introduced by the original Connectivity Map 1.0 study to measure the reversal relationship between drug- and disease-induced gene expression profiles. Designed to operationalize the principle that a therapeutic agent should invert the molecular ‘signature’ of a disease, CS has served as a foundational methodology in computational drug repurposing, notably enabling the benchmarking and comparison of drugs’ potential efficacy by assessing the strength and directionality of their perturbational impact on disease-associated gene expression [2009.09317].

## 1. Preliminaries: Notation and Preprocessing

CS is defined within a gene expression perturbation framework. The following notation, as unified by Samart et al., underpins its computation:

- $R = \{ g_1, \ldots, g_{N_R} \}$: set of all genes measured under a drug perturbation, each with differential expression $v_\text{drg}(g_i)\in\mathbb{R}$.
- $S = \{ g_1, ..., g_{N_S} \}$: set of all genes measured for the disease perturbation, with differential expression $v_\text{dis}(g_i)$.
- $S^{+} \subseteq S$ and $S^{-} \subseteq S$: sets of most significantly up- and down-regulated disease genes, respectively, defined via thresholds (e.g., by $|v_\text{dis}|$, $p$-value, or top-$k$ selection).
- $R$ is typically the full ranked list of drug genes for CS; no restriction to “extreme” genes is used.
- $T_\text{drg}(g_i) \in \{1, ..., N_R\}$: the rank of gene $g_i$ in $R$, ordered by decreasing $v_\text{drg}$ (most positive to most negative).

Preprocessing steps:
  a) Compute $v_\text{dis}$ and $v_\text{drg}$ using standard tools (e.g., limma, DESeq2).
  b) Define $S^{+}$ and $S^{-}$.
  c) Rank all drug genes $R$ by $v_\text{drg}$.
  d) For each disease gene set $S_\times \in \{ S^{+}, S^{-} \}$, compute enrichment scores as below.

## 2. Enrichment Score Computation

The CS relies on the (one-sample) Kolmogorov–Smirnov (KS) statistic adapted as an enrichment score (ES):

For a gene set $S_x$ with $|S_x|=N_{S_x}$ in a ranked drug gene list $R$:
- $P_\text{hit}(i) = \dfrac{\# \text{ of } S_x \text{ genes in top } i \text{ of } R}{N_{S_x}}$
- $P_\text{miss}(i) = \dfrac{\# \text{ of non-}S_x \text{ genes in top } i \text{ of } R}{N_R-N_{S_x}}$
- $e_i = P_\text{hit}(i) - P_\text{miss}(i)$

The enrichment score is defined as:
$$
ES(S_x, R) = \max_i [e_i]
$$
This produces $ES(S_x, R) \in [-1, +1]$, where positive values indicate enrichment at the top of $R$, negative at the bottom.

## 3. Connectivity Score Derivation

Given $ES_\text{up} = ES(S^{+}, R)$ and $ES_\text{down} = ES(S^{-}, R)$, the raw connectivity score is defined as:

$$
cs = 
\begin{cases}
10 \; [ES_\text{up} - ES_\text{down}], & \text{if } \operatorname{sign}(ES_\text{up}) \neq \operatorname{sign}(ES_\text{down}) \\
0, & \text{otherwise}
\end{cases}
$$

For each drug, typically multiple instances (e.g., varying cell lines, doses, timepoints) will yield a set $\{cs_t\}_{t=1}^{N_a}$. These raw scores are normalized per drug:

$$
CS_t = 
\begin{cases}
\frac{cs_t}{\max_u(cs_u)}, & \text{if } cs_t>0 \\
-\frac{cs_t}{\min_u(cs_u)}, & \text{if } cs_t<0 \\
0, & \text{otherwise}
\end{cases}
$$

Here, $\max_u(cs_u)>0$ and $\min_u(cs_u)<0$ are taken over all instances $u$ for that drug. This normalization yields $CS_t \in [-1, +1]$ for each instance, with most negative $CS_t$ representing strongest reversal.

## 4. Relationship to Alternative Connectivity Metrics

CS is part of a broader ecosystem of metrics for disease-drug connectivity, with distinct properties:

| Metric  | Definition / Key Differences | Notes |
|---------|-----------------------------|-------|
| CS      | Uses unweighted ES, zeroes non-opposite-sign cases, normalizes per drug | Operates strictly on ranking |
| RGES    | $|ES_\text{up}| - |ES_\text{down}|$; does not zero same-sign ES or require reversal | Sign loses direct reversal meaning |
| NCS/WCS | Uses weighted (GSEA) KS; normalizes across background | More sensitive to magnitude |
| τ       | Signed percentile rank of NCS vs. all drugs | Database-dependent |

CS requires reversal (opposite signs for $ES_\text{up}$, $ES_\text{down}$); RGES does not, impacting direct interpretability for therapeutic inversion. NCS and τ utilize magnitude weighting and broader normalization, and pairwise metrics (e.g., CSS, Cosine, EWCos) operate directly on both drug and disease expression vectors’ magnitudes [2009.09317].

## 5. Algorithmic Workflow for CS Computation

A high-level pseudocode specification for computing CS (for a single drug instance) is as follows:

```python
# Inputs: 
#   disease logFC vector v_dis[g], 
#   drug logFC vector v_drg[g], 
#   thresholds or top-k for S_plus, S_minus

# Step 1: Define S_plus, S_minus
S_plus = { g : v_dis[g] ≥ θ_up }
S_minus = { g : v_dis[g] ≤ θ_down }

# Step 2: Rank genes by descending v_drg to obtain list R

# Step 3: Function ES(Sx, R)
def ES(Sx, R):
    N_Sx = len(Sx)
    N_R = len(R)
    hit = 0
    miss = 0
    best_dev = 0
    for i in range(1, N_R+1):
        if R[i] in Sx:
            hit += 1
        else:
            miss += 1
        P_hit  = hit  / N_Sx
        P_miss = miss / (N_R - N_Sx)
        dev = P_hit - P_miss
        best_dev = max(best_dev, abs(dev)) * sign(dev)
    return best_dev

# Step 4: Compute ES_up = ES(S_plus, R); ES_down = ES(S_minus, R)
# Step 5: Compute cs
if sign(ES_up) != sign(ES_down):
    cs = 10 * (ES_up - ES_down)
else:
    cs = 0

# Step 6: Normalize cs across all instances of drug to get CS in [-1, 1]
```

## 6. Properties, Use Cases, and Limitations

**Advantages:**
- Directly encodes the conceptual reversal sought in computational drug repurposing.
- Rank-based; robust to outlier expression and cross-platform differences.
- Normalized per drug to the $[-1,+1]$ interval, with negative values indicating reversal.

**Limitations:**
- Utilizes only drug gene ranking (not magnitude), discarding instance data where $ES_\text{up}$ and $ES_\text{down}$ share sign, thus ignoring partial or one-sided enrichment.
- Does not use disease signature magnitudes; loss of granularity in differential expression.

**Recommended Contexts:**
- High-quality ranked drug references (e.g., original CMap microarrays).
- Scenarios requiring cross-platform or cross-lab comparability via rank-based metrics.
- Reproducibility of CMap 1.0 studies and benchmarks.

**Alternatives:**
- RGES: Retains partial enrichments, signs do not require reversal—negatively correlated with $IC_{50}$.
- NCS and τ: Incorporate magnitude weighting and normalization across cell lines and backgrounds.
- Pairwise magnitude-based metrics (CSS, Cosine, etc.): Typically outperform ES-derived metrics in large-scale benchmarks.

## 7. Context and Comparative Significance

CS, as originally codified in Connectivity Map 1.0 and rigorously reconciled by Samart et al., establishes a standardized procedure for quantifying drug-disease signature reversal using only gene ranks. Its continued relevance includes use as a benchmark for comparing the behavior of new connectivity metrics and as a baseline for evaluating advances in magnitude- and direction-aware similarity approaches in drug repurposing. A plausible implication is that CS is most informative where reversal is expected to be strong and differential expression magnitudes are less reliable or comparable across datasets [2009.09317].

Source: https://www.emergentmind.com/topics/connection-score-cs