
RBPSpecificity provides tools to calculate Specificity and Sensitivity metrics for RNA-binding proteins from enrichment data.
# Install pak if needed
if (!requireNamespace("pak", quietly = TRUE))
install.packages("pak")
pak::pkg_install("S00NYI/RBPSpecificity")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("RBPSpecificity")
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)
motifEnrichmentMain workflow function to calculate K-mer enrichment.
c(five_prime, three_prime) indicating shifting of 5' and 3' ends. Positive extends, negative trims (default: c(0,0)).returnSpecificityCalculate Specificity.
motifEnrichment.returnSensitivityCalculate Sensitivity.
motifEnrichment.plotSpecificityVisualize Specificity value on score distribution.
motifEnrichment.plotSensitivityVisualize Sensitivity matrix.
motifEnrichment.Note:
returnSpecificity(),returnSensitivity(),plotSpecificity(), andplotSensitivity()accept any data frame withMOTIFandScorecolumns. Pre-computed enrichment data from RBNS, RNACompete, or other sources can be used directly without runningmotifEnrichment(), as long as the input is formatted with the correct column names andScorevalues are normalized to a [0, 1] scale.
motifEnrichment() calculates k-mer enrichment from sequencing results such as peak files from CLIP experiments.
From peak sequences, k-mer enrichment is calculated using one of two motif occurrence models via the method parameter:
ANR (Any Number of Repetitions) — Default. Counts every occurrence of a motif within each sequence, retaining multiplicity information. A sequence with 5× UGUGU contributes 5 to the UGUGU count. Enrichment significance is evaluated using a conditional binomial test on aggregate occurrence counts, under the assumption that occurrences are Poisson-distributed.
ZOOPS (Zero-or-One Occurrence Per Sequence) — Treats each sequence as a binary outcome: motif present (≥1 occurrence) or absent. A sequence with 5× UGUGU contributes the same as one with 1× UGUGU. Enrichment significance is evaluated using the cumulative hypergeometric distribution.
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.
To correct for motif, sequence, and nucleotide bias in the genomic background, motifEnrichment() also calculates background enrichment:
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.
The shifting process is repeated bkg_iter times (default: 100) and background k-mer counts are averaged across iterations for robust estimation.
Background k-mer enrichment is calculated using the same model (ANR or ZOOPS) as the peak sequences.
Background enrichment is subtracted from peak enrichment to produce the corrected enrichment score.
Optionally, background sequences can be scrambled (scramble_bkg = TRUE, default: FALSE) to control for nucleotide composition while removing sequence-specific motif signals.
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.
See the package vignette for detailed examples covering:
For detailed usage, see Figure_Scripts folder in: https://github.com/S00NYI/BITS_Specificity
RBPSpecificity works alongside RBPEqBind, which simulates competitive RBP binding using equilibrium kinetics. Together, these packages enable:
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
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.
Kjosmoen, T. & Ryen, T. (2009). Exploring the Combinatorics of Motif Alignments. Semantic Scholar.
Jayaram, N., Bhowmick, P., & Martin, A.C.R. (2021). Computational Methods for Identification of Regulatory Elements in Genomic Sequences. Methods in Molecular Biology.
Oregon State University. Chapter 2: Sequence Motifs — Applied Bioinformatics.
University of Wisconsin–Madison, BMI 776. Motif Modeling (Lecture Notes).