Skip to content
Back to skills

Structured Data Serialization

ASecurity

Use when when you have mwTab-formatted Mass Spectrometry or Nuclear Magnetic

  • 16 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 12, 2026
ai-agentspythongitapi

Works with

  • api

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add HolobiomicsLab/asb-skill-collections --skill structured-data-serialization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Structured Data Serialization?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Structured Data Serialization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/holobiomicslab-structured-data-serialization/badge)](https://www.skillsdirectory.com/skills/holobiomicslab-structured-data-serialization)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: structured-data-serialization
description: 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.
license: CC-BY-4.0
metadata:
  edam_operation: http://edamontology.org/operation_0335
  edam_topics:
  - http://edamontology.org/topic_3172
  - http://edamontology.org/topic_3370
  - http://edamontology.org/topic_0091
  tools:
  - Python
  - jsonschema
  - mwtab
  - pandas
  - Python json module
  techniques:
  - mass-spectrometry
  license_tier: open
  provenance_tier: literature
derived_from:
- doi: 10.3390/metabo11030163
  title: mwtab Python Library for RESTful Access
evidence_spans:
- The ``mwtab`` package is a Python library
- jsonschema_ for validating functionality of ``mwTab`` files based on ``JSON`` schema
claims: []
provenance:
  collection: https://w3id.org/holobiomicslab/asb-skill/collection/metabolomics/v2
  assembled_by: scripts/collect_metabolomics_collection.py
  sources:
  - build: coll_mwtab_python_library_for_restful_access_cq
    doi: 10.3390/metabo11030163
    title: mwtab Python Library for RESTful Access
  dedup_kept_from: coll_mwtab_python_library_for_restful_access_cq
schema_version: 0.2.0
attribution:
  generator: AgenticScienceBuilder
  original_doi: 10.3390/metabo11030163
  all_source_dois:
  - 10.3390/metabo11030163
  zenodo_doi: 10.5281/zenodo.20794027
  curators: []
  promoter: Louis-Félix Nothias
  sponsor: CNRS & Université Côte d'Azur
---

# 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 ``mwtab`` package provides facilities to convert ``mwTab`` formatted files into their equivalent ``JSON`` ized representation and vice versa.: "The ``mwtab`` package provides facilities to convert ``mwTab`` formatted files into their equivalent ``JSON`` ized representation and vice versa."
- [readme] As a command-line tool to convert between ``mwTab`` format and its equivalent ``JSON`` representation.: "As a command-line tool to convert between ``mwTab`` format and its equivalent ``JSON`` representation."

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.