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."
1---2name: csv-to-dictionary-conversion3description: 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.4license: CC-BY-4.05---67# csv-to-dictionary-conversion89## Summary1011Convert 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.1213## When to use1415You 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.1617## When NOT to use1819- The input is already in peak properties dictionary format (no conversion needed)20- The CSV file lacks required columns such as chemical formula or m/z (conversion will fail or produce incomplete output)21- You are simulating molecules using only SMITER's default parameters without custom peak definitions2223## Inputs2425- CSV file containing molecule definitions (from example_data or user-generated)26- CSV schema with columns for chemical formula, m/z, intensity, retention time, or equivalent peak properties2728## Outputs2930- Peak properties dictionary (Python dict) with required nested structure31- Pickled or JSON serialization of the peak properties dictionary for use in simulation3233## How to apply3435Use 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).3637## Related tools3839- **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/SMITER40- **Python** (Runtime environment for executing SMITER library functions and file I/O operations)41- **pyQms** (Enables highly-accurate isotopic pattern calculations used in peak property calculations downstream) — https://github.com/pyQms/pyqms4243## Examples4445```46from 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'))47```4849## Evaluation signals5051- Dictionary keys match SMITER's expected schema (validate against fragmentation and noise injection function signatures)52- All required molecule properties (chemical formula, m/z, intensity, retention time) are present and non-null in the output dictionary53- Pickle or JSON serialization completes without errors and can be deserialized without data loss54- Dictionary structure passes validation before being passed to fragmentation function (e.g., fragmentation_functions.PeptideFragmentor)55- Molecule counts and property value ranges (e.g., m/z > 0, intensity >= 0) match the input CSV5657## Limitations5859- CSV schema must match SMITER's expected column names and data types; non-standard formats will cause conversion failure60- Conversion does not validate chemical formula correctness or plausibility; invalid formulas will propagate into the dictionary61- No automatic handling of missing or malformed values in the CSV; preprocessing is required before conversion62- Dictionary size is bounded by available system memory; very large CSV files may cause memory exhaustion6364## Evidence6566- [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`"67- [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`)"68- [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."69- [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."