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.

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 cu130 for 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

💡 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.2.tar.gz (251.0 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.2-py3-none-any.whl (150.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: papyrus_scripts-3.0.2.tar.gz
  • Upload date:
  • Size: 251.0 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.2.tar.gz
Algorithm Hash digest
SHA256 e5d2b42bc982620e34af92ef8b2948eab8362b0008bf0c77dc995c65a6a90820
MD5 528ecd5ffb93fce9040d000f03f60ce1
BLAKE2b-256 4100d60b0b4efc03a1bf5c6fc31c2d023610012f7d19868a71496ef14877298a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for papyrus_scripts-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 85c49484dc8396fd9a6ec29496b6a2bc3f8770684a960ffa3f6bc94960ba77dd
MD5 dc6b2dfd060a67a4a1af1bb4c328f0f1
BLAKE2b-256 0a335ab6673fef20166c6ccd6c88706d05da969f2bbdc88b44a3f700194de00c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.0.2 This release

2 files

3.0.1

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