Metadata-Version: 2.4
Name: refua
Version: 0.4.1
Summary: Unified drug discovery ML toolkit
License-Expression: MIT
License-File: LICENSE
Keywords: drug discovery,machine learning,protein design,structure prediction,generative design
Author: JJ Ben-Joseph
Author-email: jj@tensorspace.ai
Requires-Python: >=3.11,<3.15
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Provides-Extra: admet
Provides-Extra: analysis
Provides-Extra: cuda
Provides-Extra: dev
Provides-Extra: doc
Provides-Extra: lint
Provides-Extra: process
Provides-Extra: test
Provides-Extra: train
Requires-Dist: biopython (>=1.84)
Requires-Dist: biotite
Requires-Dist: chembl_structure_pipeline (>=1.2.2)
Requires-Dist: click (>=8.1.7)
Requires-Dist: cuequivariance_ops_cu12 (>=0.5.0) ; extra == "cuda"
Requires-Dist: cuequivariance_ops_torch_cu12 (>=0.5.0) ; extra == "cuda"
Requires-Dist: cuequivariance_torch (>=0.5.0) ; extra == "cuda"
Requires-Dist: dm-tree (>=0.1.8)
Requires-Dist: einops (>=0.8.0)
Requires-Dist: einx (>=0.3.0)
Requires-Dist: fairscale (>=0.4.13)
Requires-Dist: furo (>=2024.1.29) ; extra == "dev"
Requires-Dist: furo (>=2024.1.29) ; extra == "doc"
Requires-Dist: gemmi (>=0.6.5)
Requires-Dist: huggingface_hub
Requires-Dist: hydra-core (>=1.3.2)
Requires-Dist: hydride ; extra == "analysis"
Requires-Dist: logomaker
Requires-Dist: logomaker ; extra == "analysis"
Requires-Dist: mashumaro (>=3.14)
Requires-Dist: matplotlib
Requires-Dist: matplotlib ; extra == "analysis"
Requires-Dist: matplotlib ; extra == "train"
Requires-Dist: modelcif (>=1.2)
Requires-Dist: myst-parser (>=2.0.0) ; extra == "dev"
Requires-Dist: myst-parser (>=2.0.0) ; extra == "doc"
Requires-Dist: numba (>=0.61.0)
Requires-Dist: numpy (>=1.26,<2.0)
Requires-Dist: nvidia-ml-py (>=12.535.133) ; extra == "cuda"
Requires-Dist: p_tqdm ; extra == "process"
Requires-Dist: pandas (>=2.2.2)
Requires-Dist: pandas (>=2.2.2) ; extra == "analysis"
Requires-Dist: pandas (>=2.2.2) ; extra == "dev"
Requires-Dist: pandas (>=2.2.2) ; extra == "test"
Requires-Dist: pandas (>=2.2.2) ; extra == "train"
Requires-Dist: pdbeccdutils ; extra == "process"
Requires-Dist: pre-commit ; extra == "dev"
Requires-Dist: pydssp
Requires-Dist: pytest ; extra == "dev"
Requires-Dist: pytest ; extra == "test"
Requires-Dist: pytorch-lightning (>=2.5.0)
Requires-Dist: pyyaml (>=6.0.2)
Requires-Dist: rdkit (>=2024.3.2)
Requires-Dist: redis ; extra == "dev"
Requires-Dist: redis ; extra == "process"
Requires-Dist: requests (>=2.32.3)
Requires-Dist: requests ; extra == "dev"
Requires-Dist: requests ; extra == "test"
Requires-Dist: ruff ; extra == "dev"
Requires-Dist: ruff ; extra == "lint"
Requires-Dist: scikit-learn (>=1.6.1)
Requires-Dist: scipy (>=1.13.1)
Requires-Dist: sphinx (>=7) ; extra == "dev"
Requires-Dist: sphinx (>=7) ; extra == "doc"
Requires-Dist: sphinx-autodoc-typehints (>=1.25.2) ; extra == "dev"
Requires-Dist: sphinx-autodoc-typehints (>=1.25.2) ; extra == "doc"
Requires-Dist: torch (>=2.4.1)
Requires-Dist: tqdm
Requires-Dist: transformers (>=4.45.0) ; extra == "admet"
Requires-Dist: types-requests (>=2.32.4) ; extra == "dev"
Requires-Dist: wandb (>=0.18.7) ; extra == "dev"
Requires-Dist: wandb (>=0.18.7) ; extra == "train"
Project-URL: Homepage, https://tensorspace.ai/
Project-URL: Repository, https://github.com/tensorspace-ai/refua
Description-Content-Type: text/markdown

# Refua

Refua is a general drug discovery ML toolkit that brings together structure prediction, affinity modeling, and generative design in one package. It unifies the Boltz inference stack with the BoltzGen design pipeline so you can move from target definition to candidate generation using a shared, programmatic API.

## Why use Refua?

- **Fluent Python API:** Build specs, run predictions, and post-process results with a readable, composable
  API—no need to stitch together CLI calls, YAML, or intermediate files.
- **No per-call model reload:** Keep a predictor/model instance alive and run many inferences in a loop
  without paying initialization and checkpoint-loading cost each time.
- **All-in-memory workflows:** Prepare inputs, run inference, and perform analysis entirely in memory
  (e.g., passing objects/arrays between steps) without writing temporary files to disk.
- **Improved build:** We are able to support more up to date dependencies. Over time we expect to widen this support.

## Quickstart

Install:

```bash
pip install refua
```

Install with NVIDIA GPU support:

```bash
pip install "refua[cuda]"
```

Unified API (same Complex flow for ligands or binders):

```python
from pathlib import Path

from refua import Binder, Complex, Protein, SM

target = Protein(
    "MSEQNNTEMTFQIQRIYTKDISFEAPNAPHVFQQLAGKYTPEEIRNVLSTLQKAD",
    ids="A",
)

# Protein + ligand -> Boltz2 structure + affinity
result = (
    Complex([target, SM("Cn1cnc2n(C)c(=O)n(C)c(=O)c12")], name="demo")
    .request_affinity()
    .fold()
)
Path("complex.bcif").write_bytes(result.to_bcif())
print(result.affinity.ic50, result.affinity.binding_probability)

# Protein + binder placeholder -> Boltz2 structure + BoltzGen design inputs
binder = Binder(length=12, ids="P")
result = Complex([target, binder], name="design").fold()
Path("design.bcif").write_bytes(result.to_bcif())
print("binder spec:", binder.sequence)
```

For template-based designs, add `.file(...)` to the same `Complex` before `fold()`.

Small molecule properties:

```python
from refua import SM

props = SM("Cn1cnc2n(C)c(=O)n(C)c(=O)c12", lazy=True)
print(props.mol_wt(), props.logp())
print(props.to_dict())
```

Pass `lazy=False` to compute all properties eagerly.

Model-based ADMET predictions (optional; requires `refua[admet]`):

```python
props = SM("Cn1cnc2n(C)c(=O)n(C)c(=O)c12")
profile = props.admet_profile()
print(profile["admet_score"], profile["assessment"])
print(props.herg(), props.ames())
```

BoltzGen defaults to the bundled molecule library in the Hugging Face cache. Set `BOLTZGEN_MOLDIR` or pass `mol_dir` to override.

CLI entrypoints are still available:

```bash
boltz --help
boltzgen --help
```

## Documentation

- Boltz docs live in `docs/boltz`.
- BoltzGen docs live in `docs/boltzgen`.
- API reference source lives in `docs/api` (build with `sphinx-build -b html docs/api docs/api/_build/html`).

## Examples

- `examples/antibody_design.py` shows a minimal antibody design spec with template targets.
- `examples/protein_ligand_affinity.py` shows a protein-ligand affinity spec.
- `examples/boltz2_kras_mrtx1133.py` folds KRAS G12D with the MRTX-1133 inhibitor and prints affinity.
- `examples/boltzgen_peptide_binder.py` shows a peptide binder spec with optional cyclic peptides.
- `examples/boltz_constraints.py` shows a complex with pocket/contact constraints and an optional MSA.
- `examples/boltz_multichain_msa.py` shows multi-chain MSAs with cross-chain constraints.
- `examples/boltzgen_template_insertions.py` shows template structure groups and design insertions.
- `examples/boltz_multi_pocket_complex.py` shows multi-ligand pocket constraints with contacts.
- `examples/boltzgen_template_masks.py` shows template masks with design/not-design ranges and structure groups.

## Notes

This repository consolidates the two stacks into a single build and dependency set. If you need the legacy standalone documentation, it has been preserved under `docs/`.

