Skip to main content

SCRIPT : A deterministic, RDKit-independent molecular notation with 100% round-trip stereo parity, materials science extensions, biopolymer support, and formal LALR grammar.

Project description

script

Structural Chemical Representation In Plain Text (SCRIPT) is a deterministic, 1-to-1 canonical molecular notation system designed to solve the ambiguity and complexity of SMILES. With an RDKit-independent core engine, SCRIPT guarantees that every molecule has exactly one valid string representation—no post-hoc sanitization required.

Installation

# Core engine (no RDKit required)
pip install linearscript

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

Why SCRIPT?

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.
  • 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).

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)

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

Project details


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.2.tar.gz (50.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.2-py3-none-any.whl (56.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: linearscript-3.1.2.tar.gz
  • Upload date:
  • Size: 50.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.2.tar.gz
Algorithm Hash digest
SHA256 7dbcba214a964fbe1220c3ea3c039ddafe79530ed9efe30ae51331d906223076
MD5 ac690ef997ff31ac53d44e2b95520017
BLAKE2b-256 b2948b3d4402103c9ece5a762d62108bdb02231a8530c9ea4cfb05213877bb43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: linearscript-3.1.2-py3-none-any.whl
  • Upload date:
  • Size: 56.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f315f155fd4385befa75dd78767f267dee56319176d020425131e570377794d0
MD5 dc86ec6f6cd82a3c20f07196bb8a3de4
BLAKE2b-256 24ee2aaa3488cdadfcd4d00ad358f61558f1ea4e2ee7efbe27c160882ed5c5aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page