RBPSpecificity

RBPSpecificity provides tools to calculate Specificity and Sensitivity metrics for RNA-binding proteins from enrichment data.

Installation

From GitHub (Development)

# Install pak if needed
if (!requireNamespace("pak", quietly = TRUE))
    install.packages("pak")

pak::pkg_install("S00NYI/RBPSpecificity")

From Bioconductor

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("RBPSpecificity")

Quick Start

library(RBPSpecificity)

# Prepare enrichment data (requires MOTIF and Score columns in [0, 1] range)
enrichment <- data.frame(
  MOTIF = c("UUUUU", "UUUUC", "UUUUG"),
  Score = c(0.95, 0.45, 0.40)
)

# Calculate Specificity
specificity_value <- returnSpecificity(enrichment)

# Calculate Sensitivity
sensitivity_value <- returnSensitivity(enrichment, output_type = "number")
sensitivity_matrix <- returnSensitivity(enrichment, output_type = "matrix")

# Visualize
plotSpecificity(enrichment)
plotSensitivity(enrichment)

Features

Available Functions

motifEnrichment

Main workflow function to calculate K-mer enrichment.

returnSpecificity

Calculate Specificity.

returnSensitivity

Calculate Sensitivity.

plotSpecificity

Visualize Specificity value on score distribution.

plotSensitivity

Visualize Sensitivity matrix.

Note: returnSpecificity(), returnSensitivity(), plotSpecificity(), and plotSensitivity() accept any data frame with MOTIF and Score columns. Pre-computed enrichment data from RBNS, RNACompete, or other sources can be used directly without running motifEnrichment(), as long as the input is formatted with the correct column names and Score values are normalized to a [0, 1] scale.

Enrichment Calculation

motifEnrichment() calculates k-mer enrichment from sequencing results such as peak files from CLIP experiments.

Motif Occurrence Models

From peak sequences, k-mer enrichment is calculated using one of two motif occurrence models via the method parameter:

ANR is sensitive to motif multiplicity and cooperative binding hotspots, whereas ZOOPS is robust to repetitive elements and compositional noise. Due to these differing statistical assumptions, ANR and ZOOPS rankings and significance scores are expected to diverge, particularly for motifs with high multiplicity or repetitive backgrounds.

Background Correction

To correct for motif, sequence, and nucleotide bias in the genomic background, motifEnrichment() also calculates background enrichment:

  1. Background regions are generated by locally shifting peak coordinates within a configurable distance range (default: ±500–1000 bp, set via bkg_min_dist and bkg_max_dist). This preserves local genomic and transcript context — if a peak is in a 3'UTR, the background is also in/near that 3'UTR, controlling for regional composition biases.

  2. The shifting process is repeated bkg_iter times (default: 100) and background k-mer counts are averaged across iterations for robust estimation.

  3. Background k-mer enrichment is calculated using the same model (ANR or ZOOPS) as the peak sequences.

  4. Background enrichment is subtracted from peak enrichment to produce the corrected enrichment score.

  5. Optionally, background sequences can be scrambled (scramble_bkg = TRUE, default: FALSE) to control for nucleotide composition while removing sequence-specific motif signals.

Output

The enrichment difference (target − background) is computed for each k-mer, then min-max normalized across all k-mers to [0, 1] to produce the Score column. This Score is the primary metric consumed by returnSpecificity() and returnSensitivity(). The output also includes log2FC and padj (BH-adjusted p-values) as supplementary columns.

Documentation

See the package vignette for detailed examples covering:

  1. Pre-computed enrichment data (e.g. RBNS or RNACompete)
  2. De novo enrichment from CLIP peaks
  3. Multi-RBP comparison
  4. Visualization options

For detailed usage, see Figure_Scripts folder in: https://github.com/S00NYI/BITS_Specificity

Related Packages

RBPSpecificity works alongside RBPEqBind, which simulates competitive RBP binding using equilibrium kinetics. Together, these packages enable:

Citation

If you use RBPSpecificity in your research, please cite:

Yi S, Singh SS, Ye X, Krishna R, Kothwela V, Jankowsky E, Luna JM. (2025). Inherent Specificity and Mutational Sensitivity as Quantitative Metrics for RBP Binding. bioRxiv. https://www.biorxiv.org/content/10.1101/2025.03.28.646018v4

AI Usage Disclosure

This package's Bioconductor review remediation, API refactoring, and test suite expansion were developed in collaboration with Google Antigravity. For the original R implementation of RBP specificity analysis, see Figure_Scripts folder in the BITS_Specificity repository.

Further Reading

  1. Kjosmoen, T. & Ryen, T. (2009). Exploring the Combinatorics of Motif Alignments. Semantic Scholar.

  2. Jayaram, N., Bhowmick, P., & Martin, A.C.R. (2021). Computational Methods for Identification of Regulatory Elements in Genomic Sequences. Methods in Molecular Biology.

  3. Oregon State University. Chapter 2: Sequence Motifs — Applied Bioinformatics.

  4. University of Wisconsin–Madison, BMI 776. Motif Modeling (Lecture Notes).