Skip to main content

SCRIPT (Structural Chemical Representation In Plain Text)

A deterministic, 1-to-1 canonical molecular notation system designed to solve the ambiguity of SMILES.

PyPI version Python Versions License


SCRIPT is a next-generation cheminformatics engine and text notation designed from the ground up for strict mathematical determinism. Whether you are generating datasets for machine learning, encoding complex macrocycles, or standardizing molecular databases, SCRIPT ensures that every unique molecular graph maps strictly to one and only one text representation.

Powered by a robust context-free grammar and a lightweight, RDKit-independent core, it eliminates the need for expensive post-hoc sanitization or canonicalization loops—it is canonical by design.

🚀 Why SCRIPT?

SCRIPT is a completely new chemistry notation—not a modification of SMILES or InChI. It is a deterministic 1-to-1 canonical notation built from scratch with a strict context-free grammar and a Sandhi state machine that eliminates ambiguity entirely.

Unlike SMILES, which can represent a single molecule in dozens of valid ways (e.g., Aspirin can be written in over 50 valid SMILES strings), SCRIPT uses a deterministic Sandhi state machine to ensure a 1-to-1 mapping between a molecular graph and its text representation.

Aspirin in SMILES:  CC(=O)Oc1ccccc1C(=O)O  (one of many valid forms)
Aspirin in SCRIPT:  CC(=O)OC:C:C:C:C:C&6:C(=O)O  (always and only this)

✨ Key Capabilities

  • Canonical by Design: DFS + Morgan ranking guarantees 100% canonical strings.
  • RDKit-Free Core: Parse, validate, and manipulate molecular graphs without heavy cheminformatics dependencies.
  • Topologically Complete: Natively encodes complex bridged polycycles and macrocycles using flat-history topological offsets.
  • Advanced Chemistry: Full support for organometallics (dative/haptic/coordinate bonds), alloys with fractional occupancies (<~0.9>), and electronic/excited states (<s:3>, <*>).
  • Materials & Surfaces: Natively encode crystallographic contexts ([[Rutile]]) and surface chemistry interfaces (|).
  • Biopolymers: Built-in grammar for peptide and nucleic acid chains ({A.G.S}).
  • Chemical Reactions: Robust multi-component reaction representation (R>>P).

📦 Installation

# Core engine (no RDKit required)
pip install linearscript

# Full suite with RDKit bridge for SMILES interoperability
pip install linearscript[rdkit]

💻 Quick Start

Parse and Canonicalize

from script.parser import SCRIPTParser
from script.canonical import SCRIPTCanonicalizer

parser = SCRIPTParser()
# Parse from a SMILES-style input (SCRIPT is backwards compatible with basic SMILES)
result = parser.parse("CC(=O)Oc1ccccc1C(=O)O")

mol = result["molecule"]
print(f"Atoms: {len(mol.atoms)}, Bonds: {len(mol.bonds)}")

# Generate the 1-to-1 unique canonical SCRIPT string
canon = SCRIPTCanonicalizer().canonicalize_core(mol)
print(canon)  # Output: CC(=O)OC:C:C:C:C:C&6:C(=O)O

RDKit Interoperability

from rdkit import Chem
from script.rdkit_bridge import SCRIPTFromMol, MolFromSCRIPT

# Convert RDKit Mol to SCRIPT
mol = Chem.MolFromSmiles("CN1CCC[C@H]1c2cccnc2")
script_str = SCRIPTFromMol(mol)

# Convert SCRIPT back to RDKit Mol
mol_back = MolFromSCRIPT(script_str)

🆕 Latest Updates

  • Bridged Macrocycle Support: Replaced topological stack depths with deterministic flat-history linear offsets, ensuring 100% round-trip fidelity for complex bridged rings (e.g. norbornane, cyclic peptides).
  • E/Z Stereocenter Resolution: Enhanced bond token parsing to fully capture and resolve double bond stereochemistry geometry (\C=C\).
  • CIP-Anchored Parity: Hardened stereochemical parity between the DFS string traversal space and RDKit's internal numerical index space.

📚 Documentation & Source

For full documentation, advanced usage tutorials, materials science examples, and the complete grammar specification, please visit the GitHub Repository.

📄 License

MIT with Commons Clause. Free for academic and non-commercial use. Commercial licensing available separately.


Developed by SCRIPT Development Team.
GitHub: sangeet01/script

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linearscript-3.1.4.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linearscript-3.1.4-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file linearscript-3.1.4.tar.gz.

File metadata

  • Download URL: linearscript-3.1.4.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for linearscript-3.1.4.tar.gz
Algorithm Hash digest
SHA256 a94065e6e451fcf1f9ee4902c6a4f41e49b2404733d4a30aa472b85defc8323b
MD5 6f6886c6f2c107bac5b7546a8102da95
BLAKE2b-256 e59843775239a26cd292c7029d4c6622fd0fe02f536d197e3db2d36096e68f6e

See more details on using hashes here.

File details

Details for the file linearscript-3.1.4-py3-none-any.whl.

File metadata

  • Download URL: linearscript-3.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for linearscript-3.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 245dbed9752d53ad8adde3e4b9f73a7a9fd01881571e864ec2e5e5ba48c768ba
MD5 52201ec3d33f0ce3c5016c20ed3945dc
BLAKE2b-256 2439ac62e71db8aeb2fbc3b0d91fc69b848cd9c0d47f33ebcff82cd1b05582b8

See more details on using hashes here.

Release history Release notifications | RSS feed

3.2

2 files

This release

3.1.4 This release

2 files

3.1.3

2 files

3.1.2

2 files

3.1.1

2 files

3.1.0

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page