A Python library for working with Papyrus, a large-scale curated dataset of bioactivity data aimed at machine learning applications. It handles downloading, versioning, and caching the dataset, and provides a fluent API to filter, search, and export exactly the subset you need — without ever loading the full dataset into memory.
✨ Features
- 🗂️ Versioned dataset access — download and cache specific Papyrus releases from Zenodo or 4TU, with automatic integrity checks.
- 🔗 Fluent filtering API — chain quality, source, organism, protein-class and molecular filters over a lazy Polars pipeline; only what you keep gets materialized.
- 🧬 Proteins, structures & descriptors — retrieve matching UniProt targets, 2D/3D compound structures, and precomputed molecular/protein descriptors in one call.
- 🔍 Similarity & substructure search — build an indexed FPSim2/RDKit search database over the dataset, with CPU, GPU (CUDA), or auto-fallback search engines.
- 🧠 DNN-ready — train PyTorch-based QSAR/PCM models on curated subsets, with y-scrambling and repeated seeds built in.
- 💻 CLI included — download, convert and clean up dataset files without writing any Python.
- 🔄 Format-friendly — transparent LZMA ↔ Gzip conversion and Parquet caching for tools that don't handle
.xz.
📦 Installation
pip install papyrus-scripts
⚠️ Troubleshooting pip installation
If you see Defaulting to user installation because normal site-packages is not writeable followed by import errors, reinstall with:
pip uninstall -y papyrus-scripts
python -m pip install papyrus-scripts
Optional extras enable additional functionality:
| Extra | Enables |
|---|---|
papyrus-scripts[subsim] |
CPU similarity & substructure search (tables, FPSim2) |
papyrus-scripts[gpu] |
GPU-accelerated similarity search (cupy-cuda12x[ctk], bundles the CUDA 12.x toolkit) |
papyrus-scripts[simgpu] |
CPU + GPU-accelerated similarity search (subsim + gpu) |
papyrus-scripts[dnn] |
DNN model training (torch, skorch) |
papyrus-scripts[all] |
Everything above |
Note:
openbabel(needed only for FP2/FP3/FP4 fingerprints) must be installed via conda-forge, not pip, when used alongside RDKit/FPSim2/cupy in the same environment:conda install -c conda-forge openbabel.Note: the
gpuextra pinscupy-cuda12x[ctk], whosectkextra pulls in the CUDA 12.x toolkit as a pip package — no separate toolkit install needed, only an NVIDIA driver compatible with CUDA 12.x.
🛠️ Requirements
- Python 3.11+
- RDKit
💡 Usage
Quickstart: the object-oriented API
The recommended way to interact with the dataset. It downloads and caches data automatically as needed.
from papyrus_scripts import PapyrusDataset
dataset = PapyrusDataset(version='2024.09.2', plusplus=True)
filtered = (dataset
.keep_source(['chembl', 'sharma'])
.keep_quality('high'))
df = filtered.to_dataframe()
proteins = filtered.proteins().to_dataframe()
Downloading data: the CLI
# Download Papyrus++ bioactivities & targets for the latest version
papyrus download -V latest
# Download the full (all-quality) dataset with all precomputed descriptors for a specific revision
papyrus download -V 2022.11.3 --more -d all
# Download Papyrus++ data & compound structures for two versions
papyrus download -V 2022.11.3 -V 2022.04.2 -S
papyrus download --help
By default, data is downloaded to pystow's home directory; override it with -o.
Legacy functional API
from papyrus_scripts import (read_papyrus, read_protein_set,
keep_quality, keep_source, consume_chunks)
chunks = read_papyrus(version='2024.09.2', plusplus=True, chunksize=1_000_000)
proteins = read_protein_set(version='2024.09.2')
filtered = keep_quality(keep_source(chunks, source=['chembl', 'sharma']), min_quality='high')
df = consume_chunks(filtered)
Similarity & substructure search
from papyrus_scripts.subsim_search import FPSubSim2
fpss = FPSubSim2()
fpss.create_from_papyrus(version='2024.09.2', njobs=-1) # builds a search database using all CPU cores
# cuda=False (default, CPU) | True (GPU, raises if unavailable) | 'auto' (GPU with CPU fallback)
engine = fpss.get_similarity_lib(cuda='auto')
hits = engine.similarity('CCO', threshold=0.7)
sub_lib = fpss.get_substructure_lib()
matches = sub_lib.substructure('c1ccccc1')
📊 Dataset versions
Papyrus releases are hosted on Zenodo:
| Papyrus version | Revisions | Legacy alias | ChEMBL version | Zenodo |
|---|---|---|---|---|
| 2022.04 | 2 | 05.4 | 29 | link |
| 2022.08 | 3 | 05.5 | 30 | link |
| 2022.11 | 4 | 05.6 | 31 | link |
| 2024.09 | 2 | 05.7 | 34 | link |
Note: for machine learning use cases, we recommend the datasets without stereochemistry (files marked "2D" and/or "without_stereochemistry").
⚙️ Advanced utilities
Compression conversion
Data is distributed as LZMA-compressed files (.xz), which some tools (e.g. Pipeline Pilot) don't support. Convert to Gzip (or back) without manually decompressing:
papyrus convert -v latest
Removing downloaded data
papyrus clean --remove_root
from papyrus_scripts import remove_papyrus
remove_papyrus(papyrus_root=True)
📚 Learn more
simple_examples.ipynbmatchRCSB.ipynb— matching Papyrus data against the Protein Data Bankadvanced_querying.ipynb- To reproduce the models, extraction pipeline and visualizations from the original publication, see Papyrus-modelling.
🖋️ Citation
If you use papyrus-scripts or the Papyrus dataset in your research, please cite:
@article{Bequignon2023Papyrus,
title={Papyrus - A large scale curated dataset aimed at bioactivity predictions},
author={B{\'e}quignon, Olivier J.M. and Bongers, Bart J. and Jespers, Willem and IJzerman, Adriaan P. and van de Water, Bob and van Westen, Gerard J.P.},
journal={Journal of Cheminformatics},
volume={15},
number={3},
year={2023},
doi={10.1186/s13321-022-00672-x}
}
📄 License
This project is licensed under the MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file papyrus_scripts-3.0.0.tar.gz.
File metadata
- Download URL: papyrus_scripts-3.0.0.tar.gz
- Upload date:
- Size: 245.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6526b5210b158425e636c8eadccfb9a5d27a26a65498a63f9aad0f523670dc93
|
|
| MD5 |
e8f54787dd910a02b0c6465c2ca91475
|
|
| BLAKE2b-256 |
6ce199006ddec9abd44d8dfb581e2ddf9d25e309c9e55c916487936a1c56f04b
|
File details
Details for the file papyrus_scripts-3.0.0-py3-none-any.whl.
File metadata
- Download URL: papyrus_scripts-3.0.0-py3-none-any.whl
- Upload date:
- Size: 148.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ddbfdbf0190a30832dbad671c777b2fbf035906b05a84797d693a9c5042284b
|
|
| MD5 |
08084e566b7a09fd7804567042eda885
|
|
| BLAKE2b-256 |
00e4e6f7412accd0bca62641f7e0d68b7c6e03bbccfe19bfa9b5e231f47757f7
|