lipid-nomenclature-pattern-matching
Summary
Recover and standardize unparsed lipid molecule names that do not follow supported naming conventions by applying regular expression pattern matching. This skill enables successful parsing of molecules with full chemical names (e.g., Ceramides) into canonical lipidomics formats, expanding the set of analyzable lipids in a LipidomicsExperiment.
When to use
When loading a lipidomics dataset into lipidr and the parsing step generates warnings about unparsed molecules due to unsupported naming patterns. This typically occurs with datasets from Metabolomics Workbench or similar sources where lipid names use full chemical nomenclature instead of standardized abbreviations (e.g., 'Ceramide (d18:1/16:0)' instead of 'Cer (d18:1/16:0)').
When NOT to use
- Lipid names already follow supported abbreviation patterns (e.g., 'PC (', 'TG (', 'Cer (') — no transformation needed.
- The unparsed molecules represent genuine annotation errors or species not supported by lipidr — renaming will not resolve semantic mismatches.
- Structural information (chain lengths, unsaturation) is absent or ambiguous in the original name — pattern matching cannot reliably recover it.
Inputs
- LipidomicsExperiment object with unparsed molecule names
- Parsing warnings indicating molecules with unsupported naming patterns
- Lipid name strings with full chemical nomenclature (e.g., 'Ceramide (d18:1/16:0)')
Outputs
- LipidomicsExperiment object with standardized lipid names following supported conventions
- Set of successfully recovered and renamed lipid molecules
- Updated parsing status reflecting newly recognized lipids
How to apply
After calling fetch_mw_study() or read_skyline() to load the dataset, examine parsing warnings to identify the naming pattern of unparsed molecules. Use regular expressions to match and replace the variable prefix portion while preserving the core lipid class and structural information. For Ceramides, the pattern '^.* (' matches any initial text up to an opening parenthesis, which is then replaced with 'Cer (' to conform to the supported convention. Apply this transformation using string manipulation in R, then re-parse or validate the renamed molecules. The rationale is that the lipid structure (chain lengths, unsaturation, functional groups) is preserved in the portion after the opening parenthesis, so only the prefix nomenclature requires standardization.
Related tools
- lipidr (Primary R package used to load, parse, and manage LipidomicsExperiment objects; provides the fetch_mw_study() function and parsing infrastructure.) — https://github.com/ahmohamed/lipidr
- R (base) (Execution environment for regex pattern matching via sub(), gsub(), or stringr functions to rename lipid molecules.)
- Metabolomics Workbench API (Source of lipidomics datasets (e.g., study ST001111) that may contain non-standardized lipid names requiring pattern matching.) — https://www.metabolomicsworkbench.org
Examples
# After loading study ST001111 and observing parsing warnings
d <- fetch_mw_study('ST001111')
# Rename unparsed Ceramide molecules: 'Ceramide (d18:1/16:0)' → 'Cer (d18:1/16:0)'
lipid_names(d) <- sub('^.* \\(', 'Cer (', lipid_names(d))
Evaluation signals
- All molecules matching the target pattern (e.g., '.*(') are successfully renamed to the canonical form (e.g., 'Cer (') without data loss.
- The renamed LipidomicsExperiment object contains no parsing warnings for the previously unparsed molecules.
- Structural information (e.g., chain lengths, unsaturation) in the portion after '(' is preserved identically before and after renaming.
- Downstream analyses (PCA, differential expression, enrichment) run without errors using the newly standardized molecule names.
- The number of recognized lipid molecules increases and the number of unparsed molecules decreases after applying the pattern-matching transformation.
Limitations
- Regular expression patterns must be carefully tailored to each non-standard naming convention; a single pattern may not capture all variants (e.g., spacing, punctuation differences).
- Pattern matching relies on the assumption that the chemical structure is encoded consistently in the portion after the opening parenthesis; if structure notation itself varies, additional transformations may be required.
- Molecules with missing or incomplete structural information (e.g., 'Ceramide' without chain specification) cannot be reliably recovered by this approach alone.
- The skill does not validate whether renamed molecules are chemically or biologically plausible — only that they conform to the naming convention.
Evidence
- [other] Can unparsed Ceramide molecules from study ST001111 be successfully recovered and renamed using RegEx pattern matching to follow the supported 'Cer (' naming convention?: "Can unparsed Ceramide molecules from study ST001111 be successfully recovered and renamed using RegEx pattern matching to follow the supported 'Cer (' naming convention?"
- [other] Ceramide molecules written with full chemical names can be recovered by substituting the initial portion with 'Cer' using the RegEx pattern '^.* (' to '(Cer (', enabling successful parsing of all previously unparsed molecules.: "Ceramide molecules written with full chemical names can be recovered by substituting the initial portion with 'Cer' using the RegEx pattern '^.* (' to '(Cer (', enabling successful parsing of all"
- [intro] Note the warning that some molecules were not parsed because their names did not follow the supported patterns.: "Note the warning that some molecules were not parsed because their names did not follow the supported patterns."
- [intro] We can examine these molecules, remove them from the dataset or change their names, if desired.: "We can examine these molecules, remove them from the dataset or change their names, if desired."
- [intro] Datasets can be easily downloaded and parsed into LipidomicsExperiment object using lipidr function fetch_mw_study() by supplying a study_id.: "Datasets can be easily downloaded and parsed into LipidomicsExperiment object using lipidr function fetch_mw_study() by supplying a study_id."
1---2name: lipid-nomenclature-pattern-matching3description: Use when when loading a lipidomics dataset into lipidr and the parsing step generates warnings about unparsed molecules due to unsupported naming patterns.4license: CC-BY-4.05---67# lipid-nomenclature-pattern-matching89## Summary1011Recover and standardize unparsed lipid molecule names that do not follow supported naming conventions by applying regular expression pattern matching. This skill enables successful parsing of molecules with full chemical names (e.g., Ceramides) into canonical lipidomics formats, expanding the set of analyzable lipids in a LipidomicsExperiment.1213## When to use1415When loading a lipidomics dataset into lipidr and the parsing step generates warnings about unparsed molecules due to unsupported naming patterns. This typically occurs with datasets from Metabolomics Workbench or similar sources where lipid names use full chemical nomenclature instead of standardized abbreviations (e.g., 'Ceramide (d18:1/16:0)' instead of 'Cer (d18:1/16:0)').1617## When NOT to use1819- Lipid names already follow supported abbreviation patterns (e.g., 'PC (', 'TG (', 'Cer (') — no transformation needed.20- The unparsed molecules represent genuine annotation errors or species not supported by lipidr — renaming will not resolve semantic mismatches.21- Structural information (chain lengths, unsaturation) is absent or ambiguous in the original name — pattern matching cannot reliably recover it.2223## Inputs2425- LipidomicsExperiment object with unparsed molecule names26- Parsing warnings indicating molecules with unsupported naming patterns27- Lipid name strings with full chemical nomenclature (e.g., 'Ceramide (d18:1/16:0)')2829## Outputs3031- LipidomicsExperiment object with standardized lipid names following supported conventions32- Set of successfully recovered and renamed lipid molecules33- Updated parsing status reflecting newly recognized lipids3435## How to apply3637After calling fetch_mw_study() or read_skyline() to load the dataset, examine parsing warnings to identify the naming pattern of unparsed molecules. Use regular expressions to match and replace the variable prefix portion while preserving the core lipid class and structural information. For Ceramides, the pattern '^.* \(' matches any initial text up to an opening parenthesis, which is then replaced with 'Cer (' to conform to the supported convention. Apply this transformation using string manipulation in R, then re-parse or validate the renamed molecules. The rationale is that the lipid structure (chain lengths, unsaturation, functional groups) is preserved in the portion after the opening parenthesis, so only the prefix nomenclature requires standardization.3839## Related tools4041- **lipidr** (Primary R package used to load, parse, and manage LipidomicsExperiment objects; provides the fetch_mw_study() function and parsing infrastructure.) — https://github.com/ahmohamed/lipidr42- **R (base)** (Execution environment for regex pattern matching via sub(), gsub(), or stringr functions to rename lipid molecules.)43- **Metabolomics Workbench API** (Source of lipidomics datasets (e.g., study ST001111) that may contain non-standardized lipid names requiring pattern matching.) — https://www.metabolomicsworkbench.org4445## Examples4647```48# After loading study ST001111 and observing parsing warnings49d <- fetch_mw_study('ST001111')50# Rename unparsed Ceramide molecules: 'Ceramide (d18:1/16:0)' → 'Cer (d18:1/16:0)'51lipid_names(d) <- sub('^.* \\(', 'Cer (', lipid_names(d))52```5354## Evaluation signals5556- All molecules matching the target pattern (e.g., '.*\(') are successfully renamed to the canonical form (e.g., 'Cer (') without data loss.57- The renamed LipidomicsExperiment object contains no parsing warnings for the previously unparsed molecules.58- Structural information (e.g., chain lengths, unsaturation) in the portion after '(' is preserved identically before and after renaming.59- Downstream analyses (PCA, differential expression, enrichment) run without errors using the newly standardized molecule names.60- The number of recognized lipid molecules increases and the number of unparsed molecules decreases after applying the pattern-matching transformation.6162## Limitations6364- Regular expression patterns must be carefully tailored to each non-standard naming convention; a single pattern may not capture all variants (e.g., spacing, punctuation differences).65- Pattern matching relies on the assumption that the chemical structure is encoded consistently in the portion after the opening parenthesis; if structure notation itself varies, additional transformations may be required.66- Molecules with missing or incomplete structural information (e.g., 'Ceramide' without chain specification) cannot be reliably recovered by this approach alone.67- The skill does not validate whether renamed molecules are chemically or biologically plausible — only that they conform to the naming convention.6869## Evidence7071- [other] Can unparsed Ceramide molecules from study ST001111 be successfully recovered and renamed using RegEx pattern matching to follow the supported 'Cer (' naming convention?: "Can unparsed Ceramide molecules from study ST001111 be successfully recovered and renamed using RegEx pattern matching to follow the supported 'Cer (' naming convention?"72- [other] Ceramide molecules written with full chemical names can be recovered by substituting the initial portion with 'Cer' using the RegEx pattern '^.* \(' to '(Cer (', enabling successful parsing of all previously unparsed molecules.: "Ceramide molecules written with full chemical names can be recovered by substituting the initial portion with 'Cer' using the RegEx pattern '^.* \(' to '(Cer (', enabling successful parsing of all"73- [intro] Note the warning that some molecules were not parsed because their names did not follow the supported patterns.: "Note the warning that some molecules were not parsed because their names did not follow the supported patterns."74- [intro] We can examine these molecules, remove them from the dataset or change their names, if desired.: "We can examine these molecules, remove them from the dataset or change their names, if desired."75- [intro] Datasets can be easily downloaded and parsed into LipidomicsExperiment object using lipidr function fetch_mw_study() by supplying a study_id.: "Datasets can be easily downloaded and parsed into LipidomicsExperiment object using lipidr function fetch_mw_study() by supplying a study_id."