RepositoryJuliaJPJapan
mojaie

mojaie/MolecularGraph.jl

Graph-based molecule modeling toolkit for cheminformatics

232stars
28forks
11issues
0views

MolecularGraph.jl

DOI TagBot

MolecularGraph.jl is a graph-based molecule modeling and chemoinformatics analysis toolkit fully implemented in Julia.

https://github.com/user-attachments/assets/9844a6f7-d172-4278-82b8-d4f307dff13f

Installation

MolecularGraph.jl requires Julia 1.10.12 or later.

pkg> add MolecularGraph

Some features are provided as package extensions and are enabled by loading the corresponding packages.

  • Cairo.jl: PNG export of 2D structure images (drawpng)
  • Makie.jl: 3D molecule rendering (spacefilling, ballstick, stick, wire)
  • RDKitMinimalLib.jl: SMILES writer and fingerprints (not available on Windows currently)

Quick start

using MolecularGraph

mol = smilestomol("CC(=O)Oc1ccccc1C(=O)O")  # aspirin
molecular_formula(mol)  # "C9H8O4"
standard_weight(mol, 2)  # 180.16
wclogp(mol, 2)  # 1.31
has_substruct_match(mol, smartstomol("c[CX3](=O)[OX2H1]"))  # true
inchikey(mol)  # "BSYNRYMUTXBXSQ-UHFFFAOYSA-N"
svg = drawsvg(mol)  # 2D structure image as an SVG string

mol2 = sdftomol("path/to/file.mol")  # read a molfile
for m in sdfilereader("path/to/file.sdf")  # iterate over molecules in an SDFile
    println(molecular_formula(m))
end

Documentation

Documentation and API reference

  • Getting started and basics: molecular graph models, properties and descriptors, drawing, preprocessing, stereochemistry, mass and isotopes, substructure and query, MCS
  • Advanced topics: interfaces of molecular graph models, customizing atom and bond properties
  • API reference: docstrings of all exported functions and types

Features

  • Chemical structure file I/O

    • SDFile reader/writer (.sdf, .mol)
    • SMILES/SMARTS reader
    • ChemDraw CDXML reader
    • JSON serialization (lossless format and CommonChem JSON)
    • SMILES writer (RDKitMinimalLib.jl)
    • InChI and InChIKey (InChI)
  • Drawing

  • Properties and descriptors

    • Valence, hydrogens, hybridization, aromaticity
    • H-bond donor/acceptor, rotatable bonds (descriptors of Lipinski's rule of five)
    • Wildman-Crippen logP
    • Fingerprints (RDKitMinimalLib.jl)
    • Automatic recalculation of properties when the molecule is modified
  • Stereochemistry

    • Stereocenters and cis-trans stereobonds from SMILES and SDFile (2D wedges)
    • Stereochemistry preserved through hydrogen removal and other graph modifications
    • 2D wedges kept consistent with the stereochemistry for drawing, SDFile output and InChI
  • Preprocessing

    • Hydrogen removal/addition, largest component extraction
    • Charge standardization (protonation/deprotonation), kekulization
  • Atomic mass

    • Standard atomic/molecular weight, monoisotopic and exact mass with uncertainty
    • Isotopic composition and simulated mass spectrum
  • Substructure and query

    • Subgraph isomorphism detection with VF2 algorithm
      • SMARTS query match (including recursive SMARTS)
      • Monomorphism, node-induced and edge-induced match
      • Constraints (mandatory/forbidden vertex mapping)
    • Functional group query set
    • Structural alerts detection with ChEMBL dataset
    • SMARTS query containment
  • Molecular graph topology

    • Ring, scaffold, connected components
    • Minimum cycle basis (de Pina algorithm)
      • Smallest set of smallest rings (SSSR)
    • Planarity (left-right planarity test)
    • Maximum matching
      • Kekulization
    • Graph traversal
  • Maximum common substructure (MCS)

    • By clique detection algorithm
    • Node-induced (MCIS) and edge-induced (MCES)
    • Connected and disconnected
    • Topological constraint (known as tdMCS)
    • Diameter restriction (MCS-DR) and graph-based local similarity (GLS)
  • Shared library for other languages (experimental)

AI Assistance

Generative AI tools are used to assist with code development, bug fixing, documentation writing, and pull request reviews. All AI-generated contributions are reviewed and validated by the human maintainer, who retains full responsibility for the package's design, implementation, and maintenance.

License

MIT license
See Assets/README.md for details of external data sets and their licenses.

(C) 2018-2026 Seiji Matsuoka and contributors

Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
epam/ketcher

Web-based molecule sketcher

946
Nov 23, 2026
RepositoryJulia
JuliaLang/julia

The Julia Programming Language

49.3k
Nov 18, 2026
RepositoryJulia
MakieOrg/Makie.jl

Interactive data visualizations and plotting in Julia

2.8k
Nov 19, 2026
RepositoryJulia
JuliaPlots/Plots.jl

Powerful convenience for Julia visualizations and data analysis

2.0k
Nov 23, 2026
RepositoryJulia
JuliaIO/JLD2.jl

HDF5-compatible file format in pure Julia

642
Nov 17, 2026
RepositoryC++
openbabel/openbabel

Open Babel is a chemical toolbox designed to speak the many languages of chemical data.

1.4k
Sep 14, 2026
RepositoryTypeScript
julia-vscode/julia-vscode

Julia extension for Visual Studio Code

1.3k
Oct 25, 2026
RepositoryC++
gnina/gnina

A deep learning framework for molecular docking

1.0k
Oct 30, 2026
RepositoryPython
MolecularAI/REINVENT4

AI molecular design tool for de novo design, scaffold hopping, R-group replacement, linker design and molecule optimization.

906
Nov 6, 2026