@pikaa-ai/pikaa 0.3.23 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/brand/orbit-logo-option4-whale.jpg +0 -0
- package/assets/brand/orbit-logo.jpg +0 -0
- package/assets/brand/orbit-logo.png +0 -0
- package/assets/brand/orbit-logo.svg +3 -0
- package/dist/cli.js +337 -162
- package/dist/index.js +1 -2
- package/package.json +1 -2
- package/skills/adaptyv/SKILL.md +0 -240
- package/skills/aeon/SKILL.md +0 -402
- package/skills/analytical-method-validation/SKILL.md +0 -299
- package/skills/anndata/SKILL.md +0 -431
- package/skills/arbor/SKILL.md +0 -152
- package/skills/arboreto/SKILL.md +0 -267
- package/skills/astropy/SKILL.md +0 -353
- package/skills/autoskill/SKILL.md +0 -233
- package/skills/benchling-integration/SKILL.md +0 -229
- package/skills/bgpt-paper-search/SKILL.md +0 -75
- package/skills/bids/SKILL.md +0 -237
- package/skills/biopython/SKILL.md +0 -472
- package/skills/bioservices/SKILL.md +0 -399
- package/skills/bulk-rnaseq/SKILL.md +0 -198
- package/skills/cellxgene-census/SKILL.md +0 -283
- package/skills/cirq/SKILL.md +0 -370
- package/skills/citation-management/SKILL.md +0 -329
- package/skills/clinical-decision-support/SKILL.md +0 -238
- package/skills/clinical-decision-support/references/README.md +0 -62
- package/skills/clinical-reports/SKILL.md +0 -248
- package/skills/clinical-reports/references/README.md +0 -34
- package/skills/cobrapy/SKILL.md +0 -496
- package/skills/consciousness-council/SKILL.md +0 -151
- package/skills/dask/SKILL.md +0 -482
- package/skills/database-lookup/SKILL.md +0 -386
- package/skills/datamol/SKILL.md +0 -200
- package/skills/deepchem/SKILL.md +0 -244
- package/skills/deepspot-m/SKILL.md +0 -175
- package/skills/deeptools/SKILL.md +0 -412
- package/skills/depmap/SKILL.md +0 -301
- package/skills/dhdna-profiler/SKILL.md +0 -184
- package/skills/diffdock/SKILL.md +0 -488
- package/skills/dnanexus-integration/SKILL.md +0 -325
- package/skills/docx/SKILL.md +0 -99
- package/skills/esm/SKILL.md +0 -334
- package/skills/etetoolkit/SKILL.md +0 -327
- package/skills/exa-search/SKILL.md +0 -102
- package/skills/executing-plans/SKILL.md +0 -14
- package/skills/experimental-design/SKILL.md +0 -234
- package/skills/exploratory-data-analysis/SKILL.md +0 -280
- package/skills/flowio/SKILL.md +0 -310
- package/skills/fluidsim/SKILL.md +0 -279
- package/skills/frontend-design/SKILL.md +0 -100
- package/skills/generate-image/SKILL.md +0 -304
- package/skills/geniml/SKILL.md +0 -310
- package/skills/genomic-coordinates/SKILL.md +0 -189
- package/skills/genomic-intelligence/SKILL.md +0 -243
- package/skills/geomaster/README.md +0 -105
- package/skills/geomaster/SKILL.md +0 -366
- package/skills/geopandas/SKILL.md +0 -250
- package/skills/get-available-resources/SKILL.md +0 -260
- package/skills/gget/SKILL.md +0 -153
- package/skills/ginkgo-cloud-lab/SKILL.md +0 -106
- package/skills/glycoengineering/SKILL.md +0 -339
- package/skills/gtars/SKILL.md +0 -282
- package/skills/guardian-rails/SKILL.md +0 -54
- package/skills/histolab/SKILL.md +0 -243
- package/skills/hugging-science/SKILL.md +0 -132
- package/skills/hypogenic/SKILL.md +0 -290
- package/skills/hypothesis-generation/SKILL.md +0 -264
- package/skills/imaging-data-commons/SKILL.md +0 -496
- package/skills/infographics/SKILL.md +0 -315
- package/skills/iso-standards-readiness/SKILL.md +0 -352
- package/skills/lab-hardware-cad/SKILL.md +0 -372
- package/skills/labarchive-integration/SKILL.md +0 -216
- package/skills/lamindb/SKILL.md +0 -408
- package/skills/latchbio-integration/SKILL.md +0 -227
- package/skills/latex-posters/SKILL.md +0 -369
- package/skills/latex-posters/references/README.md +0 -439
- package/skills/liteparse/SKILL.md +0 -295
- package/skills/literature-review/SKILL.md +0 -263
- package/skills/markdown-mermaid-writing/SKILL.md +0 -322
- package/skills/market-research-reports/SKILL.md +0 -337
- package/skills/markitdown/SKILL.md +0 -264
- package/skills/matchms/SKILL.md +0 -276
- package/skills/matlab/SKILL.md +0 -274
- package/skills/matplotlib/SKILL.md +0 -378
- package/skills/medchem/SKILL.md +0 -321
- package/skills/modal/SKILL.md +0 -468
- package/skills/molecular-dynamics/SKILL.md +0 -458
- package/skills/molfeat/SKILL.md +0 -348
- package/skills/ncats-arax/SKILL.md +0 -178
- package/skills/networkx/SKILL.md +0 -440
- package/skills/neurokit2/SKILL.md +0 -323
- package/skills/neuropixels-analysis/SKILL.md +0 -412
- package/skills/nextflow/SKILL.md +0 -195
- package/skills/omero-integration/SKILL.md +0 -222
- package/skills/onekgpd/SKILL.md +0 -371
- package/skills/ontology-term-resolution/SKILL.md +0 -147
- package/skills/open-notebook/SKILL.md +0 -297
- package/skills/openpiv/SKILL.md +0 -469
- package/skills/opentrons-integration/SKILL.md +0 -322
- package/skills/optimize-for-gpu/SKILL.md +0 -176
- package/skills/owasp-top10/SKILL.md +0 -48
- package/skills/pacsomatic/LICENSE +0 -21
- package/skills/pacsomatic/SKILL.md +0 -150
- package/skills/paper-lookup/SKILL.md +0 -263
- package/skills/paperclip/SKILL.md +0 -413
- package/skills/paperzilla/SKILL.md +0 -159
- package/skills/parallel-web/SKILL.md +0 -128
- package/skills/pathml/SKILL.md +0 -222
- package/skills/pathogen-variant-surveillance/SKILL.md +0 -208
- package/skills/pathway-enrichment/SKILL.md +0 -194
- package/skills/pdf/SKILL.md +0 -322
- package/skills/peer-review/SKILL.md +0 -288
- package/skills/penetration-testing/SKILL.md +0 -31
- package/skills/pennylane/SKILL.md +0 -240
- package/skills/phylogenetics/SKILL.md +0 -409
- package/skills/pi-agent/SKILL.md +0 -83
- package/skills/pkpd-modeling/SKILL.md +0 -381
- package/skills/polars/SKILL.md +0 -393
- package/skills/polars-bio/SKILL.md +0 -379
- package/skills/ponytail/SKILL.md +0 -31
- package/skills/ponytail-audit/SKILL.md +0 -18
- package/skills/pptx/SKILL.md +0 -246
- package/skills/pptx-posters/SKILL.md +0 -258
- package/skills/primekg/SKILL.md +0 -99
- package/skills/protocolsio-integration/SKILL.md +0 -236
- package/skills/pufferlib/SKILL.md +0 -328
- package/skills/pydeseq2/SKILL.md +0 -369
- package/skills/pydicom/SKILL.md +0 -381
- package/skills/pyhealth/SKILL.md +0 -124
- package/skills/pylabrobot/SKILL.md +0 -216
- package/skills/pymatgen/SKILL.md +0 -404
- package/skills/pymc/SKILL.md +0 -310
- package/skills/pymoo/SKILL.md +0 -276
- package/skills/pyopenms/SKILL.md +0 -179
- package/skills/pysam/SKILL.md +0 -330
- package/skills/pytdc/SKILL.md +0 -297
- package/skills/pytorch-lightning/SKILL.md +0 -191
- package/skills/pyzotero/SKILL.md +0 -137
- package/skills/qiskit/SKILL.md +0 -259
- package/skills/qutip/SKILL.md +0 -317
- package/skills/rdkit/SKILL.md +0 -94
- package/skills/relsa-severity-assessment/SKILL.md +0 -354
- package/skills/research-grants/SKILL.md +0 -296
- package/skills/research-grants/references/README.md +0 -287
- package/skills/research-lookup/README.md +0 -106
- package/skills/research-lookup/SKILL.md +0 -338
- package/skills/rowan/SKILL.md +0 -398
- package/skills/scanpy/SKILL.md +0 -303
- package/skills/scholar-evaluation/SKILL.md +0 -296
- package/skills/scientific-brainstorming/SKILL.md +0 -282
- package/skills/scientific-critical-thinking/SKILL.md +0 -180
- package/skills/scientific-schematics/SKILL.md +0 -370
- package/skills/scientific-slides/SKILL.md +0 -379
- package/skills/scientific-visualization/SKILL.md +0 -285
- package/skills/scientific-writing/SKILL.md +0 -356
- package/skills/scikit-bio/SKILL.md +0 -470
- package/skills/scikit-learn/SKILL.md +0 -324
- package/skills/scikit-survival/SKILL.md +0 -313
- package/skills/scvelo/SKILL.md +0 -328
- package/skills/scvi-tools/SKILL.md +0 -201
- package/skills/seaborn/SKILL.md +0 -254
- package/skills/security-auditor/SKILL.md +0 -37
- package/skills/shap/SKILL.md +0 -282
- package/skills/simpy/SKILL.md +0 -283
- package/skills/stable-baselines3/SKILL.md +0 -325
- package/skills/statistical-analysis/SKILL.md +0 -446
- package/skills/statistical-power/SKILL.md +0 -200
- package/skills/statsmodels/SKILL.md +0 -238
- package/skills/sympy/SKILL.md +0 -354
- package/skills/systematic-debugging/SKILL.md +0 -35
- package/skills/tamarind/SKILL.md +0 -285
- package/skills/tdd/SKILL.md +0 -26
- package/skills/tiledbvcf/SKILL.md +0 -456
- package/skills/timesfm-forecasting/SKILL.md +0 -408
- package/skills/timesfm-forecasting/examples/global-temperature/README.md +0 -178
- package/skills/torch-geometric/SKILL.md +0 -458
- package/skills/torchdrug/SKILL.md +0 -241
- package/skills/transformers/SKILL.md +0 -195
- package/skills/treatment-plans/SKILL.md +0 -174
- package/skills/treatment-plans/references/README.md +0 -19
- package/skills/umap-learn/SKILL.md +0 -488
- package/skills/uncertainty-and-units/SKILL.md +0 -384
- package/skills/usfiscaldata/SKILL.md +0 -171
- package/skills/vaex/SKILL.md +0 -204
- package/skills/venue-templates/SKILL.md +0 -269
- package/skills/verification-before-completion/SKILL.md +0 -22
- package/skills/waypoint-bio/SKILL.md +0 -273
- package/skills/what-if-oracle/SKILL.md +0 -184
- package/skills/writing-plans/SKILL.md +0 -15
- package/skills/xlsx/SKILL.md +0 -110
- package/skills/zarr-python/SKILL.md +0 -241
package/skills/medchem/SKILL.md
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: medchem
|
|
3
|
-
description: Medicinal chemistry filters for compound triage. Apply drug-likeness rules (Lipinski, Veber, CNS), structural alert catalogs (PAINS, NIBR, ChEMBL), complexity metrics, and the medchem query language for library filtering.
|
|
4
|
-
license: Apache-2.0 license
|
|
5
|
-
allowed-tools: Read Write Edit Bash
|
|
6
|
-
compatibility: Requires Python 3.9+ and datamol (installed with medchem). Optional Lilly demerit filter requires separate `lilly-medchem-rules` conda package.
|
|
7
|
-
metadata:
|
|
8
|
-
version: "1.1"
|
|
9
|
-
skill-author: K-Dense Inc.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Medchem
|
|
13
|
-
|
|
14
|
-
## Overview
|
|
15
|
-
|
|
16
|
-
Medchem is a Python library from [datamol-io](https://github.com/datamol-io/medchem) for molecular filtering and prioritization in drug discovery. Apply literature-derived drug-likeness rules, named alert catalogs, complexity thresholds, chemical-group detection, and a custom query language to triage compound libraries at scale. Filters are context-specific guidelines — combine with domain expertise and target knowledge.
|
|
17
|
-
|
|
18
|
-
**Version note:** Examples target **medchem 2.0.5** (PyPI stable, Nov 2024). Requires **Python ≥3.9**. Depends on **datamol** and **RDKit** (installed automatically). `RuleFilters` and structural filter classes return **pandas DataFrames**. Lilly demerits require optional native binaries (`mamba install lilly-medchem-rules`).
|
|
19
|
-
|
|
20
|
-
## When to Use This Skill
|
|
21
|
-
|
|
22
|
-
This skill should be used when:
|
|
23
|
-
- Applying drug-likeness rules (Lipinski, Veber, CNS, lead-like) to compound libraries
|
|
24
|
-
- Filtering molecules by structural alerts, PAINS, or NIBR screening-deck rules
|
|
25
|
-
- Prioritizing compounds for hit-to-lead or lead optimization
|
|
26
|
-
- Calculating complexity metrics against ZINC-derived thresholds
|
|
27
|
-
- Detecting functional groups or named substructure catalogs
|
|
28
|
-
- Building multi-criteria filters with the medchem query language
|
|
29
|
-
|
|
30
|
-
## Installation
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
uv pip install medchem datamol
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Optional — Eli Lilly demerit filter (requires conda-forge native binaries):
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
mamba install -c conda-forge lilly-medchem-rules
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Core Capabilities
|
|
43
|
-
|
|
44
|
-
### 1. Medicinal Chemistry Rules
|
|
45
|
-
|
|
46
|
-
Apply established drug-likeness rules via `medchem.rules`.
|
|
47
|
-
|
|
48
|
-
**List available rules:**
|
|
49
|
-
|
|
50
|
-
```python
|
|
51
|
-
import medchem as mc
|
|
52
|
-
|
|
53
|
-
mc.rules.RuleFilters.list_available_rules_names()
|
|
54
|
-
# ['rule_of_five', 'rule_of_five_beyond', 'rule_of_four', 'rule_of_three', ...]
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**Single rule on one molecule:**
|
|
58
|
-
|
|
59
|
-
```python
|
|
60
|
-
import datamol as dm
|
|
61
|
-
import medchem as mc
|
|
62
|
-
|
|
63
|
-
smiles = "CC(=O)OC1=CC=CC=C1C(=O)O" # aspirin
|
|
64
|
-
mc.rules.basic_rules.rule_of_five(smiles) # True
|
|
65
|
-
mc.rules.basic_rules.rule_of_cns(smiles) # True
|
|
66
|
-
mc.rules.basic_rules.rule_of_veber(smiles) # True
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Multiple rules with `RuleFilters` (returns a DataFrame):**
|
|
70
|
-
|
|
71
|
-
```python
|
|
72
|
-
import datamol as dm
|
|
73
|
-
import medchem as mc
|
|
74
|
-
|
|
75
|
-
mols = [dm.to_mol(s) for s in smiles_list]
|
|
76
|
-
|
|
77
|
-
rfilter = mc.rules.RuleFilters(
|
|
78
|
-
rule_list=["rule_of_five", "rule_of_oprea", "rule_of_cns", "rule_of_leadlike_soft"]
|
|
79
|
-
)
|
|
80
|
-
df = rfilter(mols=mols, n_jobs=-1, progress=True, keep_props=False)
|
|
81
|
-
|
|
82
|
-
# Columns: mol, pass_all, pass_any, rule_of_five, rule_of_oprea, ...
|
|
83
|
-
passing = df[df["pass_all"]]
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Use `keep_props=True` to include computed descriptors (`mw`, `clogp`, `tpsa`, etc.) in the result.
|
|
87
|
-
|
|
88
|
-
### 2. Structural Alert Filters
|
|
89
|
-
|
|
90
|
-
Detect problematic patterns with `medchem.structural`. Both classes return **DataFrames** with `pass_filter`, `status`, and `reasons` columns.
|
|
91
|
-
|
|
92
|
-
**Common alerts (ChEMBL-derived rule sets):**
|
|
93
|
-
|
|
94
|
-
```python
|
|
95
|
-
import medchem as mc
|
|
96
|
-
|
|
97
|
-
alert_filter = mc.structural.CommonAlertsFilters()
|
|
98
|
-
df = alert_filter(mols=mol_list, n_jobs=-1, progress=True)
|
|
99
|
-
# df columns: mol, pass_filter, status, reasons
|
|
100
|
-
|
|
101
|
-
clean = df[df["pass_filter"]]
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**NIBR filters (Novartis screening-deck curation):**
|
|
105
|
-
|
|
106
|
-
```python
|
|
107
|
-
nibr_filter = mc.structural.NIBRFilters()
|
|
108
|
-
df = nibr_filter(mols=mol_list, n_jobs=-1, progress=True)
|
|
109
|
-
# df columns: mol, pass_filter, status, severity, reasons, n_covalent_motif, special_mol
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Compounds with `severity >= 10` are excluded by default (see NIBR paper).
|
|
113
|
-
|
|
114
|
-
### 3. Named Catalog Filters (PAINS, Brenk, etc.)
|
|
115
|
-
|
|
116
|
-
Use `medchem.catalogs.NamedCatalogs` for RDKit `FilterCatalog` instances, or the functional API:
|
|
117
|
-
|
|
118
|
-
```python
|
|
119
|
-
import medchem as mc
|
|
120
|
-
|
|
121
|
-
# List available named catalogs
|
|
122
|
-
mc.catalogs.list_named_catalogs()
|
|
123
|
-
# ['tox', 'pains', 'pains_a', 'brenk', 'nibr', 'zinc', ...]
|
|
124
|
-
|
|
125
|
-
# Functional API — True means molecule passes (no alert match)
|
|
126
|
-
passes = mc.functional.alert_filter(mols=mol_list, alerts=["pains"], n_jobs=-1)
|
|
127
|
-
|
|
128
|
-
# Or via catalog objects
|
|
129
|
-
passes = mc.functional.catalog_filter(
|
|
130
|
-
mols=mol_list,
|
|
131
|
-
catalogs=[mc.catalogs.NamedCatalogs.pains()],
|
|
132
|
-
n_jobs=-1,
|
|
133
|
-
)
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### 4. Functional API
|
|
137
|
-
|
|
138
|
-
`medchem.functional` provides one-call wrappers that return boolean masks (True = passes):
|
|
139
|
-
|
|
140
|
-
```python
|
|
141
|
-
import medchem as mc
|
|
142
|
-
|
|
143
|
-
mc.functional.rules_filter(mols=mol_list, rules=["rule_of_five", "rule_of_cns"], n_jobs=-1)
|
|
144
|
-
mc.functional.nibr_filter(mols=mol_list, max_severity=10, n_jobs=-1)
|
|
145
|
-
mc.functional.alert_filter(mols=mol_list, alerts=["pains", "brenk"], n_jobs=-1)
|
|
146
|
-
mc.functional.complexity_filter(mols=mol_list, complexity_metric="bertz", limit="99", n_jobs=-1)
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Other helpers: `catalog_filter`, `chemical_group_filter`, `lilly_demerit_filter` (requires optional binaries), `macrocycle_filter`, `bredt_filter`, `protecting_groups_filter`, and more.
|
|
150
|
-
|
|
151
|
-
### 5. Chemical Groups
|
|
152
|
-
|
|
153
|
-
Detect functional groups and curated pattern collections via `medchem.groups`:
|
|
154
|
-
|
|
155
|
-
```python
|
|
156
|
-
import medchem as mc
|
|
157
|
-
|
|
158
|
-
# Browse available group collections
|
|
159
|
-
mc.groups.list_default_chemical_groups()
|
|
160
|
-
# ['privileged_scaffolds', 'common_warhead_covalent_inhibitors', 'rings_in_drugs', ...]
|
|
161
|
-
|
|
162
|
-
group = mc.groups.ChemicalGroup(groups=["privileged_scaffolds"])
|
|
163
|
-
group.has_match(mol) # bool
|
|
164
|
-
group.get_matches(mol) # dict of group → atom indices
|
|
165
|
-
group.filter(mols) # molecules matching the group
|
|
166
|
-
|
|
167
|
-
# Returns molecules that do NOT match the group
|
|
168
|
-
mc.functional.chemical_group_filter(mols=mol_list, chemical_group=group, n_jobs=-1)
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Custom groups can be loaded from a file via `groups_db` (CSV with `smiles`/`smarts`, `name`, `group` columns).
|
|
172
|
-
|
|
173
|
-
### 6. Molecular Complexity
|
|
174
|
-
|
|
175
|
-
Compare complexity metrics to precomputed ZINC-15 percentile thresholds:
|
|
176
|
-
|
|
177
|
-
```python
|
|
178
|
-
import medchem as mc
|
|
179
|
-
|
|
180
|
-
# Single molecule
|
|
181
|
-
cf = mc.complexity.ComplexityFilter(limit="99", complexity_metric="bertz")
|
|
182
|
-
cf(mol) # True if below 99th-percentile threshold
|
|
183
|
-
|
|
184
|
-
# Batch via functional API
|
|
185
|
-
mc.functional.complexity_filter(
|
|
186
|
-
mols=mol_list,
|
|
187
|
-
complexity_metric="bertz", # also: sas, qed, whitlock, barone, smcm, twc
|
|
188
|
-
limit="99",
|
|
189
|
-
n_jobs=-1,
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
# Direct metric functions
|
|
193
|
-
mc.complexity.WhitlockCT(mol)
|
|
194
|
-
mc.complexity.BaroneCT(mol)
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### 7. Scaffold Constraints
|
|
198
|
-
|
|
199
|
-
`medchem.constraints.Constraints` matches a core scaffold and applies per-atom constraint functions — not simple MW/LogP ranges. For property bounds, use `RuleFilters`, descriptors via `mc.rules.list_descriptors()`, or the query language.
|
|
200
|
-
|
|
201
|
-
```python
|
|
202
|
-
import datamol as dm
|
|
203
|
-
import medchem as mc
|
|
204
|
-
|
|
205
|
-
core = dm.to_mol("c1ccccc1")
|
|
206
|
-
constraints = mc.constraints.Constraints(
|
|
207
|
-
core=core,
|
|
208
|
-
constraint_fns={"query": lambda mol, atom_idx, query: ...},
|
|
209
|
-
)
|
|
210
|
-
constraints(mol)
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### 8. Medchem Query Language
|
|
214
|
-
|
|
215
|
-
Build multi-criteria filters with `medchem.query.QueryFilter`:
|
|
216
|
-
|
|
217
|
-
```python
|
|
218
|
-
import medchem as mc
|
|
219
|
-
|
|
220
|
-
# Rule + alert combination
|
|
221
|
-
qf = mc.query.QueryFilter('MATCHRULE("rule_of_five") AND NOT HASALERT("pains")')
|
|
222
|
-
mask = qf(mols=mol_list, n_jobs=-1) # list[bool]
|
|
223
|
-
|
|
224
|
-
# CNS-like with property bounds
|
|
225
|
-
qf = mc.query.QueryFilter('MATCHRULE("rule_of_cns") AND HASPROP("tpsa", <=, 90)')
|
|
226
|
-
mask = qf(mols=mol_list, n_jobs=-1)
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
**Query syntax:**
|
|
230
|
-
- `MATCHRULE("rule_of_five")` — apply a named rule
|
|
231
|
-
- `HASALERT("pains")` — match a named catalog (`pains`, `brenk`, `nibr`, `tox`, …)
|
|
232
|
-
- `HASPROP("mw", <, 500)` — compare a descriptor (unquoted comparator)
|
|
233
|
-
- `HASGROUP("privileged_scaffolds")` — match a chemical group
|
|
234
|
-
- `HASSUBSTRUCTURE("c1ccccc1")` — substructure match
|
|
235
|
-
- Operators: `AND`, `OR`, `NOT`
|
|
236
|
-
|
|
237
|
-
List available descriptors: `mc.rules.list_descriptors()`
|
|
238
|
-
|
|
239
|
-
## Workflow Patterns
|
|
240
|
-
|
|
241
|
-
### Pattern 1: Initial Triage of a Compound Library
|
|
242
|
-
|
|
243
|
-
```python
|
|
244
|
-
import datamol as dm
|
|
245
|
-
import medchem as mc
|
|
246
|
-
import pandas as pd
|
|
247
|
-
|
|
248
|
-
df = pd.read_csv("compounds.csv")
|
|
249
|
-
mols = [dm.to_mol(s) for s in df["smiles"]]
|
|
250
|
-
|
|
251
|
-
# Drug-likeness rules
|
|
252
|
-
rules_df = mc.rules.RuleFilters(rule_list=["rule_of_five", "rule_of_veber"])(mols=mols, n_jobs=-1)
|
|
253
|
-
|
|
254
|
-
# PAINS + common alerts via query
|
|
255
|
-
qf = mc.query.QueryFilter('MATCHRULE("rule_of_five") AND NOT HASALERT("pains")')
|
|
256
|
-
pass_mask = qf(mols=mols, n_jobs=-1)
|
|
257
|
-
|
|
258
|
-
df["passes_rules"] = rules_df["pass_all"].values
|
|
259
|
-
df["drug_like"] = pass_mask
|
|
260
|
-
filtered_df = df[df["drug_like"]]
|
|
261
|
-
filtered_df.to_csv("filtered_compounds.csv", index=False)
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### Pattern 2: Lead Optimization Filtering
|
|
265
|
-
|
|
266
|
-
```python
|
|
267
|
-
import medchem as mc
|
|
268
|
-
|
|
269
|
-
rules_df = mc.rules.RuleFilters(rule_list=["rule_of_leadlike_soft"])(mols=candidates, n_jobs=-1)
|
|
270
|
-
nibr_df = mc.structural.NIBRFilters()(mols=candidates, n_jobs=-1)
|
|
271
|
-
complex_mask = mc.functional.complexity_filter(
|
|
272
|
-
mols=candidates, complexity_metric="bertz", limit="95", n_jobs=-1
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
passes = (
|
|
276
|
-
rules_df["pass_all"]
|
|
277
|
-
& nibr_df["pass_filter"]
|
|
278
|
-
& complex_mask
|
|
279
|
-
)
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### Pattern 3: Detect Functional Groups
|
|
283
|
-
|
|
284
|
-
```python
|
|
285
|
-
import medchem as mc
|
|
286
|
-
|
|
287
|
-
group = mc.groups.ChemicalGroup(groups=["common_warhead_covalent_inhibitors"])
|
|
288
|
-
matches = [group.has_match(mol) for mol in mol_list]
|
|
289
|
-
warhead_mols = [mol for mol, m in zip(mol_list, matches) if m]
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
## Best Practices
|
|
293
|
-
|
|
294
|
-
1. **Context matters** — marketed drugs often violate Ro5; prodrugs and natural products are common exceptions.
|
|
295
|
-
2. **Combine filters** — rules, alert catalogs, and complexity thresholds work best together.
|
|
296
|
-
3. **Use parallelization** — pass `n_jobs=-1` for libraries >1000 molecules.
|
|
297
|
-
4. **Check return types** — `RuleFilters` and structural classes return DataFrames; functional helpers return boolean arrays.
|
|
298
|
-
5. **Lilly demerits are optional** — install `lilly-medchem-rules` separately; default max demerits is 160 in the functional API.
|
|
299
|
-
6. **Document decisions** — retain `status`, `reasons`, and `severity` columns for audit trails.
|
|
300
|
-
|
|
301
|
-
## Resources
|
|
302
|
-
|
|
303
|
-
### references/api_guide.md
|
|
304
|
-
Module-by-module API reference with signatures, return types, and patterns.
|
|
305
|
-
|
|
306
|
-
### references/rules_catalog.md
|
|
307
|
-
Catalog of available rules, alert sets, complexity metrics, and filter selection guidelines.
|
|
308
|
-
|
|
309
|
-
### scripts/filter_molecules.py
|
|
310
|
-
Batch filtering script for CSV/TSV/SDF/SMILES inputs with configurable rules, alerts, and complexity thresholds.
|
|
311
|
-
|
|
312
|
-
```bash
|
|
313
|
-
uv run python scripts/filter_molecules.py input.csv \
|
|
314
|
-
--rules rule_of_five,rule_of_cns --pains --nibr --output filtered.csv
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## Documentation
|
|
318
|
-
|
|
319
|
-
- Official docs: https://medchem-docs.datamol.io/
|
|
320
|
-
- GitHub: https://github.com/datamol-io/medchem
|
|
321
|
-
- PyPI: https://pypi.org/project/medchem/ (2.0.5)
|