metabolite-annotation-result-export
Summary
Export completed metabolite annotations from a MetaboAnnotatoR annotations object to a user-specified directory as a suite of structured output files (global results table, ranked results per feature, ranked spectra PDFs, and pseudo-MS/MS MGF). This skill ensures all annotation results are serialized in standardized, reusable formats for downstream analysis and reporting.
When to use
After running the annotateRC function on LC-MS All-ion fragmentation (AIF) features and obtaining a populated annotations object with ranked candidate matches, use this skill when you need to persist results to disk for archival, sharing, or downstream interpretation (e.g., manual curation of top-ranked candidates, integration with other metabolomics pipelines, or generation of publication-quality spectra visualizations).
When NOT to use
- If the annotations object is empty or contains no annotated features
- If the output directory path is read-only or does not exist and cannot be created
- If you only need to inspect top-ranked candidates interactively and do not require persistent file export
Inputs
- MetaboAnnotatoR annotations object (from annotateRC output)
- Output directory path (must be writable)
Outputs
- Global results table (consolidated annotation summary)
- Ranked results file (per-feature candidate rankings)
- Ranked spectra PDFs (one per feature, showing matched ions)
- Pseudo-MS/MS MGF file (combined fragmentation spectra)
How to apply
Invoke the saveAnnotations function with the annotations object (output from annotateRC) and a valid output directory path. Enable all save flags (save global results, ranked results, ranked spectra PDFs, and pseudo-MS/MS MGF) to write the complete annotation output set. The function will automatically enumerate all annotated features and generate one ranked results file per feature, one PDF per ranked spectrum visualization, and a single combined MGF file containing all pseudo-MS/MS spectra. Verify that all expected file types are present in the output directory and that each file is non-empty (file size > 0 bytes) before downstream use.
Related tools
Examples
saveAnnotations(annotations_obj, output_dir = "/path/to/results", saveGlobal = TRUE, saveRanked = TRUE, savePDF = TRUE, saveMGF = TRUE)
Evaluation signals
- All expected output files are present in the specified directory (global results, ranked results, ranked spectra PDFs for each feature, MGF file)
- Each output file has size > 0 bytes (non-empty validation)
- Ranked results files contain valid tabular data with candidate metabolite names, match scores, and feature identifiers
- Ranked spectra PDFs render without errors and display ion-matched spectra with peak annotations
- MGF file parses without errors and contains valid MS1/MS2 spectrum entries in standard MGF format
Limitations
- Requires a fully annotated annotations object from annotateRC; will fail or produce empty outputs if no features were successfully matched to fragment libraries
- PDF generation depends on system graphics libraries; some headless/containerized environments may require additional X11 or graphics device configuration
- MGF file combines all spectra into a single file; very large annotation runs may produce large MGF files that require memory-efficient parsing downstream
- No built-in versioning or overwrite protection; re-running saveAnnotations to the same directory will overwrite existing files without warning
Evidence
- [other] The saveAnnotations function is invoked with parameters to save global annotations, ranked results, ranked spectra as PDFs, and pseudo-MS/MS spectra as MGF files to a temporary directory, with all save flags enabled to write the full set of annotation outputs.: "Call saveAnnotations with the annotations object and a temporary directory path as output destination... Verify presence of global results file, ranked results file, ranked spectra PDF files (one per"
- [intro] It is possible to save the annotation results to a user-specified directory: "It is possible to save the annotation results to a user-specified directory"
- [intro] MetaboAnnotatoR is designed to perform metabolite annotation of features from LC-MS All-ion fragmentation (AIF) datasets, using ion fragment databases: "MetaboAnnotatoR is designed to perform metabolite annotation of features from LC-MS All-ion fragmentation (AIF) datasets, using ion fragment databases"
- [other] Check that each file is non-empty (file size > 0 bytes).: "Check that each file is non-empty (file size > 0 bytes)."
- [intro] It requires raw LC-MS AIF chromatograms acquired/transformed in centroid mode.: "It requires raw LC-MS AIF chromatograms acquired/transformed in centroid mode."
1---2name: metabolite-annotation-result-export3description: Use when after running the annotateRC function on LC-MS All-ion fragmentation (AIF) features and obtaining a populated annotations object with ranked candidate matches, use this skill when you need to persist results to disk for archival, sharing, or downstream interpretation (e.4license: CC-BY-4.05---67# metabolite-annotation-result-export89## Summary1011Export completed metabolite annotations from a MetaboAnnotatoR annotations object to a user-specified directory as a suite of structured output files (global results table, ranked results per feature, ranked spectra PDFs, and pseudo-MS/MS MGF). This skill ensures all annotation results are serialized in standardized, reusable formats for downstream analysis and reporting.1213## When to use1415After running the annotateRC function on LC-MS All-ion fragmentation (AIF) features and obtaining a populated annotations object with ranked candidate matches, use this skill when you need to persist results to disk for archival, sharing, or downstream interpretation (e.g., manual curation of top-ranked candidates, integration with other metabolomics pipelines, or generation of publication-quality spectra visualizations).1617## When NOT to use1819- If the annotations object is empty or contains no annotated features20- If the output directory path is read-only or does not exist and cannot be created21- If you only need to inspect top-ranked candidates interactively and do not require persistent file export2223## Inputs2425- MetaboAnnotatoR annotations object (from annotateRC output)26- Output directory path (must be writable)2728## Outputs2930- Global results table (consolidated annotation summary)31- Ranked results file (per-feature candidate rankings)32- Ranked spectra PDFs (one per feature, showing matched ions)33- Pseudo-MS/MS MGF file (combined fragmentation spectra)3435## How to apply3637Invoke the saveAnnotations function with the annotations object (output from annotateRC) and a valid output directory path. Enable all save flags (save global results, ranked results, ranked spectra PDFs, and pseudo-MS/MS MGF) to write the complete annotation output set. The function will automatically enumerate all annotated features and generate one ranked results file per feature, one PDF per ranked spectrum visualization, and a single combined MGF file containing all pseudo-MS/MS spectra. Verify that all expected file types are present in the output directory and that each file is non-empty (file size > 0 bytes) before downstream use.3839## Related tools4041- **MetaboAnnotatoR** (Provides saveAnnotations function and manages annotation object serialization) — https://github.com/gggraca/MetaboAnnotatoR42- **R** (Execution environment (version 4.5.0 or higher required))4344## Examples4546```47saveAnnotations(annotations_obj, output_dir = "/path/to/results", saveGlobal = TRUE, saveRanked = TRUE, savePDF = TRUE, saveMGF = TRUE)48```4950## Evaluation signals5152- All expected output files are present in the specified directory (global results, ranked results, ranked spectra PDFs for each feature, MGF file)53- Each output file has size > 0 bytes (non-empty validation)54- Ranked results files contain valid tabular data with candidate metabolite names, match scores, and feature identifiers55- Ranked spectra PDFs render without errors and display ion-matched spectra with peak annotations56- MGF file parses without errors and contains valid MS1/MS2 spectrum entries in standard MGF format5758## Limitations5960- Requires a fully annotated annotations object from annotateRC; will fail or produce empty outputs if no features were successfully matched to fragment libraries61- PDF generation depends on system graphics libraries; some headless/containerized environments may require additional X11 or graphics device configuration62- MGF file combines all spectra into a single file; very large annotation runs may produce large MGF files that require memory-efficient parsing downstream63- No built-in versioning or overwrite protection; re-running saveAnnotations to the same directory will overwrite existing files without warning6465## Evidence6667- [other] The saveAnnotations function is invoked with parameters to save global annotations, ranked results, ranked spectra as PDFs, and pseudo-MS/MS spectra as MGF files to a temporary directory, with all save flags enabled to write the full set of annotation outputs.: "Call saveAnnotations with the annotations object and a temporary directory path as output destination... Verify presence of global results file, ranked results file, ranked spectra PDF files (one per"68- [intro] It is possible to save the annotation results to a user-specified directory: "It is possible to save the annotation results to a user-specified directory"69- [intro] MetaboAnnotatoR is designed to perform metabolite annotation of features from LC-MS All-ion fragmentation (AIF) datasets, using ion fragment databases: "MetaboAnnotatoR is designed to perform metabolite annotation of features from LC-MS All-ion fragmentation (AIF) datasets, using ion fragment databases"70- [other] Check that each file is non-empty (file size > 0 bytes).: "Check that each file is non-empty (file size > 0 bytes)."71- [intro] It requires raw LC-MS AIF chromatograms acquired/transformed in centroid mode.: "It requires raw LC-MS AIF chromatograms acquired/transformed in centroid mode."