This project has been archived by its maintainers, and is no longer receiving any updates.
Work with lipid names in Python
LipidHandler is a Python package build to work with common abbreviations for lipids such as CE(20:2) or
PG(18:2/20:2). Those lipid names are used in publications, data reports and data analysis tools.
The main goal of LipidHandler is to parse those lipid names, provide facilities to translate them into other represantations and map them to official identifiers.
LipidHandler does not replace toolkits to work with molecules and chemical structures.
:warning: LipidHandler was built for a specific research project and is not able to solve every use case about lipid names. It overlaps with other projects such as liputils.
:warning: The developer is not an expert on lipidomics, some of the naming might not make sense from a chemistry perspective.
:mailbox: Feedback through GitHub issues is appreciated.
Getting started
Work with lipid names
The Lipid class
Parse a lipid name:
from lipidhandler import Lipid
mylipid = Lipid.parse('CE 20:2')
The Lipid has a LipidClass
print(mylipid.lipidclass)
>>> CE
The Lipid contains a ResidueList which holds the Residues.
# iterate the ResidueList
for residue in mylipid.residueslist:
print(residue.carbon_atoms)
print(residue.double_bonds)
>>> 20
>>> 0
Multiple residues and different formats are possible:
mylipid = Lipid.parse("CE(20:2/18:2)")
mylipid = Lipid.parse("CE 20:2/18:2")
mylipid = Lipid.parse("CE(20:2_18:0)")
The Reside class
Next to the core attributes (C and double bonds) the Residue has an oxidation state, a generic
chemical modification descriptor and details on the isomer.
Oxidation state
mylipid = Lipid.parse("CE(16:1;0)")
print(mylipid.residues[0].oxidation)
>>> 0
chemical modification
mylipid = Lipid.parse("PE(O-16:1)")
print(mylipid.residues[0].modification)
>>> O-
isomer
mylipid = Lipid.parse("CE(16:1(6Z))")
print(mylipid.residues[0].zstatelist[0]
>>> 6Z
The ResidueList has functions to aggregate over the residues:
mylipid = Lipid.parse("CE(20:2/18:2)")
print(mylipid.residuelist.sum().carbon_atoms) # the .sum() functions returns a Residue instancte
Connect to external databases
LipidHandler can query external sources to search for terms or get identifiers from external databases. Right now LipidHandler only works with SwissLipids but the underliying interface is generic and can be extended.
from lipidhandler.externalapis import SwissLipids
lipids = SwissLipids.search("CE 20:2")
for l in lipids:
print(l)
>>> CE(20:2)
The output of the .search() function is a LipidList which contains Lipid instances. If you
search for more generic terms you get a list with multiple results.
from lipidhandler.externalapis import SwissLipids
lipids = SwissLipids.search("CE 20")
for l in lipids:
print(l)
>>> CE(20:1)
>>> CE(20:2)
>>> CE(20:5)
>>> CE(20:0)
>>> CE(20:4)
>>> CE(20:3)
>>> CE(20:4)
>>> CE(20:3)
You can also ask for the SwissLipds ID for a specific Lipid instance:
from lipidhandler.externalapis import SwissLipids
mylipid = Lipid.parse("CE(20:2)")
db_xrefs = SwissLipids.get_xrefs(mylipid)
for xref in db_xrefs:
print(xref.target_db, xref.target_id)
>>> SwissLipids SLM:00050028
install
pip install lipidhandler
develop
run tests
Install project and test dependencies
pip install -r requirements.txt
pip install -r test_requirements.txt
Run test suite on sources
python -m pytest
Metadata
Release files for lipidhandler 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lipidhandler-0.0.6.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lipidhandler-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.5 kB
Release files / lipidhandler-0.0.6.tar.gz
| Download URL | lipidhandler-0.0.6.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
551d76069f3c542e17a4a51a68644f7008a1fe55aecc4a355dec30bc01189c9c
|
|
BLAKE2b-256 checksum How to use checksums |
2ee4a360f3c790fdef072b646bff719cb937f829773afd2324f785066c781f0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|
Release files / lipidhandler-0.0.6-py3-none-any.whl
| Download URL | lipidhandler-0.0.6-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7862e8b31a77a0e3d970dc7de6c0529e352816a0f89c6b0e13c473837a2c4431
|
|
BLAKE2b-256 checksum How to use checksums |
7729c729476adda6fc99c003d8f6ac12a5b225f14625c7e4375ab583e4a03563
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|