Skip to content

Python implementation of parsers for the Grammars on succinct lipid nomenclature (Goslin).

License

Notifications You must be signed in to change notification settings

lifs-tools/pygoslin

Repository files navigation

Python3 implementation for Goslin

Build Status

This is the Goslin reference implementation for Python 3.

The pygoslin has been developed with regard the following general issues:

  1. Ease the handling with lipid names for developers working on mass spectrometry-based lipidomics tools.
  2. Offering a tool to unify all existing dialects of lipid names.

Related Projects

Installation

Installation via pip

The easiest way to install pygoslin is simply via pip:

pip3 install pygoslin

Regular installation: prerequisites

The pygoslin package uses pip to create an isolated and defined build environment. You will need Python >=3.5 to build the package.

python3-pip
cython (module for Python 3)
make (optional)

To install the package globally in your Python distribution, simply type:

[sudo] make install

or

[sudo] python setup.py install

Be sure that you have root permissions.

Testing pygoslin

To run the tests, please type:

make test

or

python3 -m unittest pygoslin.tests.FattyAcidTest
python3 -m unittest pygoslin.tests.ParserTest
python3 -m unittest pygoslin.tests.SwissLipidsTest
python3 -m unittest pygoslin.tests.GoslinTest
python3 -m unittest pygoslin.tests.LipidMapsTest
python3 -m unittest pygoslin.tests.HmdbTest

Using pygoslin

The two major functions within pygoslin are the parsing and printing of lipid names. You have several options, to access these functions. This example will demonstrate both functions the easiest way. Open a Python shell and type in:

from pygoslin.parser.Parser import LipidParser
lipid_parser = LipidParser()

lipid_name = "PE 16:1-12:0"
lipid = lipid_parser.parse(lipid_name)

if lipid != None: print(lipid.get_lipid_string())

Be aware, that this method is subsequencially using all available grammars until a lipid name can be described by the first grammar. Currently, three grammars are available, namely:

Goslin
GoslinFragment
LipidMaps
SwissLipids
HMDB

To use a specific grammar / parser, you can use the following code:

# using solely the Goslin parser
from pygoslin.parser.Parser import GoslinParser
goslin_parser = GoslinParser()

lipid_name = "Cer 18:1;2/12:0"
try:
    lipid = goslin_parser.parse(lipid_name)
    print(lipid.get_lipid_string())
except Exception as e:
    print(e)
    



# using solely the Goslin Fragment parser
from pygoslin.parser.Parser import GoslinFragmentParser
goslin_fragment_parser = GoslinFragmentParser()

lipid_name = "Cer 18:1;2/12:0"
try:
    lipid = goslin_fragment_parser.parse(lipid_name)
    print(lipid.get_lipid_string())
except Exception as e:
    print(e)
    
    


# using solely the LipidMaps parser
from pygoslin.parser.Parser import LipidMapsParser
lipid_maps_parser = LipidMapsParser()

lipid_name = "Cer(d18:1/12:0)"
try:
    lipid = lipid_maps_parser.parse(lipid_name)
    print(lipid.get_lipid_string())
except Exception as e:
    print(e)




# using solely the SwissLipids parser
from pygoslin.parser.Parser import SwissLipidsParser
swiss_lipids_parser = SwissLipidsParser()

lipid_name = "Cer(d18:1/12:0)"
try:
    lipid = swiss_lipids_parser.parse(lipid_name)
    print(lipid.get_lipid_string())
except Exception as e:
    print(e)
    


# using solely the HMDB parser
from pygoslin.parser.Parser import HmdbParser
hmdb_parser = HmdbParser()

lipid_name = "Cer(d18:1/12:0)"
try:
    lipid = hmdb_parser.parse(lipid_name)
    print(lipid.get_lipid_string())
except Exception as e:
    print(e)

To be as generic as possible, no treatment of validation of the fragment is conducted within the GoslinFragmentParser.

Supported lipids

Lipid categoryLipid classAbbreviation
Glycerophospholipids (GP)BismonoacylglycerophosphateBMP / LBPA
CDP-diacylglycerolCDP-DAG
DimethylphosphatidylethanolamineDMPE
MonomethylphosphatidylethanolamineMMPE
Phosphatidylinositol mannoside inositol phosphatePIMIP
Lyso-CDP-diacylglycerolLCDPDAG
LysodimethylphosphatidylethanolamineLDMPE
LysomonomethylphosphatidylethanolamineLMMPE
Lysophosphatidylinositol- mannosideinositolphosphateLPIMIP
Lysophosphatidylinositol-glucosamineLPIN
Lysophosphatidic acidLPA
LysophophatidylcholineLPC
Ether lysophosphatidic acidLPC O-a
LPC O-p
LysophosphatidylethanolamineLPE
Ether lysophosphatidylethanolamineLPE O-a
LPE O-p
LysophosphatidylglycerolLPG
LysophosphatidylinositolLPI
LysophosphatidylserineLPS
CardiolipinCL
GlycerophosphoglycerophosphoglycerolsDLCL
MonolysocardiolipinMLCL
Phosphatidic acidPA
PhosphatidylcholinePC
Ether phosphatidylcholinePC O-a
PC O-p
PhosphatidylethanolaminePE
Ether phosphatidylethanolaminePE O-a
PE O-p
PhosphatidylethanolPEt
PhosphatidylglycerolPG
PhosphatidylinositolPI
PhosphatidylinositolphosphatePIP / PIP[3'] / PIP[4'] / PIP[5']
PhosphatidylinositolbisphosphatePIP2 / PIP2[3',4'] / PIP2[3',5'] / PIP2[4',5']
PhosphatidylinositoltrisphosphatePIP3 / PIP3[3',4',5']
PhosphatidylserinePS
Phosphatidylinositol mannosidePIM / PIM1 / PIM2 / PIM3
PIM4 / PIM5 / PIM6
Lysophosphatidylinositol mannosideLPIM / LPIM1 / LPIM2 / LPIM3
LPIM4 / LPIM5 / LPIM6
Phosphatidylglycerol phosphatePGP
DiacylglyceropyrophosphatePPA
DiacylglycosylglycerophospholipidGlc-GP / 6-Ac-Glc-GP
DiacylglycerophosphonocholinePnC
DiacylglycerophosphonoethanolaminePnE
DiacylglycerophosphoethanolaminePE-NMe / PE-NMe2
DiacylglycerophosphomonoradylglycerolSLBPA
N-acylphosphatidylethanolamineNAPE
CPA
Sphingolipids (SP)CeramideCer
Ceramide phosphateCerP
EthanolaminephosphoceramideEPC
Ganglioside GB3GB3
Ganglioside GB4GB4
Ganglioside GD3GD3
Ganglioside GM3GM3
Ganglioside GM4GM4
DihexosylceramideHex2Cer
HexosylceramideHexCer
InositolphosphoceramideIPC
Long-chain baseLCB
Long-chain base phosphateLCBP
LysomonohexosylceramideLHexCer
LysosphingomyelinLSM
MannosyldiinositolphosphoceramideM(IP)2C
MannosylinositolphosphoceramideMIPC
SulfatideSHexCer
SphingomyelinSM
Sterol lipids (ST)CholesterolCh
Cholesteryl esterChE
Glycerolipids (GL)DiacylglycerolDAG
DigalactosyldiacylglycerolDGDG
MonoacylglycerolMAG
MonogalactosyldiacylglycerolMGDG
Sulfoquinovosyl monoacylglycerolsSQMG
Sulfoquinovosyl diacylglycerolSQDG
TriacylglycerolTAG
Saccharo lipids (SL)DAT
AC2SGL
PAT16 / PAT18
Mediator (LM)Docosanoids10-HDoHE
11-HDoHE
16-HDoHE
8-HDoHE
Maresin 1
Resolvin D1
Resolvin D2
Resolvin D3
Resolvin D5
Docosanoids11(12)-EET
11,12-DHET
11-HETE
12-HEPE
12-HETE
12-HHTrE
12-OxoETE
14(15)-EET
14(15)-EpETE
14,15-DHET
15d-PGJ2
15-HEPE
15-HETE}
16-HETE
18-HEPE
5(6)-EET
5,12-DiHETE
5,6,15-LXA4
5,6-DiHETE
5-HEPE
5-HETE
5-HpETE
5-OxoETE
8(9)-EET
8,9-DHET
8-HETE
9-HEPE
9-HETE
LTB4
LTC4
LTD4
PGB2
PGD2
PGE2
PGF2alpha
PGI2
TXB1
TXB2
TXB3
Octadecanoids12(13)-EpOME
13-HODE
13-HOTrE
9(10)-EpOME
9-HODE
9-HOTrE
Fatty Acids and ConjugatesAA (Arachidonic acid)
ALA (α-Linolenic acid)
DHA (Docosahexaenoic acid)
EPA (Eicosapentaenoic acid)
Linoleic acid
Palmitic acid
Tetranor-12-HETE