tab-delimited-export-formatting-for-metabolomics
Summary
Export processed metabolite data, sample metadata, and feature metadata from a Metaboprep object into tab-delimited text files (.txt/.tsv) for downstream analysis in external tools. This skill enables interoperability by converting in-memory R objects into portable, standard tabular formats.
When to use
After completing batch normalization and quality control filtering on a Metaboprep object, when you need to share processed metabolomics data with collaborators, import into other statistical packages, or archive results in a platform-independent format. Trigger: you have a post-QC Metaboprep object and require tab-delimited outputs.
When NOT to use
- Input is already in tab-delimited format and requires no further conversion
- You need to preserve intermediate QC layers (use export with format='all' or other multi-layer options instead)
- Downstream analysis requires native R Metaboprep object methods (e.g. feature_summary, sample_summary with tree_cut_height)
Inputs
- Metaboprep object (post-quality_control)
- Output directory path (string)
Outputs
- Tab-delimited processed data matrix (.txt or .tsv)
- Tab-delimited sample metadata (.txt or .tsv)
- Tab-delimited feature metadata (.txt or .tsv)
How to apply
Load a quality-controlled Metaboprep object (post-batch_normalise and post-quality_control). Call the export() function with format='metaboprep' and specify an output directory; this writes three tab-delimited files: the processed data matrix, sample metadata (with exclusion flags and annotations), and feature metadata (with biochemical identifiers and exclusion codes). Verify file creation and check that row/column counts match expected sample and feature counts post-filtering. The export captures the final 'qc' data layer and all associated metadata, making it suitable for external validation, visualization, or statistical modeling.
Related tools
- metaboprep (R package containing export() function and Metaboprep class definition) — https://github.com/MRCIEU/metaboprep
- R (Host language for Metaboprep object manipulation and export execution)
Examples
export(mydata, directory = output_dir, format = "metaboprep")
Evaluation signals
- Three tab-delimited files are created in the specified output directory with expected naming convention
- File row counts match number of retained samples (post-exclusion) and feature counts (post-exclusion)
- Sample metadata includes exclusion-related columns (reason_excluded, excluded flag)
- Feature metadata includes biochemical annotation columns (metabolite_id, pathway, kegg, group_hmdb) and exclusion codes
- Tab-delimited format can be successfully read into external tools (e.g., pandas, base R read.table, spreadsheet software) without parsing errors
Limitations
- Export does not include visualization outputs (dendrogram trees, PCA plots); generate_report() should be used for HTML report and plots
- Floating-point precision may be affected by tab-delimited serialization; verify precision matches original data layer if needed for very strict comparisons
- No built-in version tracking or provenance metadata in the exported files; document Metaboprep version and QC parameters separately
Evidence
- [methods] Call export() with format='metaboprep' to write processed data, sample metadata, and feature metadata as tab-delimited text files: "Call export() with format='metaboprep' to write processed data, sample metadata, and feature metadata as tab-delimited text files to the specified output directory."
- [readme] metaboprep generates tab-delimited text file outputs suitable for use elsewhere: "Read in and processes (un)targeted metabolite data, saving datasets in tab-delimited format for use elsewhere"
- [methods] Verify that tab-delimited exports exist after export function call: "Verify that the HTML report file (project_name_metaboprep_qc_report.html) and associated tab-delimited exports (.txt/.tsv) exist in the output directory."
- [readme] metaboprep provides tab-delimited text file and HTML report as summary outputs: "Provide useful summary data in the form of tab-delimited text file and a html report"
1---2name: tab-delimited-export-formatting-for-metabolomics3description: Use when after completing batch normalization and quality control filtering on a Metaboprep object, when you need to share processed metabolomics data with collaborators, import into other statistical packages, or archive results in a platform-independent format.4license: CC-BY-4.05---67# tab-delimited-export-formatting-for-metabolomics89## Summary1011Export processed metabolite data, sample metadata, and feature metadata from a Metaboprep object into tab-delimited text files (.txt/.tsv) for downstream analysis in external tools. This skill enables interoperability by converting in-memory R objects into portable, standard tabular formats.1213## When to use1415After completing batch normalization and quality control filtering on a Metaboprep object, when you need to share processed metabolomics data with collaborators, import into other statistical packages, or archive results in a platform-independent format. Trigger: you have a post-QC Metaboprep object and require tab-delimited outputs.1617## When NOT to use1819- Input is already in tab-delimited format and requires no further conversion20- You need to preserve intermediate QC layers (use export with format='all' or other multi-layer options instead)21- Downstream analysis requires native R Metaboprep object methods (e.g. feature_summary, sample_summary with tree_cut_height)2223## Inputs2425- Metaboprep object (post-quality_control)26- Output directory path (string)2728## Outputs2930- Tab-delimited processed data matrix (.txt or .tsv)31- Tab-delimited sample metadata (.txt or .tsv)32- Tab-delimited feature metadata (.txt or .tsv)3334## How to apply3536Load a quality-controlled Metaboprep object (post-batch_normalise and post-quality_control). Call the export() function with format='metaboprep' and specify an output directory; this writes three tab-delimited files: the processed data matrix, sample metadata (with exclusion flags and annotations), and feature metadata (with biochemical identifiers and exclusion codes). Verify file creation and check that row/column counts match expected sample and feature counts post-filtering. The export captures the final 'qc' data layer and all associated metadata, making it suitable for external validation, visualization, or statistical modeling.3738## Related tools3940- **metaboprep** (R package containing export() function and Metaboprep class definition) — https://github.com/MRCIEU/metaboprep41- **R** (Host language for Metaboprep object manipulation and export execution)4243## Examples4445```46export(mydata, directory = output_dir, format = "metaboprep")47```4849## Evaluation signals5051- Three tab-delimited files are created in the specified output directory with expected naming convention52- File row counts match number of retained samples (post-exclusion) and feature counts (post-exclusion)53- Sample metadata includes exclusion-related columns (reason_excluded, excluded flag)54- Feature metadata includes biochemical annotation columns (metabolite_id, pathway, kegg, group_hmdb) and exclusion codes55- Tab-delimited format can be successfully read into external tools (e.g., pandas, base R read.table, spreadsheet software) without parsing errors5657## Limitations5859- Export does not include visualization outputs (dendrogram trees, PCA plots); generate_report() should be used for HTML report and plots60- Floating-point precision may be affected by tab-delimited serialization; verify precision matches original data layer if needed for very strict comparisons61- No built-in version tracking or provenance metadata in the exported files; document Metaboprep version and QC parameters separately6263## Evidence6465- [methods] Call export() with format='metaboprep' to write processed data, sample metadata, and feature metadata as tab-delimited text files: "Call export() with format='metaboprep' to write processed data, sample metadata, and feature metadata as tab-delimited text files to the specified output directory."66- [readme] metaboprep generates tab-delimited text file outputs suitable for use elsewhere: "Read in and processes (un)targeted metabolite data, saving datasets in tab-delimited format for use elsewhere"67- [methods] Verify that tab-delimited exports exist after export function call: "Verify that the HTML report file (project_name_metaboprep_qc_report.html) and associated tab-delimited exports (.txt/.tsv) exist in the output directory."68- [readme] metaboprep provides tab-delimited text file and HTML report as summary outputs: "Provide useful summary data in the form of tab-delimited text file and a html report"