Skip to main content

RLEC: RNA-Ligand Extended Connectivity Fingerprint

PyPI version Python versions PyPI downloads License: MIT GitHub stars

RLEC adapts the PLEC fingerprint (Wójcikowski et al., Bioinformatics 2019) to RNA-ligand systems. For each RNA-ligand contact pair, it pairs the Morgan-style chemical environments of the RNA atom and the ligand atom across increasing depths and hashes the pairs into a count vector. A companion physical interaction module provides 29 physics-based descriptors that complement the fingerprint.

Installation

pip install rlec

Quick start

RLEC Fingerprint

from rlec import RLECFingerprint

fp = RLECFingerprint(
    rna_depth=6,      # Morgan depth for RNA atoms
    ligand_depth=3,   # Morgan depth for ligand atoms
    fp_size=4096,     # folded vector size
    feat_set=1,       # 1 = include nucleotide type (A/U/G/C) in RNA hash
    cutoff=6.0,       # contact distance cutoff (Å)
)

vec = fp.transform("path/to/rna.pdb", "path/to/ligand.sdf")
# vec: np.ndarray shape (4096,), dtype float32

transform also accepts an RDKit Mol object as the second argument (must have a 3D conformer).

For a batch:

X = fp.transform_batch([
    ("rna1.pdb", "lig1.sdf"),
    ("rna2.pdb", "lig2.sdf"),
], n_jobs=-1)
# X: np.ndarray shape (n, 4096)

Physical Interaction Features

29 physics-based descriptors computed directly from the 3D complex:

from rlec import compute_physical_features, PHYSICAL_FEATURE_NAMES

phy = compute_physical_features("rna.pdb", "lig.sdf")
# phy: np.ndarray shape (29,), dtype float32
# Returns None if the PDB/SDF cannot be parsed

print(PHYSICAL_FEATURE_NAMES)  # list of 29 feature name strings

Features include: electrostatic energy (Gasteiger charges), H-bond count, hydrophobic contacts, ionic contacts (RNA phosphate ··· cationic ligand atom), π-stacking pairs, contact geometry statistics, and RDKit 2D ligand descriptors (MW, TPSA, HBD, HBA, rotatable bonds, rings).

For a batch:

from rlec import compute_physical_batch

P = compute_physical_batch([
    ("rna1.pdb", "lig1.sdf"),
    ("rna2.pdb", "lig2.sdf"),
], n_jobs=-1)
# P: np.ndarray shape (n, 29)

Combined descriptor (best for affinity prediction)

import numpy as np
from rlec import RLECFingerprint, compute_physical_features

fp  = RLECFingerprint()
vec = fp.transform("rna.pdb", "lig.sdf")           # (4096,)
phy = compute_physical_features("rna.pdb", "lig.sdf")  # (29,)
combined = np.concatenate([vec, phy])               # (4125,)

sklearn pipeline

from rlec import RLECTransformer
from sklearn.pipeline import Pipeline
from sklearn.ensemble import GradientBoostingRegressor

pipe = Pipeline([
    ("fp", RLECTransformer(feat_set=1, n_jobs=-1)),
    ("model", GradientBoostingRegressor()),
])
pipe.fit(train_complexes, y_train)

CLI

rlec info                             # show version, defaults, performance
rlec transform rna.pdb lig.sdf        # print fingerprint stats
rlec transform rna.pdb lig.sdf -o vec.npy   # save (4096,) vector
rlec physical  rna.pdb lig.sdf        # print all 29 physical features
rlec physical  rna.pdb lig.sdf -o feats.csv
rlec validate  rna.pdb lig.sdf        # inspect contacts, density
rlec batch data.csv --rna-col rna_path --lig-col lig_path -o feats.npz --n-jobs -1

Feature sets

feat_set RNA atom invariant
0 Basic ECFP (atomic num, charge, degree, aromaticity, ring)
1 + nucleotide type (A/U/G/C/T/modified) (recommended default)
2 + PBS group (Phosphate/Sugar/Base)
3 + nucleotide type + PBS group

Performance

Validated on 143 RNA-ligand complexes from PDBbind NL2020.

LOOCV (LightGBM), fingerprint quality:

Method LOOCV r
Ligand-only ECFP 0.562
RNA-only ECFP 0.594
Element-pair FP 0.578
RLEC feat1 0.710

95% bootstrap CI: [0.616, 0.790]. RLEC vs ligand-only: Δr = +0.148 (p < 0.0005).

10-split 80/20 benchmark (LightGBM), same protocol as RLaffinity and Xia et al.:

Method PCC SPCC RMSE MAE
AutoDock Vina -0.386 -0.389 0.277 0.257
RF-Score 0.445 0.364 0.152 0.129
RLaffinity 0.559 0.540 0.152 0.119
RLEC + Physical 0.584 0.558 0.143 0.115
RLASIF 0.666 0.601 0.147 0.112

RLEC + Physical (4125-D combined) outperforms RLaffinity on all four metrics.

Requirements

  • Python ≥ 3.9
  • numpy, scipy, biopython, rdkit, scikit-learn, pandas, tqdm, joblib

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rlec-0.3.3.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rlec-0.3.3-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file rlec-0.3.3.tar.gz.

File metadata

  • Download URL: rlec-0.3.3.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for rlec-0.3.3.tar.gz
Algorithm Hash digest
SHA256 58f531c190dd5a14fb47ce5be376a5c2f32e1367d3cf74e0ef93b4930021dec8
MD5 f1d8f40923c650473c4541ecc12eb201
BLAKE2b-256 d288610b6bceff02daaf218a77e1b69a8d97850ae760277b890ae03c6059668b

See more details on using hashes here.

File details

Details for the file rlec-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: rlec-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for rlec-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 57dc104550de23ee9401100b28f7a9923bc5c053ffd392d0d1701a39f6da15d1
MD5 57167e164efceda67622af745ed89844
BLAKE2b-256 a603e219a4b4755862494d8a28ccfe92e65e9b4f8eb3cdc39c4d2946f633b32c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page