Skip to main content

PyLipidParse

Convert standard lipid shorthand notation (LIPID MAPS, SwissLipids, HMDB) to molecular structures.

CI PyPI Python 3.8+ License: MIT

What it does

No existing open-source tool converts lipid shorthand notation to SMILES, InChI, or RDKit molecules. PyLipidParse fills this gap.

from pylipidparse import LipidConverter

conv = LipidConverter()

conv.to_smiles("PC 16:0/18:1(9Z)")
# → 'CCCCCCCCCCCCCCCC(=O)OC[C@@H](OC(=O)CCCCCCCC/C=C\\CCCCCCCC)COP(=O)([O-])OCC[N+](C)(C)C'

conv.to_inchikey("FA 18:2(9Z,12Z)")
# → 'OYHQOLUKZRVURQ-HZJYTTRNSA-N'

conv.to_mol("Cer 18:1;O2/16:0")
# → <rdkit.Chem.rdchem.Mol object>

conv.to_sdf(["PC 16:0/18:1(9Z)", "PE 18:0/20:4(5Z,8Z,11Z,14Z)"], path="output.sdf")

Supported lipid classes

Class Examples Status
Fatty Acids (FA) FA 16:0, FA 18:1(9Z), FA 20:4(5Z,8Z,11Z,14Z) ✅
Glycerolipids (GL) MG, DG, TG ✅
Glycerophospholipids (GP) PC, PE, PA, PI, PS, PG, LPC, LPE, ... ✅
Sphingolipids (SP) Cer, SM, HexCer, Hex2Cer ✅
Sterols (ST) Cholesterol, CE, bile acids ✅
Ether/plasmalogen linkages O-, P- prefix ✅

Installation

pip

pip install pylipidparse

uv

uv add pylipidparse

From source

git clone https://github.com/MontgomeryBohde/PyLipidParse.git
cd PyLipidParse
pip install -e ".[dev]"

Quick start

from pylipidparse import LipidConverter

conv = LipidConverter()

# SMILES
smiles = conv.to_smiles("FA 18:1(9Z)")        # Oleic acid
smiles = conv.to_smiles("PC 16:0/18:1(9Z)")   # POPC

# InChI / InChIKey
inchi = conv.to_inchi("FA 16:0")
ik = conv.to_inchikey("FA 16:0")   # "IPCSVZSSVZVIGE-UHFFFAOYSA-N"

# RDKit Mol (for downstream cheminformatics)
mol = conv.to_mol("Cer 18:1;O2/16:0")

# Write to file
conv.to_mol_file("PC 16:0/18:1(9Z)", "popc.mol")
conv.to_sdf(["FA 16:0", "FA 18:1(9Z)", "PC 16:0/18:1(9Z)"], "lipids.sdf")

Notation requirements

PyLipidParse requires full structural notation with explicit chain positions. Sum-composition notation (e.g., PC 34:1) is rejected because a unique structure cannot be generated from it.

Works Fails
PC 16:0/18:1(9Z) PC 34:1 (no chain breakdown)
TG 16:0/18:1(9Z)/18:2(9Z,12Z) TG 16:0_18:1_18:2 (unknown positions)
FA 18:1(9Z) FA 18:1 (no double bond position)

API reference

LipidConverter(dialect="LipidMaps", cache_size=512)

Method Returns Description
to_mol(name) Chem.Mol RDKit molecule (no 2D coords)
to_smiles(name) str Canonical SMILES
to_inchi(name) str InChI string
to_inchikey(name) str InChIKey (27-char hash)
to_mol_file(name, path) — Write .mol file with 2D coords
to_sdf(names, path) — Write .sdf file (supports batch)

Exceptions

from pylipidparse.exceptions import (
    LipidParseError,                  # pygoslin couldn't parse the input
    UnsupportedLipidClassError,       # lipid class not yet implemented
    InsufficientStructuralDetailError, # species-level / unknown positions
    StructureGenerationError,         # molecule assembly failed
)

Contributing

Issues and pull requests are welcome at github.com/MontgomeryBohde/PyLipidParse.

Citation

If you use PyLipidParse in published work, please cite this repository and the underlying tools:

  • pygoslin: Kopczynski et al., Analytical Chemistry (2022). DOI: 10.1021/acs.analchem.1c05430
  • RDKit: Landrum, G. RDKit: Open-source cheminformatics. rdkit.org

License

MIT License — see LICENSE.

Metadata

Release files for pylipidparse 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylipidparse 1.1.0
File Size Uploaded Provenance Actions
pylipidparse-1.1.0.tar.gz 54.7 kB With provenance Details for pylipidparse-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pylipidparse 1.1.0
File Interpreter ABI Platform Actions
pylipidparse-1.1.0-py3-none-any.whl Python 3 none any Details for pylipidparse-1.1.0-py3-none-any.whl

Total release size: 86.7 kB

Release files / pylipidparse-1.1.0.tar.gz

Download URL pylipidparse-1.1.0.tar.gz
Size 54.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b7a9097e2f70feed63ae0a288d0a0a75c4ec850f0b6c2bb2f3ff8040409ad2b0
BLAKE2b-256 checksum
How to use checksums
fe557b1226d1852d745de05a7c0a29503cbb87e843bffbc295b85c425e567fea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.

Transparency log

Release files / pylipidparse-1.1.0-py3-none-any.whl

Download URL pylipidparse-1.1.0-py3-none-any.whl
Size 32.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
058451fe7552fa9a5f6abbb220d95122edbfde19e9c01d03b43c0e31539189bf
BLAKE2b-256 checksum
How to use checksums
df2e72f5f489070699287aa055372556f55b87940ab8c86ed2876182264ea367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.

Transparency log

Security for pylipidparse 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pylipidparse-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full provenance

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