Skip to content

Repository files navigation

pdchemchain

Chainable links for chemical processing of Pandas dataframes

pdchemchain is a framework for chainable pandas DataFrame manipulations, designed for interactive notebook use and command-line deployment. Built for chemistry via RDKit, but domain-agnostic at its core. All links are self-documenting, auto-configurable, and serializable to YAML/JSON.

Quick Start

from pdchemchain.links import MolFromSmiles, HeavyAtomCount, RDKitDescriptors
import pandas as pd

df = pd.DataFrame({"Smiles": ["c1ccccc1", "CCO", "CC(=O)O"]})

# Build a pipeline interactively
chain = MolFromSmiles() + HeavyAtomCount() + RDKitDescriptors(descriptors=["MolLogP", "TPSA"])
df_out = chain(df)

# Save for reuse from the command line
chain.to_config_file("pipeline.yaml")
pdchemchain run pipeline.yaml --in_file molecules.csv --out_file results.csv

Installation

From GitHub:

pip install git+https://github.com/EBjerrum/pdchemchain.git

Developer installation:

git clone git@github.com:EBjerrum/pdchemchain.git
cd pdchemchain
pip install -e .[dev]

Documentation

Command Line Usage

Saved pipelines run directly from the command line with CSV and SDF support:

# Process CSV
pdchemchain run pipeline.yaml --in_file input.csv --out_file output.csv

# Process SDF (auto-detected from extension)
pdchemchain run pipeline.yaml --in_file molecules.sdf --out_file results.sdf

# With error file for failed rows
pdchemchain run pipeline.yaml --in_file input.sdf --out_file output.sdf --error_file errors.sdf

See the CLI Reference for format detection, SDF handling, advanced options, and full option reference.

Contributions

See CONTRIBUTION.md for how to subclass Link/RowLink and create new links. The framework is designed for minimal boilerplate — a new link is typically 10-15 lines of code.

About

Rapid construction of chemical pipelines in interactive notebooks and cli usage

Resources

Stars

14 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages