Skip to main content

⬢⬢⬢ schemist

Python package PyPI Python versions Documentation Open in Spaces

schemist is a Python toolkit for cleaning, converting, featurizing, and organizing chemical datasets.

Built around RDKit and pandas, it provides composable command-line utilities and a Python API for cheminformatics workflows, including molecular descriptors, fingerprints, chemical library management, peptide enumeration, and structure-aware dataset splitting.

Contents

Quick start

Install the package:

pip install schemist

Suppose compounds.csv contains a column named smiles:

compound_id,smiles
1,CCO
2,CC(=O)O
3,c1ccccc1

Standardize the structures, calculate molecular descriptors, and assign a reproducible scaffold-based train/test split:

schemist clean compounds.csv \
  | schemist featurize --feature 2d \
  | schemist split --type scaffold --train 0.8 --test 0.2 \
  > processed.tsv

The resulting table contains the original compound information, normalized SMILES, molecular descriptors, and dataset assignments.

Commands can be chained through standard Unix pipes or used independently.

For 3D descriptors, generate multiple conformers per compound:

schemist featurize compounds.csv \
  --feature 3d \
  --minimize \
  --threads 4 \
  --output descriptors.csv

This uses RDKit conformer embedding, optional MMFF94 minimization, and aggregation of 3D descriptors across conformers.

Installation

From PyPI

pip install schemist

Development version

git clone https://github.com/scbirlab/schemist.git
cd schemist
git checkout dev
pip install -e ".[dev]"

The development branch targets modern RDKit releases and Python 3.11+.

Command-line interface

schemist --help
schemist <command> --help
Command Description
clean Sanitize and canonicalize chemical structures
convert Convert structures between molecular representations
featurize Generate 2D descriptors, 3D descriptors, or fingerprints
split Create random or scaffold-based dataset splits
collate Merge heterogeneous chemical libraries using a catalog
dedup Identify and collapse duplicate structures
enumerate Enumerate or sample peptide sequences
react Apply predefined chemical reactions

Cleaning and conversion

Canonicalize SMILES:

schemist clean compounds.csv -o cleaned.csv

Convert SMILES to alternative representations:

schemist convert compounds.csv \
  --to smiles inchikey scaffold selfies \
  -o converted.csv

Supported input representations include:

  • SMILES
  • SELFIES
  • InChI
  • Amino-acid sequences (aa_seq)
  • HELM and mini-HELM peptide notation

Available output representations include canonical and randomized SMILES, SELFIES, InChI, InChIKey, Murcko scaffolds, molecular hashes, mnemonic identifiers, and generated compound IDs.

The converter also supports physicochemical properties such as molecular weight, cLogP, TPSA, and partial-charge extrema, as well as compound-name and identifier lookups through PubChem and the NCI Chemical Identifier Resolver.

Molecular features

The featurize command provides three feature families:

Feature Flag Description
2D descriptors --feature 2d RDKit descriptors via descriptastorus
3D descriptors --feature 3d RDKit shape and geometry descriptors
Fingerprints --feature fp Morgan circular fingerprints

2D descriptors

schemist featurize compounds.csv \
  --feature 2d \
  -o features-2d.csv

Morgan fingerprints

schemist featurize compounds.csv \
  --feature fp \
  -o fingerprints.csv

3D descriptors

schemist featurize compounds.csv \
  --feature 3d \
  --conformers 20 \
  --minimize \
  --threads 4 \
  -o features-3d.csv

3D descriptors are calculated using RDKit ETKDGv4 conformer embedding. By default, each molecule gets clip(1 + rotatable bonds, 3, 10) conformers; near-duplicates (heavy-atom RMSD < 0.5 Å) are pruned and descriptor values are averaged over the survivors. Results are deterministic for a given seed, whatever the thread count.

Option Default Description
--conformers, -k auto Number of conformers per molecule, or auto
--max-conformers 10 Cap on conformers for --conformers auto
--prune-rms 0.5 RMSD (Å) for pruning near-duplicate conformers; <0 disables
--threads, -j 1 Parallel threads; 0 uses all available
--minimize Off Minimize conformers using MMFF94
--std, -z Off Also output the population standard deviation of each descriptor across conformers

The --zscore option requires multiple conformers to have an effect. It is an experimental normalization option and should be used cautiously for descriptors with little or no conformational variance.

Feature tables include metadata identifying feature type and calculation validity.

Dataset splitting

Create reproducible random splits:

schemist split compounds.csv \
  --type random \
  --train 0.8 \
  --test 0.2 \
  --seed 42 \
  -o splits.csv

Create scaffold-disjoint splits:

schemist split compounds.csv \
  --type scaffold \
  --train 0.8 \
  --test 0.2 \
  -o scaffold-splits.csv

Two splitting strategies are available:

  • Random: assign compounds to partitions using random sampling.
  • Scaffold: group compounds by their Bemis–Murcko scaffolds before assigning partitions, reducing scaffold overlap between partitions.

The remaining fraction, if any, is assigned to validation.

Scaffold splitting requires global grouping of structures and can be slower for very large datasets.

Library collation and deduplication

Collate chemical libraries from multiple tabular or structure files using a catalog:

schemist collate inventory.csv \
  --data-dir libraries/ \
  -o combined.csv

The inventory specifies source files, their formats, structural representations, and column mappings.

Additional options support structure identifier generation and retention of unmapped columns.

Deduplicate a compound table:

schemist dedup compounds.csv \
  --column smiles \
  --indexes compound_id \
  -o unique.csv

Deduplication uses molecular identifiers to group structures, reports occurrence counts, and can retain collapsed references to the original records.

Peptides and reactions

Enumerate peptides of a specified length:

schemist enumerate \
  --max-length 5 \
  --number 1000 \
  --seed 42 \
  -o peptides.tsv

Enumeration supports length constraints, fixed sequence prefixes and suffixes, sampling, and D-amino acids.

Apply a predefined reaction to a table of molecular structures:

schemist react peptides.csv \
  --reaction N_to_C_cyclization \
  -o products.csv

The reaction engine uses RDKit reaction SMARTS. Currently, the predefined reaction set includes N-to-C cyclization.

Python API

The underlying functionality is available directly in Python.

Convert molecular representations

from schemist.converting import convert_string_representation

smiles = ["CCO", "CC(=O)O", "c1ccccc1"]

identifiers = convert_string_representation(
    smiles,
    output_representation=["smiles", "inchikey", "scaffold"],
)

Generate molecular descriptors

from schemist.features import (
    calculate_2d_features,
    calculate_3d_features,
    calculate_fingerprints,
)

smiles = ["CCO", "CC(=O)O", "c1ccccc1"]

descriptors_2d = calculate_2d_features(
    strings=smiles,
    return_dataframe=True,
)

descriptors_3d = calculate_3d_features(
    strings=smiles,
    n_conformers=10,
    minimize=True,
    n_threads=4,
    return_dataframe=True,
)

fingerprints = calculate_fingerprints(
    strings=smiles,
    return_dataframe=True,
)

For combined feature generation, use schemist.features.calculate_feature.

Generate 3D conformers

from schemist.conformers import embed_conformers

atomic_numbers, coordinates = embed_conformers("CCO", n_conformers=10, seed=42)
# int8 [9], float32 [10, 9, 3] (Å), hydrogens included

The SMILES is parsed as given, because conformers depend on atom order. Conformers are embedded with ETKDG and relaxed with MMFF94 (defaults: etkdg_version=3, no RMS pruning, max_iters=500). Invalid SMILES raise ValueError; failed conformer generation raises RuntimeError.

embed_mol_conformers is the underlying routine, on an RDKit Mol, and returns the molecule with its conformers. 3D descriptors (calculate_3d_features) use it too, with ETKDGv4 and RMS pruning. With minimize=True, molecules MMFF94 has no parameters for are invalid, rather than left unminimized.

The Python API also exposes functions for structure cleaning, dataset splitting, chemical library collation, peptide generation, and in-silico reactions.

Data handling

schemist is designed for processing tabular chemical datasets.

  • Input: CSV, TSV, Excel, and supported structured chemical-library files.
  • Output: Tabular results, with TSV written to standard output by default.
  • Streaming: Most CLI operations process data in chunks to limit memory consumption.
  • Composition: Standard input/output allows commands to be connected in shell pipelines.
  • Error handling: Invalid or unprocessable structures are tracked, with validity indicators or error counts where supported.

Operations requiring global information, such as structure deduplication and scaffold grouping, may require additional memory or intermediate storage.

Documentation

License

MIT License. See LICENSE.

Metadata

Release files for schemist 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for schemist 0.1.4
File Size Uploaded Provenance Actions
schemist-0.1.4.tar.gz 44.8 kB Without provenance Details for schemist-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for schemist 0.1.4
File Interpreter ABI Platform Actions
schemist-0.1.4-py3-none-any.whl Python 3 none any Details for schemist-0.1.4-py3-none-any.whl

Total release size: 90.5 kB

Release files / schemist-0.1.4.tar.gz

Download URL schemist-0.1.4.tar.gz
Size 44.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0545eda9b17a55226cc7bd0c221664b81f56e8f0f67c38e1bb036b234d386801
BLAKE2b-256 checksum
How to use checksums
d31f1a36da2f8eaf45bc091ac57c79058594aab4d4865a0d6dcafd645d198bf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / schemist-0.1.4-py3-none-any.whl

Download URL schemist-0.1.4-py3-none-any.whl
Size 45.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3613da4e6b5247a8856c6229b6af8ad6102bc2acf93666a58e9adaa8e517b26b
BLAKE2b-256 checksum
How to use checksums
d0ff18d5868cedb5dc48ce98e03c26452c883243479bb751fb02941daabd9553
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for schemist 0.1.4

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.

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