Data structure design for spectral searches
Use when you have raw GC-MS output in CSV format with columns Component.RT, Base.Peak.MZ, Component.Area, Compound.Name, Match.Factor, and File.From its SKILL.md
npx -y skills add HolobiomicsLab/asb-skill-collections --skill data-structure-design-for-spectral-searchesAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
7.8 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it
data-structure-design-for-spectral-searches
License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->
Summary
Design and construct nested data structures that organize raw GC-MS spectral data into searchable indexes keyed by chemical identity, retention time, and exact mass. This skill enables downstream functions to perform rapid intelligent sorting, aggregation, and chemical metadata retrieval across multi-sample datasets.
When to use
Apply this skill when you have raw GC-MS output in CSV format with columns Component.RT, Base.Peak.MZ, Component.Area, Compound.Name, Match.Factor, and File.Name, and you need to prepare the data for chemical searches, sorting by retention time and published masses, or aggregation across multiple samples describing the same chemical.
When NOT to use
- Input CSV is missing required column names or has incorrect data types for RT, m/z, or mass values
- Data is already in a processed, matrix or feature-table format designed for downstream statistical analysis
- Compound names cannot be reliably matched to PubChem or webchem databases (e.g., proprietary or novel compounds without published metadata)
Inputs
- CSV file with columns: Component.RT, Base.Peak.MZ, Component.Area, Compound.Name, Match.Factor, File.Name
- PubChem and chemical name registry data (via webchem package queries)
Outputs
- R list object (standard_spread) containing organized matrices and nested metadata
- RDS serialized file containing the complete spread structure
- rtBYmass unique identifiers (retention time concatenated with exact mass)
How to apply
Load the raw CSV using R's read.csv() and extract individual columns (Compound.Name, Component.RT, Match.Factor, Base.Peak.MZ, Component.Area) into separate matrices with samples as columns and entries as rows. Query webchem and PubChem via the webchem R package to retrieve published chemical metadata for each unique compound name, including all synonyms, top m/z peaks, exact molecular mass, and retention time ranges. Construct a unique identifier for each data point by concatenating retention time and exact mass (rtBYmass) to enable precise matching. Build a nested R list (webInfo) indexed by compound name, storing published names, top m/z peaks, exact mass, and retention time ranges. Finally, aggregate all matrices and the nested metadata list into a single R list object (standard_spread) and serialize as an RDS file for downstream functions to access.
Related tools
- webchem (Query chemical metadata (synonyms, m/z peaks, exact mass, retention time ranges) from PubChem and published databases for compound name normalization and enrichment) — https://cran.r-project.org/web/packages/webchem/index.html
- ChemmineR (Provide cheminformatics functions for chemical structure analysis and data organization within the uafR workflow) — https://www.bioconductor.org/packages/release/bioc/html/ChemmineR.html
- R (Core language for automating matrix construction, list aggregation, and RDS serialization of the spread structure)
- PubChem (Source database for published chemical metadata (synonyms, molecular properties, spectral peaks) queried via webchem) — https://pubchem.ncbi.nlm.nih.gov/
Examples
input_dat = read.csv("your/gcms/dataset.csv"); input_spread = spreadOut(input_dat)
Evaluation signals
- Verify all six required CSV columns are present and successfully parsed (Component.RT, Base.Peak.MZ, Component.Area, Compound.Name, Match.Factor, File.Name)
- Confirm that each unique compound name was successfully queried in PubChem/webchem and that webInfo contains non-null entries for published synonyms, exact mass, and top m/z peaks
- Check that rtBYmass identifiers are unique per data point and concatenate both retention time and exact mass correctly
- Validate the nested list structure: standard_spread should contain separate matrices for each column plus a webInfo sub-list indexed by compound name
- Verify the RDS file deserializes without error and retains all data types (numeric matrices and character/list metadata)
Limitations
- Compound name matching to PubChem relies on exact string matching or fuzzy matching via webchem; misspellings, abbreviations, or proprietary names may fail to retrieve metadata
- Retention time ranges from published literature may not match the user's experimental instrument, method, or column type; rtBYmass identifiers are only valid within the context of the user's GC-MS method
- The skill requires internet connectivity to query PubChem and webchem; offline use is not supported
- If multiple compounds have very similar retention times and exact masses, the rtBYmass identifier may not fully disambiguate them; additional orthogonal data (e.g., RI values) may be needed
Evidence
- [readme] Column requirements and raw input: "The column names MUST include: 'Component.RT', 'Component.Area', 'Base.Peak.MZ', 'File.Name', 'Compound.Name', and 'Match.Factor' in no particular order."
- [methods] Core workflow of spreadOut function: "spreadOut() prepares the read in .CSV for intelligent sorting (using retention times and published masses) then aggregation (using all published names and top m/z peaks) of sample portions that"
- [other] Data structure organization into matrices: "Organize data into separate matrices: extract and reshape Compound.Name, Component.RT, Match.Factor, Base.Peak.MZ, Component.Area columns, each with samples as columns and entries as rows."
- [other] Webchem metadata retrieval: "Query webchem and PubChem via the webchem package to retrieve published chemical metadata for each unique compound name (all published synonyms, top m/z peaks, exact molecular mass, likely retention"
- [other] Unique identifier construction: "Construct a unique identifier for each data point by concatenating retention time and exact mass (rtBYmass)."
- [other] Final nested list aggregation: "Aggregate all matrices and the nested metadata list into a single R list object (standard_spread) and serialize as an RDS file."
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.