A collection of reusable python biotech library from AI Lingues.
Project description
AI Lingues Biotech Python Library
pybiotech is a biology-focused toolkit from AI Lingues that builds on RDKit, PubChem, and UniProt to deliver molecule optimization, fingerprinting, structured loaders, and request modeling for data-driven biomedical workflows.
Key Capabilities
- Molecular engineering with ETKDG embedding, MMFF/UFF optimization, surface and hydrophobic metrics, ring counts, fingerprints, and pharmacophore distances.
- Binary serialization that wraps rdkit.Chem.Mol objects in a CRC32-protected container suitable for IPC, sockets, or shared memory.
- Loader stack covering file, directory, and text SDF parsing plus UniProt XML streaming with error tolerance and namespace handling.
- PubChem request builder that unifies Input, Operation, Output, and Query segments, enforces validation rules, and can reverse-parse existing URLs.
- Schema modeling using Pydantic and xsdata so UniProt query fields and PubChem domain pieces stay type-safe.
📦 Installation
Install from PyPI
pip install pybiotech
Requirements
- Python 3.10 or newer (3.11 recommended)
- RDKit for molecule processing
- Additional dependencies declared in pyproject.toml / requirements.txt (xsdata, lxml, pydantic, scipy, numpy, etc.)
📚 Quick Start
1. Embed, optimize, and serialize a molecule
from rdkit import Chem
from pybiotech.core.molecule.optimizer import Optimizer
mol = Chem.MolFromSmiles("c1ccccc1O")
mol3d, ok, meta = Optimizer.embed_and_optimize(mol, random_seed=42)
blob = Optimizer.to_serialize([mol3d, None], include_props=True, with_checksum=True)
print("converged:", ok, "method:", meta["method"])
2. Read SDF records from a directory
from pybiotech.loaders.sdf_loader import SDFLoader
mols, expected, actual = SDFLoader.readDataFromDir("data/sdf", recursive=True)
print(f"expected {expected}, loaded {actual} valid molecules")
3. Build a PubChem REST URL
from pybiotech.classes.nih.https.pubchem.input_spec import InputSpec
from pybiotech.classes.nih.https.pubchem.opera_spec import OperationSpec
from pybiotech.classes.nih.https.pubchem.output_spec import OutputSpec
from pybiotech.classes.nih.https.pubchem.query_options import QueryOptions
from pybiotech.classes.nih.https.pubchem.request import PubChemRequest
input_spec = InputSpec(domain="compound", namespace="cid", identifiers="2244")
operation_spec = OperationSpec(operation="property", tags=["MolecularFormula", "InChIKey"], domain="compound")
output_spec = OutputSpec(output_format="JSON")
query_options = QueryOptions(record_type="3d", image_size="large")
req = PubChemRequest(
input_spec=input_spec,
operation_spec=operation_spec,
output_spec=output_spec,
query_options=query_options,
)
print(req.build_url())
Module overview
Core (molecule)
| Module | Purpose | Docs |
|---|---|---|
core.molecule.calculator |
Geometry, surface, fingerprint, and pharmacophore helpers for Chem.Mol. | docs/core/molecule/calculator.md |
core.molecule.optimizer |
ETKDG embedding plus MMFF/UFF optimization, serialization container, and checksum-aware deserialization. | docs/core/molecule/optimizer.md |
Loaders
| Module | Purpose | Docs |
|---|---|---|
loaders.sdf_loader |
Stream file/dir/text SDF content with index filtering, error tolerance, and warning control. | docs/pybiotech/loaders/sdf_loader.md |
loaders.uniprot_loader |
Auto namespace detection and entry-by-entry UniProt XML parsing. | docs/pybiotech/loaders/uniprot_loader.md |
loaders.uniprot_query_field_loader |
Load QueryField definitions from JSON/text and build validated term:value fragments. | docs/pybiotech/loaders/uniprot_query_field_loader.md |
Classes (models and request helpers)
| Module | Purpose | Docs |
|---|---|---|
classes.uniprot.https.uniprot.org.uniprot_query_field |
Pydantic QueryField model with recursive siblings/items. | docs/classes/uniprot/https/uniprot/org/uniprot_query_field.md |
classes.uniprot.https.uniprot.org.uniprot |
xsdata-generated dataclasses and enums for UniProt Entry, Protein, Sequence, etc. | docs/classes/uniprot/https/uniprot/org/uniprot.md |
classes.nih.https.pubchem.* |
Input, Operation, Output, Query, Request, and Identifier/domain modeling for PubChem PUG REST. | docs/classes/nih/https/pubchem |
📖 Documentation
Detailed API references are under docs/:
- docs/core/molecule/ - optimizer and calculator references
- docs/pybiotech/loaders/ - SDF/UniProt loader documentation
- docs/classes/nih/https/pubchem/ - PubChem URL and query modeling
- docs/classes/uniprot/https/uniprot/org/ - UniProt schema reference
🏗️ Project layout
- pybiotech/
- pybiotech/
- core/
- molecule/
- loaders/
- classes/
- core/
- docs/
- scripts/
- README.md
- README_Example.md
- pyproject.toml
- requirements.txt
- pybiotech/
📝 License & Usage Terms
Package Usage License
The PyBiotech package (the binary package installed via pip) is released under the MIT License:
- ✅ Free Use – May be used freely in personal and enterprise projects
- ✅ Commercial Use – Allowed in commercial products and services
- ✅ Free Distribution – You may freely distribute and redistribute the package
- ✅ No Usage Restrictions – No fees or additional authorization required
Source Code Protection Terms
Important Notice: The source code of this project is private property and protected by intellectual property law:
- ❌ Source Code Not Public – The source code is not publicly available
- ❌ No Reverse Engineering – Decompilation, reverse engineering, or disassembly of the package is strictly prohibited
- ❌ No Source Distribution – You may not obtain, copy, or distribute the source code in any form
- ❌ No Modified Redistribution – You may not modify the package and redistribute it In short: You are free to use our package (including for commercial purposes), but please respect our source code intellectual property rights.
📧 Contact Us
Website: https://www.ailingues.com
Email: support@ailingues.com
Technical Support: For any questions or suggestions, please contact us via email.
Made with ❤️ by AI Lingues Team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybiotech-0.3.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: pybiotech-0.3.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34547e8ffbf43c5fa8ac828c802df376807103cf0eed6b88bdb30f04f931d2e1
|
|
| MD5 |
dfb86f3b7d5ce227755caf4d7c23af88
|
|
| BLAKE2b-256 |
be023c58f37962fc71f0e8990fc6fed4409b34c7a56c9926402abef2b813e4ab
|
File details
Details for the file pybiotech-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pybiotech-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b27f05d0af5e944d7aa8aab44943cde744f9f6d0a45631df021f4cf39a8b517c
|
|
| MD5 |
db480e4120201730f5918c3446f8b357
|
|
| BLAKE2b-256 |
5616498dbb29a0e1efe06d0f9a71d5e2e8585bc0e880f160e451226087e5790c
|