Structured data serialization
Use when when you have mwTab-formatted Mass Spectrometry or Nuclear Magnetic Resonance experimental data from the Metabolomics Workbench that must be converted to JSON for API integration, data sharing across systems, or validation against a defined JSON schema.From its SKILL.md
npx -y skills add HolobiomicsLab/asb-skill-collections --skill structured-data-serializationAssembled 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
7.9 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it
structured-data-serialization
Summary
Convert hierarchical scientific data from mwTab file format into JSON representation (and vice versa) for interoperability, archival, and RESTful access. This skill bridges domain-specific text formats with standardized JSON by parsing metadata sections and tabular data blocks, then serializing them with schema validation.
When to use
When you have mwTab-formatted Mass Spectrometry or Nuclear Magnetic Resonance experimental data from the Metabolomics Workbench that must be converted to JSON for API integration, data sharing across systems, or validation against a defined JSON schema. Use this skill when you need bidirectional conversion between mwTab and JSON representations while preserving metadata, column names, and data types.
When NOT to use
- Input is already valid JSON with no need for mwTab representation—skip serialization.
- Data is in a different metabolomics format (mzML, mzXML, NetCDF)—use format-specific converters instead.
- Schema validation is not required and full round-trip fidelity is not a concern—use simpler JSON export.
Inputs
- mwTab-formatted text file (mwTab file from Metabolomics Workbench)
- MWTabFile object (in-memory representation of parsed mwTab data)
- JSON schema definition (for validation)
Outputs
- JSON file (serialized mwTab data in JSON Object Notation format)
- MWTabFile object (when converting from JSON back to mwTab)
- Validation report (schema compliance confirmation)
How to apply
Load the mwTab file using mwtab.fileio.read_files() to parse its text structure into an MWTabFile object. Traverse the MWTabFile object's metadata sections and tabular data blocks (e.g., METABOLITES, DATA), converting each into a JSON-compatible dictionary structure. Use pandas to handle columnar data, preserving original column names and inferred data types. Serialize the dictionary to JSON using Python's json module with proper encoding of nested objects and arrays. Validate the resulting JSON against the mwtab-defined JSON schema using jsonschema to confirm structural correctness before writing to file. This ensures lossless round-trip conversion and schema compliance.
Related tools
- mwtab (Core library for parsing mwTab files, instantiating MWTabFile objects, and providing converter functions to traverse structured data and transform into JSON-compatible dictionaries) — https://github.com/MoseleyBioinformaticsLab/mwtab
- pandas (Handles tabular data sections (METABOLITES, DATA blocks) during conversion, preserving column names and data types in the serialized output)
- jsonschema (Validates serialized JSON against mwTab-defined JSON schema to confirm structural correctness and schema compliance before file output)
- Python json module (Serializes converted dictionary structures to JSON format with proper encoding of nested objects and arrays)
Examples
import mwtab; mwfile = next(mwtab.read_files('1')); json_dict = mwtab.mwtab_to_json(mwfile); import json; json.dump(json_dict, open('output.json', 'w'))
Evaluation signals
- Output JSON validates successfully against the mwtab JSON schema using jsonschema validation.
- Tabular data sections retain all original column names and inferred data types (e.g., strings, floats, integers) after serialization.
- Round-trip conversion (mwTab → JSON → mwTab) preserves all metadata fields, block structure, and data values without loss.
- File size and nesting depth of output JSON are within expected ranges for the input mwTab file complexity.
- No encoding errors or unhandled null/missing values appear in the serialized JSON output.
Limitations
- The conversion process depends on correct mwTab file formatting; malformed input files will fail during parsing or produce incomplete MWTabFile objects.
- Data type inference during pandas conversion may require manual adjustment if column semantics are ambiguous or non-standard.
- Schema validation only confirms structural compliance; it does not validate semantic correctness of metabolomics metadata (e.g., whether study_id values are registered with Metabolomics Workbench).
- Large mwTab files with many DATA blocks or high-dimensional tabular sections may require significant memory during conversion and pandas intermediate processing.
Evidence
- [other] The mwtab package implements a conversion process that converts from mwTab file format into its equivalent JSON file format and vice versa.: "The mwtab package implements a conversion process that converts from mwTab file format into its equivalent JSON file format and vice versa."
- [other] Load an mwTab-formatted file using the mwtab.fileio.read_files function to parse the text structure. Instantiate an MWTabFile object from mwtab.mwtab to represent the parsed data in memory. Apply the converter module functions to traverse the MWTabFile object and transform metadata and tabular sections into JSON-compatible dictionary structures.: "Load an mwTab-formatted file using the mwtab.fileio.read_files function to parse the text structure. Instantiate an MWTabFile object from mwtab.mwtab to represent the parsed data in memory. Apply the"
- [other] Use the pandas library to handle tabular data sections (e.g., METABOLITES, DATA blocks) during conversion, preserving column names and data types.: "Use the pandas library to handle tabular data sections (e.g., METABOLITES, DATA blocks) during conversion, preserving column names and data types."
- [other] Serialize the converted dictionary structure to JSON format using Python's built-in json module, ensuring proper encoding of nested objects and arrays. Write the JSON output to a file with proper formatting and validation against the jsonschema-defined JSON schema to confirm structural correctness.: "Serialize the converted dictionary structure to JSON format using Python's built-in json module, ensuring proper encoding of nested objects and arrays. Write the JSON output to a file with proper"
- [readme] The
mwtabpackage provides facilities to convertmwTabformatted files into their equivalentJSONized representation and vice versa.: "Themwtabpackage provides facilities to convertmwTabformatted files into their equivalentJSONized representation and vice versa." - [readme] As a command-line tool to convert between
mwTabformat and its equivalentJSONrepresentation.: "As a command-line tool to convert betweenmwTabformat and its equivalentJSONrepresentation."
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.