### Install pygoslin using make or setup.py Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md For a regular installation, prerequisites like python3-pip and cython are needed. Installation can be done globally using 'make install' or 'python setup.py install'. ```bash [sudo] make install ``` ```bash [sudo] python setup.py install ``` -------------------------------- ### Install pygoslin via pip Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md The recommended and easiest way to install the pygoslin library is by using pip. ```bash pip3 install pygoslin ``` -------------------------------- ### Install rgoslin from GitHub (Development Version) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Installs the latest development version of the rgoslin package directly from its GitHub repository. This may include unstable features. ```r install_github("lifs-tools/rgoslin") ``` -------------------------------- ### Build and Install jgoslin (Maven) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Builds the jgoslin project and runs unit tests using Maven wrapper. This command is essential for setting up the Java library. ```bash ./mvnw install ``` -------------------------------- ### Build and Install jgoslin (Windows Maven) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Builds the jgoslin project and runs unit tests using the Windows Maven wrapper. Use this command on Windows systems. ```bash mvnw.bat install ``` -------------------------------- ### Install rgoslin from Local Clone in R Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Installs the rgoslin package from a local clone of the repository. Ensure the working directory is set to the API code location before execution. ```r library(devtools) install(".") ``` -------------------------------- ### View rgoslin Package Vignette in R Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Opens the introduction vignette for the rgoslin package, providing a tutorial and examples of its usage. ```r vignette('introduction', package = 'rgoslin') ``` -------------------------------- ### Install devtools Package in R Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Installs the 'devtools' package if it is not already installed. This package is a prerequisite for installing other packages from GitHub. ```r if(!require(devtools)) { install.packages("devtools") } ``` -------------------------------- ### jgoslin CLI Output Example Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Example of the tab-separated output generated by the jgoslin CLI when parsing a lipid name. It includes normalized name, original name, grammar, and other details. ```text Normalized Name Original Name Grammar Message Adduct Sum Formula Mass Lipid Maps Category Lipid Maps Main Class Functional Class Abbr Functional Class Synonyms Level Total #C Total #DB Total #OH LCB SN Position LCB #C LCB #DB LCB Bond Type LCB DB Positions FA1 SN Position FA1 #C FA1 #DB FA1 Bond Type FA1 DB Positions Cer 18:1;O2/20:2 Cer(d18:1/20:2) LIPIDMAPS C38H71NO3 589.5434 Sphingolipids [SP] Ceramides [SP02] [SP02] [Cer, Ceramide] SN_POSITION 38 3 2 0 18 1 LCB_EXCEPTION 2 20 2 ESTER ``` -------------------------------- ### Install rgoslin from GitHub (Specific Release Tag) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Installs a specific release version of the rgoslin package from GitHub, referenced by a Git tag (e.g., v2.0.0). Ensures stability by using a tagged release. ```r install_github("lifs-tools/rgoslin", ref="v2.0.0") ``` -------------------------------- ### Run pygoslin tests Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md To verify the installation and functionality of pygoslin, run the provided test suite using 'make test' or by executing individual unittest modules. ```bash make test ``` ```bash 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 ``` -------------------------------- ### Parse and Print Lipid Name (C++) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc A minimalistic C++ example demonstrating parsing a lipid name and printing its string representation. Ensure the LipidAdduct pointer is deleted after use to prevent memory leaks. ```c++ #include "cppgoslin/cppgoslin.h" #include int main(){ LipidParser parser; try { LipidAdduct* lipid = parser.parse("PA(12:0_14:0)"); cout << lipid->get_lipid_string() << endl; delete lipid; } catch(LipidException& e){ // handle the exception cout << e.what() << endl; } return 0; } ``` -------------------------------- ### Get Lipid Name at Different Hierarchy Levels (C++) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Demonstrates retrieving a parsed lipid name at various hierarchy levels (isomeric subspecies, structural subspecies, molecular subspecies, species, class, category). Requesting a level lower than the provided will throw an exception. The LipidAdduct pointer should be deleted after use. ```c++ #include "cppgoslin/cppgoslin.h" #include int main(){ LipidParser parser; try { // providing a lipid name on isomeric subspecies level LipidAdduct* lipid = parser.parse("PA(12:1(5Z)/14:0)"); cout << lipid->get_lipid_string(ISOMERIC_SUBSPECIES) << endl; cout << lipid->get_lipid_string(STRUCTURAL_SUBSPECIES) << endl; cout << lipid->get_lipid_string(MOLECULAR_SUBSPECIES) << endl; cout << lipid->get_lipid_string(SPECIES) << endl; cout << lipid->get_lipid_string(CLASS) << endl; cout << lipid->get_lipid_string(CATEGORY) << endl; delete lipid; } catch(LipidException& e){ // handle the exception cout << e.what() << endl; } return 0; } ``` -------------------------------- ### Retrieving Lipid Names at Different Hierarchy Levels Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Shows how to get the lipid name string at various hierarchical levels (CATEGORY, CLASS, SPECIES, etc.) from a parsed LipidAdduct object. Requesting a level lower than the parsed data will raise an exception. ```java System.out.println(sllipid.getLipidString(LipidLevel.CATEGORY)); System.out.println(sllipid.getLipidString(LipidLevel.CLASS)); System.out.println(sllipid.getLipidString(LipidLevel.SPECIES)); System.out.println(sllipid.getLipidString(LipidLevel.MOLECULAR_SPECIES)); System.out.println(sllipid.getLipidString(LipidLevel.SN_POSITION)); System.out.println(sllipid.getLipidString(LipidLevel.STRUCTURE_DEFINED)); System.out.println(sllipid.getLipidString(LipidLevel.FULL_STRUCTURE)); System.out.println(sllipid.getLipidString(LipidLevel.COMPLETE_STRUCTURE)); ``` -------------------------------- ### Parse Lipid Name and Get String Representations Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses a lipid name and retrieves its string representation at different structural levels (isomeric, structural, molecular, species, class, category). Handles potential parsing exceptions. ```python lipid_name = "PA 18:1(5Z)/12:0" try: lipid = parser.parse(lipid_name) print(lipid.get_lipid_string(LipidLevel.ISOMERIC_SUBSPECIES)) print(lipid.get_lipid_string(LipidLevel.STRUCTURAL_SUBSPECIES)) print(lipid.get_lipid_string(LipidLevel.MOLECULAR_SUBSPECIES)) print(lipid.get_lipid_string(LipidLevel.SPECIES)) print(lipid.get_lipid_string(LipidLevel.CLASS)) print(lipid.get_lipid_string(LipidLevel.CATEGORY)) except Exception as e: print(e) ``` -------------------------------- ### Run All jgoslin Tests (Maven) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Executes all unit and integration tests for the jgoslin project using Maven wrapper. This verifies the project's integrity. ```bash ./mvnw verify ``` -------------------------------- ### Parse lipid name using default LipidParser Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md Demonstrates the basic usage of pygoslin by parsing a lipid name using the default LipidParser, which tries all available grammars sequentially. ```python 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()) ``` -------------------------------- ### Parsing Lipid Names with Different Parsers Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Demonstrates how to use SwissLipidsParser, LipidMapsParser, GoslinParser, and ShorthandParser to parse a lipid reference string. Includes error handling for parsing issues. ```java import org.lifstools.jgoslin.domain.*; // contains Domain objects like LipidAdduct, LipidSpecies ... import org.lifstools.jgoslin.parser.*; // contains the parser implementations ... String ref = "Cer(d18:1/20:2)"; try { // use the SwissLipids parser SwissLipidsParser slParser = new SwissLipidsParser(); // multiple eventhandlers can be used with one parser, e.g. in parallel processing SwissLipidsParserEventHandler slHandler = slParser.newEventHandler(); LipidAdduct sllipid = slParser.parse(ref, slHandler); System.out.println(sllipid.getLipidString()); // to print the lipid name at its native level to the console } catch (LipidException ptve) { // catch this for any parsing or semantic issues with a lipid ptve.printStackTrace(); } //alternatively, use the other parsers. Don't forget to place try catch blocks around the following lines, as for the SwissLipids parser example // use the LipidMAPS parser LipidMapsParser lmParser = new LipidMapsParser(); LipidMapsParserEventHandler lmHandler = lmParser.newEventHandler(); LipidAdduct lmlipid = lmParser.parse(ref, lmHandler); // use the shorthand notation parser GOSLIN GoslinParser goslinParser = new GoslinParser(); GoslinParserEventHandler goslinHandler = goslinParser.newEventHandler(); LipidAdduct golipid = goslinParser.parse(ref, goslinHandler); // use the updated shorthand notation of 2020 ShorthandParser shorthandParser = new ShorthandParser(); ShorthandParserEventHandler shorthandHandler = shorthandParser.newEventHandler(); // calling parse with the optional argument false suppresses any exceptions, if errors are encountered, the returned LipidAdduct will be null LipidAdduct shlipid = shorthandParser.parse(ref, shorthandHandler, false); ``` -------------------------------- ### Report Lipid Hierarchies with LipidParser Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Demonstrates how to use the generic LipidParser to retrieve lipid names at different hierarchy levels. Requires importing LipidLevel. ```python from pygoslin.parser.Parser import * from pygoslin.domain.LipidLevel import LipidLevel parser = LipidParser() ``` -------------------------------- ### Load rgoslin Package in R Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Loads the rgoslin package into the current R session, making its functions available for use. ```r library(rgoslin) ``` -------------------------------- ### List Available Grammars in rgoslin Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Lists all the shorthand lipid nomenclature grammars currently supported by the rgoslin package. This helps in selecting the appropriate grammar for parsing. ```r listAvailableGrammars() ``` -------------------------------- ### Specific Parsers for Performance (C++) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Instantiates specific parsers to potentially increase parsing performance by focusing on a single grammar. These include GoslinParser, GoslinFragmentParser, LipidMapsParser, SwissLipidsParser, and HmdbParser. ```c++ GoslinParser goslin_parser; GoslinFragmentParser goslin_fragment_parser; LipidMapsParser lipid_maps_parser; SwissLipidsParser swiss_lipids_parser; HmdbParser hmdb_parser; ``` -------------------------------- ### Parse and print lipid name using default grammar Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Demonstrates the basic usage of LipidParser to parse a lipid name string and print its canonical representation. Includes exception handling for parsing errors. ```python from pygoslin.parser.Parser import LipidParser lipid_parser = LipidParser() # setup the parser lipid_name = "PE 16:1-12:0" try: lipid = lipid_parser.parse(lipid_name) # start parsing print(lipid.get_lipid_string()) except Exception as e: print(e) # handle the exception ``` -------------------------------- ### Parse lipid name using LipidMapsParser Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md Illustrates how to use the LipidMapsParser for parsing lipid names according to the LipidMaps convention. Includes error handling. ```python # 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) ``` -------------------------------- ### Run rgoslin Unit Tests in R Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Executes the unit tests for the rgoslin package using the 'testthat' R package. Tests are located in the 'tests' folder. ```r library(devtools) test() ``` -------------------------------- ### Write Output to File (jgoslin CLI) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses lipid names from a file using a specific grammar and writes the tab-separated output to a specified file ('goslin-out.tsv'). ```bash java -jar jgoslin-cli-.jar -f examples/lipidnames.txt -g GOSLIN -o ``` -------------------------------- ### Parse Multiple Lipid Names from File (jgoslin CLI) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses multiple lipid names from a text file using jgoslin CLI. Each lipid name should be on a new line. ```bash java -jar jgoslin-cli-.jar -f examples/lipidnames.txt ``` -------------------------------- ### Parse lipid name using HmdbParser Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md Demonstrates how to use the HmdbParser for parsing lipid names from the HMDB database. Includes error handling. ```python # 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) ``` -------------------------------- ### Parse lipid name using GoslinParser Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md Shows how to specifically use the GoslinParser to parse a lipid name. Includes error handling for cases where parsing fails. ```python # 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) ``` -------------------------------- ### Parse lipid name using GoslinFragmentParser Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md Demonstrates the usage of GoslinFragmentParser. Note that this parser does not perform validation on the fragment. ```python # 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) ``` -------------------------------- ### Parse Single Lipid Name (jgoslin CLI) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses a single lipid name from the command line using jgoslin CLI. It displays detailed parsing results. ```bash java -jar jgoslin-cli-.jar -n "Cer(d18:1/20:2)" ``` -------------------------------- ### Parse Lipid Names with Specific Grammar (jgoslin CLI) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses lipid names from a file using a specific grammar ('GOSLIN') with jgoslin CLI. This ensures consistent parsing rules. ```bash java -jar jgoslin-cli-.jar -f examples/lipidnames.txt -g GOSLIN ``` -------------------------------- ### Parse lipid name using SwissLipidsParser Source: https://github.com/lifs-tools/pygoslin/blob/master/README.md Shows the usage of SwissLipidsParser for parsing lipid names following the SwissLipids standard. Error handling is included. ```python # 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) ``` -------------------------------- ### Parse Lipid Names with Goslin Grammar (R) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses a vector of lipid names using the 'Goslin' grammar. This is useful for standardizing lipid nomenclature. ```r originalNames <- c("PC 32:1","LPC 34:1","TAG 18:1_18:0_16:1") multipleLipidNamesWithGrammar <- parseLipidNamesWithGrammar(originalNames, "Goslin") ``` -------------------------------- ### Parse Multiple Lipid Names with rgoslin Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses a vector of multiple shorthand lipid names simultaneously. Returns a data frame with properties for each parsed lipid. ```r multipleLipidNamesDf <- parseLipidNames(c("PC 32:1","LPC 34:1","TG(18:1_18:0_16:1)")) ``` -------------------------------- ### Parse Lipid Name with Specific Grammar in rgoslin Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses a lipid name using a manually specified grammar (e.g., 'LipidMaps'). This allows for targeted parsing against a particular nomenclature standard. ```r originalName <- "TG(16:1(5E)/18:0/20:2(3Z,6Z))" tagDf <- rgoslin::parseLipidNameWithGrammar(originalName, "LipidMaps") ``` -------------------------------- ### Parse Lipid Names with Adducts (R) Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses lipid names that include adduct information. The parser automatically populates 'Adduct' and 'AdductCharge' columns. ```r originalNames <- c("PC 32:1[M+H]1+", "PC 32:1 [M+H]+","PC 32:1") lipidNamesWithAdduct <- parseLipidNamesWithGrammar(originalNames, "Goslin") ``` -------------------------------- ### Parse Single Lipid Name with rgoslin Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Parses a single shorthand lipid name and returns a data frame containing its properties. This is a fundamental parsing operation. ```r df <- parseLipidName("PC 32:1") ``` -------------------------------- ### Validate Lipid Name with rgoslin Source: https://github.com/lifs-tools/pygoslin/blob/master/pygoslin/data/goslin/docs/README.adoc Checks if a given lipid name string can be parsed by any of the available parsers in rgoslin. Returns TRUE if parseable, FALSE otherwise. ```r isValidLipidName("PC 32:1") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.