Skip to main content
Papyrus logo

📜 Papyrus-scripts

PyPI version Supported Python versions License: MIT Tests Ruff DOI

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 gpu extra pins cupy-cuda12x[ctk], whose ctk extra 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

💡 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

🖋️ 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

papyrus_scripts-3.0.1.tar.gz (247.1 kB view details)

Uploaded Source

Built Distribution

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

papyrus_scripts-3.0.1-py3-none-any.whl (148.9 kB view details)

Uploaded Python 3

File details

Details for the file papyrus_scripts-3.0.1.tar.gz.

File metadata

  • Download URL: papyrus_scripts-3.0.1.tar.gz
  • Upload date:
  • Size: 247.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for papyrus_scripts-3.0.1.tar.gz
Algorithm Hash digest
SHA256 00b7443f785adf0d7f4d35df89664b1530582a9867d1d9932e9e5ae07fc8b252
MD5 fa37b76b24f6b0f6f8e65238bb565055
BLAKE2b-256 aaa36b4f8a1897850a8bc488e6130544bb48215aa366acfde6f19440733e2819

See more details on using hashes here.

File details

Details for the file papyrus_scripts-3.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for papyrus_scripts-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a42bf6d5fb3ed5e3d48403d96b77c027235bd90da9c95d4f8d27f6ea34fea154
MD5 6b0bec366971fe032613b60982f751bc
BLAKE2b-256 f4a7ce2e0d5bff02fe6b548135c0d6f2d6e842349b2e9f8834731dfa110e5619

See more details on using hashes here.

Release history Release notifications | RSS feed

3.0.2

2 files

This release

3.0.1 This release

2 files

3.0.0

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.0.post1

2 files

2.0.0

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page