Package: pygoslin
Python3 implementation for GoslinThis is the Goslin reference implementation for Python 3.The pygoslin has been developed with regard the following general issues:Ease the handling with lipid names for developers working on mass spectrometry-based lipidomics tools.Offering a tool to unify all existing dialects of lipid names.Related ProjectsThis projectC++ implementationGoslin grammars and test filesJava implementationR implementationWebapplication and REST APIInstallationInstallation via pipThe easiest way to install pygoslin is simply via pip:pip3 install pygoslinRegular installation: prerequisitesThe 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 installor[sudo] python setup.py installBe sure that you have root permissions.Testing pygoslinTo run the tests, please type:make testorpython3 -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.HmdbTestUsing pygoslinThe 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
HMDBTo 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 lipidsLipid categoryLipid classAbbreviationGlycerophospholipids (GP)BismonoacylglycerophosphateBMP / LBPACDP-diacylglycerolCDP-DAGDimethylphosphatidylethanolamineDMPEMonomethylphosphatidylethanolamineMMPEPhosphatidylinositol mannoside inositol phosphatePIMIPLyso-CDP-diacylglycerolLCDPDAGLysodimethylphosphatidylethanolamineLDMPELysomonomethylphosphatidylethanolamineLMMPELysophosphatidylinositol- mannosideinositolphosphateLPIMIPLysophosphatidylinositol-glucosamineLPINLysophosphatidic acidLPALysophophatidylcholineLPCEther lysophosphatidic acidLPC O-aLPC O-pLysophosphatidylethanolamineLPEEther lysophosphatidylethanolamineLPE O-aLPE O-pLysophosphatidylglycerolLPGLysophosphatidylinositolLPILysophosphatidylserineLPSCardiolipinCLGlycerophosphoglycerophosphoglycerolsDLCLMonolysocardiolipinMLCLPhosphatidic acidPAPhosphatidylcholinePCEther phosphatidylcholinePC O-aPC O-pPhosphatidylethanolaminePEEther phosphatidylethanolaminePE O-aPE O-pPhosphatidylethanolPEtPhosphatidylglycerolPGPhosphatidylinositolPIPhosphatidylinositolphosphatePIP / PIP[3'] / PIP[4'] / PIP[5']PhosphatidylinositolbisphosphatePIP2 / PIP2[3',4'] / PIP2[3',5'] / PIP2[4',5']PhosphatidylinositoltrisphosphatePIP3 / PIP3[3',4',5']PhosphatidylserinePSPhosphatidylinositol mannosidePIM / PIM1 / PIM2 / PIM3PIM4 / PIM5 / PIM6Lysophosphatidylinositol mannosideLPIM / LPIM1 / LPIM2 / LPIM3LPIM4 / LPIM5 / LPIM6Phosphatidylglycerol phosphatePGPDiacylglyceropyrophosphatePPADiacylglycosylglycerophospholipidGlc-GP / 6-Ac-Glc-GPDiacylglycerophosphonocholinePnCDiacylglycerophosphonoethanolaminePnEDiacylglycerophosphoethanolaminePE-NMe / PE-NMe2DiacylglycerophosphomonoradylglycerolSLBPAN-acylphosphatidylethanolamineNAPECPASphingolipids (SP)CeramideCerCeramide phosphateCerPEthanolaminephosphoceramideEPCGanglioside GB3GB3Ganglioside GB4GB4Ganglioside GD3GD3Ganglioside GM3GM3Ganglioside GM4GM4DihexosylceramideHex2CerHexosylceramideHexCerInositolphosphoceramideIPCLong-chain baseLCBLong-chain base phosphateLCBPLysomonohexosylceramideLHexCerLysosphingomyelinLSMMannosyldiinositolphosphoceramideM(IP)2CMannosylinositolphosphoceramideMIPCSulfatideSHexCerSphingomyelinSMSterol lipids (ST)CholesterolChCholesteryl esterChEGlycerolipids (GL)DiacylglycerolDAGDigalactosyldiacylglycerolDGDGMonoacylglycerolMAGMonogalactosyldiacylglycerolMGDGSulfoquinovosyl monoacylglycerolsSQMGSulfoquinovosyl diacylglycerolSQDGTriacylglycerolTAGSaccharo lipids (SL)DATAC2SGLPAT16 / PAT18Mediator (LM)Docosanoids10-HDoHE11-HDoHE16-HDoHE8-HDoHEMaresin 1Resolvin D1Resolvin D2Resolvin D3Resolvin D5Docosanoids11(12)-EET11,12-DHET11-HETE12-HEPE12-HETE12-HHTrE12-OxoETE14(15)-EET14(15)-EpETE14,15-DHET15d-PGJ215-HEPE15-HETE}16-HETE18-HEPE5(6)-EET5,12-DiHETE5,6,15-LXA45,6-DiHETE5-HEPE5-HETE5-HpETE5-OxoETE8(9)-EET8,9-DHET8-HETE9-HEPE9-HETELTB4LTC4LTD4PGB2PGD2PGE2PGF2alphaPGI2TXB1TXB2TXB3Octadecanoids12(13)-EpOME13-HODE13-HOTrE9(10)-EpOME9-HODE9-HOTrEFatty Acids and ConjugatesAA (Arachidonic acid)ALA (α-Linolenic acid)DHA (Docosahexaenoic acid)EPA (Eicosapentaenoic acid)Linoleic acidPalmitic acidTetranor-12-HETE