agentsclimarketplace

Csv to dictionary conversion

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/csv-to-dictionary-conversion

Use when you have a CSV file containing molecule definitions (chemical formula, m/z, intensity, retention time, or other peak properties) and need to prepare it for SMITER's simulation workflow.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill csv-to-dictionary-conversion

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 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

6.0 KB, 943 tokens by cl100k_base, as published. Nobody here has run it

csv-to-dictionary-conversion

Summary

Convert a CSV file of molecule definitions into a peak properties dictionary structure required by SMITER's LC-MS/MS simulation pipeline. This transformation bridges tabular input data to the nested dictionary format consumed by fragmentors, noise generators, and mzML writers.

When to use

You have a CSV file containing molecule definitions (chemical formula, m/z, intensity, retention time, or other peak properties) and need to prepare it for SMITER's simulation workflow. This skill is required as the first step before choosing a fragmentor, noise generator, and running the synthetic mzML generation.

When NOT to use

  • The input is already in peak properties dictionary format (no conversion needed)
  • The CSV file lacks required columns such as chemical formula or m/z (conversion will fail or produce incomplete output)
  • You are simulating molecules using only SMITER's default parameters without custom peak definitions

Inputs

  • CSV file containing molecule definitions (from example_data or user-generated)
  • CSV schema with columns for chemical formula, m/z, intensity, retention time, or equivalent peak properties

Outputs

  • Peak properties dictionary (Python dict) with required nested structure
  • Pickled or JSON serialization of the peak properties dictionary for use in simulation

How to apply

Use SMITER's smiter.lib.csv_to_peak_properties function to convert the tabular CSV data into a nested peak properties dictionary. Load the CSV file using standard Python file I/O, apply the conversion function, and validate that the resulting dictionary contains the required keys (e.g., molecule identifiers, chemical formulas, peak properties) expected by SMITER's fragmentation and noise injection functions. Serialize the validated dictionary to pickle or JSON format for consumption by downstream simulation steps (fragmentor selection, noise injection, and mzML synthesis).

Related tools

  • SMITER (Provides the csv_to_peak_properties conversion function within smiter.lib; orchestrates the complete LC-MS/MS simulation pipeline after dictionary creation) — https://github.com/LeidelLab/SMITER
  • Python (Runtime environment for executing SMITER library functions and file I/O operations)
  • pyQms (Enables highly-accurate isotopic pattern calculations used in peak property calculations downstream) — https://github.com/pyQms/pyqms

Examples

from smiter.lib import csv_to_peak_properties; peak_dict = csv_to_peak_properties('example_data.csv'); import pickle; pickle.dump(peak_dict, open('peak_properties.pkl', 'wb'))

Evaluation signals

  • Dictionary keys match SMITER's expected schema (validate against fragmentation and noise injection function signatures)
  • All required molecule properties (chemical formula, m/z, intensity, retention time) are present and non-null in the output dictionary
  • Pickle or JSON serialization completes without errors and can be deserialized without data loss
  • Dictionary structure passes validation before being passed to fragmentation function (e.g., fragmentation_functions.PeptideFragmentor)
  • Molecule counts and property value ranges (e.g., m/z > 0, intensity >= 0) match the input CSV

Limitations

  • CSV schema must match SMITER's expected column names and data types; non-standard formats will cause conversion failure
  • Conversion does not validate chemical formula correctness or plausibility; invalid formulas will propagate into the dictionary
  • No automatic handling of missing or malformed values in the CSV; preprocessing is required before conversion
  • Dictionary size is bounded by available system memory; very large CSV files may cause memory exhaustion

Evidence

  • [other] SMITER provides the csv_to_peak_properties function within its library to convert CSV files containing molecule definitions into the peak properties dictionary format consumed by the simulation workflow.: "You can convert a csv file (as in example_data) to csv using smiter.lib.csv_to_peak_properties"
  • [other] Peak properties dictionary is the first required step in the SMITER simulation workflow, followed by fragmentor and noise generator selection.: "1. create the peak properties dict (You can convert a csv file (as in example_data) to csv using smiter.lib.csv_to_peak_properties)"
  • [abstract] SMITER enables simulation of any biomolecule via chemical formula abstraction, which is reflected in the peak properties dictionary structure.: "It enables the simulation of any biomolecule since all calculations are based on the chemical formulas."
  • [other] The resulting dictionary must be serialized for use in subsequent simulation steps.: "Serialize the peak properties dictionary to a Python pickle or JSON file for use in subsequent simulation steps."

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,782. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.