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.Note: on Windows, plain
pip install papyrus-scripts[dnn]installs a CPU-only PyTorch build — CUDA-enabled Windows wheels aren't published on PyPI, only on PyTorch's own index. Get GPU support with:pip install papyrus-scripts[dnn] --extra-index-url https://download.pytorch.org/whl/cu130(swap
cu130for the CUDA tag matching your driver; see the PyTorch install matrix). On Linux, the plain PyPI wheel already bundles CUDA, so no extra index is needed there.
🛠️ 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.
Metadata
Release files for papyrus-scripts 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| papyrus_scripts-3.0.2.tar.gz | 251.0 kB | Without provenance | Details for papyrus_scripts-3.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| papyrus_scripts-3.0.2-py3-none-any.whl | Python 3 | none | any | Details for papyrus_scripts-3.0.2-py3-none-any.whl |
Total release size: 401.2 kB
Release files / papyrus_scripts-3.0.2.tar.gz
| Download URL | papyrus_scripts-3.0.2.tar.gz |
|---|---|
| Size | 251.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5d2b42bc982620e34af92ef8b2948eab8362b0008bf0c77dc995c65a6a90820
|
|
BLAKE2b-256 checksum How to use checksums |
4100d60b0b4efc03a1bf5c6fc31c2d023610012f7d19868a71496ef14877298a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / papyrus_scripts-3.0.2-py3-none-any.whl
| Download URL | papyrus_scripts-3.0.2-py3-none-any.whl |
|---|---|
| Size | 150.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85c49484dc8396fd9a6ec29496b6a2bc3f8770684a960ffa3f6bc94960ba77dd
|
|
BLAKE2b-256 checksum How to use checksums |
0a335ab6673fef20166c6ccd6c88706d05da969f2bbdc88b44a3f700194de00c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for papyrus-scripts 3.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.