
Medchem
Filter compound libraries with medchem RuleFilters and named Ro5-style rules inside Python or agent pipelines.
Overview
Medchem is an agent skill for the Build phase that documents medchem 2.0.5 RuleFilters and medicinal chemistry rule APIs for batch compound filtering.
Install
npx skills add https://github.com/k-dense-ai/scientific-agent-skills --skill medchemWhat is this skill?
- RuleFilters constructor with custom rule lists returning a pandas DataFrame with pass_all and pass_any
- 22 named rules via list_available_rules_names plus metadata via list_available_rules
- Parallel filtering with n_jobs, progress flags, and optional descriptor columns when keep_props=True
- Individual basic_rules functions including rule_of_five, rule_of_cns, and rule_of_five_beyond
- Official API alignment to medchem-docs.datamol.io stable reference
- 22 named rules via RuleFilters.list_available_rules_names()
- medchem version 2.0.5 documented
Adoption & trust: 513 installs on skills.sh; 27.6k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have molecule lists to gate for drug-likeness but lack an accurate, copy-paste medchem integration spec for your agent or API.
Who is it for?
Indie builders building compound libraries, screening CLIs, or scientific agents that must enforce Ro5-style and related medchem rules at scale.
Skip if: Non-chemistry products with no SMILES/RDKit pipeline, or teams that only need qualitative pharma market research.
When should I use this skill?
Implementing medchem batch filters, Lipinski or CNS rules, or debugging RuleFilters DataFrame columns in Python pipelines.
What do I get? / Deliverables
After the skill runs, your agent produces medchem RuleFilters and basic_rules calls that return correct DataFrame columns and boolean rule outcomes.
- RuleFilters integration code
- Per-rule basic_rules call patterns
- Filtered compound tables with pass_all/pass_any columns
Recommended Skills
Journey fit
Build is the primary shelf because the skill documents medchem library integration for product code, not investor-facing validation narratives. Integrations matches wiring medchem 2.0.5 APIs, parallel RuleFilters jobs, and per-rule functions into backends or batch agents.
How it compares
Cheminformatics library reference skill, not a clinical trial planner or generic pandas ETL template.
Common Questions / FAQ
Who is medchem for?
Solo builders and small teams implementing medicinal chemistry filters in Python agents, APIs, or offline screening jobs.
When should I use medchem?
Use it during Build when integrating RuleFilters or basic_rules; during Validate prototype when proving filter throughput on sample libraries.
Is medchem safe to install?
Skill content is API documentation; review the Security Audits panel on this page and vet medchem/datamol dependencies in your own supply chain before production use.
SKILL.md
READMESKILL.md - Medchem
# Medchem API Reference Reference for **medchem 2.0.5**. Official docs: https://medchem-docs.datamol.io/stable/api/ ## Module: medchem.rules ### Class: RuleFilters Filter molecules by multiple medicinal chemistry rules. Returns a **pandas DataFrame**. **Constructor:** ```python RuleFilters(rule_list: List[Union[str, Callable]], rule_list_names: Optional[List[str]] = None) ``` **Call signature:** ```python __call__( mols: Sequence[Union[str, Mol]], n_jobs: int = -1, progress: bool = False, progress_leave: bool = False, scheduler: str = "auto", keep_props: bool = False, fail_if_invalid: bool = True, ) -> pd.DataFrame ``` **Return columns:** `mol`, `pass_all`, `pass_any`, plus one boolean column per rule. With `keep_props=True`, descriptor columns (`mw`, `clogp`, `tpsa`, etc.) are included. **Class methods:** ```python RuleFilters.list_available_rules_names() # list of 22 rule names RuleFilters.list_available_rules() # rules with property metadata ``` **Example:** ```python rfilter = mc.rules.RuleFilters(rule_list=["rule_of_five", "rule_of_cns"]) df = rfilter(mols=mol_list, n_jobs=-1, progress=True) passing = df[df["pass_all"]] ``` ### Module: medchem.rules.basic_rules Individual rule functions for single molecules. Each returns `bool` (True = passes). | Function | Description | |----------|-------------| | `rule_of_five(mol)` | Lipinski Rule of Five | | `rule_of_five_beyond(mol)` | Beyond Ro5 (large binding sites) | | `rule_of_four(mol)` | Rule of Four | | `rule_of_three(mol)` | Fragment library Rule of Three | | `rule_of_three_extended(mol)` | Extended Ro3 | | `rule_of_two(mol)` | Rule of Two | | `rule_of_ghose(mol)` | Ghose filter | | `rule_of_veber(mol)` | Veber oral bioavailability | | `rule_of_reos(mol)` | REOS filter | | `rule_of_chemaxon_druglikeness(mol)` | ChemAxon drug-likeness | | `rule_of_egan(mol)` | Egan permeability | | `rule_of_pfizer_3_75(mol)` | Pfizer 3/75 filter | | `rule_of_gsk_4_400(mol)` | GSK 4/400 filter | | `rule_of_oprea(mol)` | Oprea lead-like | | `rule_of_xu(mol)` | Xu filter | | `rule_of_cns(mol)` | CNS drug-likeness | | `rule_of_respiratory(mol)` | Respiratory drug-likeness | | `rule_of_zinc(mol)` | ZINC-like | | `rule_of_leadlike_soft(mol)` | Soft lead-like | | `rule_of_druglike_soft(mol)` | Soft drug-like | | `rule_of_generative_design(mol)` | Generative design space | | `rule_of_generative_design_strict(mol)` | Strict generative design | ### Descriptor helpers ```python mc.rules.list_descriptors() # property names for query language ``` --- ## Module: medchem.structural ### Class: CommonAlertsFilters ChEMBL-derived structural alert filter sets (Glaxo, Dundee, BMS, etc.). ```python CommonAlertsFilters() ``` **Returns DataFrame columns:** `mol`, `pass_filter`, `status`, `reasons` - `status`: one of `"exclude"`, `"flag"`, `"annotations"`, `"ok"` - `pass_filter`: bool — True if compound passes **Methods:** ```python list_default_available_alerts() # DataFrame of alert definitions __call__(mols, n_jobs=-1, progress=False, ...) -> pd.DataFrame ``` ### Class: NIBRFilters Novartis screening-deck curation filters ([Schuffenhauer et al., J. Med. Chem. 2020](https://dx.doi.org/10.1021/acs.jmedchem.0c01332)). ```python NIBRFilters() ``` **Returns DataFrame columns:** `mol`, `pass_filter`, `status`, `severity`, `reasons`, `n_covalent_motif`, `special_mol` - `severity`: 0 = clean; 1–9 = flags; ≥10 = excluded by default ### Lilly demerits (optional) Requires `mamba install lilly-medchem-rules`. Access via: ```python mc.functional.lilly_demerit_filter(mols, max_demerits=160, n_jobs=-1) # or from medchem.structural.lilly_demerits import LillyDemeritsFilters ``` --- ## Module: medchem.functional High-level boolean-mask API. **True = passes** (no alert / passes all rules). | Function | Description | |----------|-------------| | `rules_filter(mols, rules, n_jobs=None, ...)` | Apply rule list | | `nibr_filter(mols, max_severity=10, n_jobs=N