jcamp-file-parsing
Summary
Parse and validate JCAMP spectral files received via HTTP POST to the ChemSpectra App file-conversion API, extracting metadata and spectral parameters for standardized internal representation. This skill is essential when ingesting vendor-neutral NMR/IR/MS data in JCAMP format for downstream spectral processing and format conversion.
When to use
Apply this skill when you receive uploaded spectral data in JCAMP format (jcamp) as input to the /api/v1/chemspectra/file/convert endpoint, or when you need to extract and validate metadata and peak information from an existing JCAMP file before converting to another format or performing spectral analysis.
When NOT to use
- Input file is in RAW or mzML format — use vendor-specific or proteowizard-based parsing instead.
- JCAMP file is already embedded in a serialized database record — extract the file first before parsing.
- Metadata validation is not required and only raw binary spectral arrays are needed — use direct array extraction without full JCAMP parsing.
Inputs
- JCAMP spectral file (binary or text format)
- HTTP POST request body containing uploaded JCAMP file
- JCAMP metadata headers (e.g., TITLE, JCAMP-DX, DATATYPE)
- JCAMP data blocks (e.g., NMR, IR, MS spectral arrays)
Outputs
- Parsed spectral metadata (sample name, acquisition parameters, spectral type)
- Extracted peak table (chemical shifts, intensities, multiplicities for NMR)
- Standardized internal spectral representation
- Validated JCAMP structure (confirmed header and data block integrity)
How to apply
Receive the JCAMP file as part of an HTTP POST request to the file-conversion endpoint. Parse the JCAMP format using the ChemSpectra App backend parser (built into the Flask service) to extract spectral metadata (e.g., sample name, acquisition parameters, spectral type) and peak tables. Validate that required JCAMP header fields and data blocks are present and correctly formatted. Convert the parsed JCAMP data into the backend's standardized internal representation for NMR/IR/MS spectral data. If the JCAMP file is well-formed and metadata is complete, proceed to serialization or further processing; if validation fails, return an error response indicating the parsing issue. The skill succeeds when metadata and peak tables are accurately extracted without data loss.
Related tools
Examples
curl -X POST http://localhost:3007/api/v1/chemspectra/file/convert -F 'file=@spectrum.jcamp'
Evaluation signals
- Parsed metadata matches expected JCAMP header fields (TITLE, JCAMP-DX, DATATYPE, DATACLASS present and non-empty).
- Extracted peak table contains same number and order of peaks as the original JCAMP data block (verified by count comparison).
- Spectral parameters (frequency, nucleus type, solvent for NMR; resolution, range for IR) are correctly transferred to internal representation.
- HTTP response status is 200 OK with converted file artifact when parsing succeeds; 4xx error when JCAMP structure is malformed.
- No data truncation or loss in chemical shift values, intensities, or multiplicities during parsing and serialization.
Limitations
- JCAMP variant/version differences may cause parsing failures if the backend does not support all JCAMP-DX versions or extensions.
- Files with non-standard or corrupted JCAMP header lines will fail validation; error messages may not pinpoint the exact malformed field.
- Large JCAMP files (many data points or complex peak structures) may incur parsing latency and consume significant memory during internal representation construction.
- Metadata extraction assumes standard JCAMP naming conventions; custom or proprietary metadata fields in JCAMP files may be silently dropped.
Evidence
- [other] Receive HTTP POST request containing an uploaded spectral file (jcamp, RAW, or mzML format) at the /api/v1/chemspectra/file/convert endpoint.: "Receive HTTP POST request containing an uploaded spectral file (jcamp, RAW, or mzML format) at the /api/v1/chemspectra/file/convert endpoint."
- [other] Parse and validate the input file format using proteowizard/pwiz-skyline via the Docker msconvert_docker service to handle vendor-specific RAW formats.: "Parse and validate the input file format using proteowizard/pwiz-skyline via the Docker msconvert_docker service to handle vendor-specific RAW formats."
- [other] Convert the spectral file to a standardized internal representation, extracting metadata and spectral parameters.: "Convert the spectral file to a standardized internal representation, extracting metadata and spectral parameters."
- [intro] This backend web service provides NMR/IR/MS processing for jcamp/RAW/mzML files.: "This backend web service provides NMR/IR/MS processing for jcamp/RAW/mzML files."
- [other] Serialize the converted file to jcamp output format with peak tables and metadata.: "Serialize the converted file to jcamp output format with peak tables and metadata."
1---2name: jcamp-file-parsing3description: Use when you receive uploaded spectral data in JCAMP format (jcamp) as input to the /api/v1/chemspectra/file/convert endpoint, or when you need to extract and validate metadata and peak information from an existing JCAMP file before converting to another format or performing spectral analysis.4license: CC-BY-4.05---67# jcamp-file-parsing89## Summary1011Parse and validate JCAMP spectral files received via HTTP POST to the ChemSpectra App file-conversion API, extracting metadata and spectral parameters for standardized internal representation. This skill is essential when ingesting vendor-neutral NMR/IR/MS data in JCAMP format for downstream spectral processing and format conversion.1213## When to use1415Apply this skill when you receive uploaded spectral data in JCAMP format (jcamp) as input to the /api/v1/chemspectra/file/convert endpoint, or when you need to extract and validate metadata and peak information from an existing JCAMP file before converting to another format or performing spectral analysis.1617## When NOT to use1819- Input file is in RAW or mzML format — use vendor-specific or proteowizard-based parsing instead.20- JCAMP file is already embedded in a serialized database record — extract the file first before parsing.21- Metadata validation is not required and only raw binary spectral arrays are needed — use direct array extraction without full JCAMP parsing.2223## Inputs2425- JCAMP spectral file (binary or text format)26- HTTP POST request body containing uploaded JCAMP file27- JCAMP metadata headers (e.g., TITLE, JCAMP-DX, DATATYPE)28- JCAMP data blocks (e.g., NMR, IR, MS spectral arrays)2930## Outputs3132- Parsed spectral metadata (sample name, acquisition parameters, spectral type)33- Extracted peak table (chemical shifts, intensities, multiplicities for NMR)34- Standardized internal spectral representation35- Validated JCAMP structure (confirmed header and data block integrity)3637## How to apply3839Receive the JCAMP file as part of an HTTP POST request to the file-conversion endpoint. Parse the JCAMP format using the ChemSpectra App backend parser (built into the Flask service) to extract spectral metadata (e.g., sample name, acquisition parameters, spectral type) and peak tables. Validate that required JCAMP header fields and data blocks are present and correctly formatted. Convert the parsed JCAMP data into the backend's standardized internal representation for NMR/IR/MS spectral data. If the JCAMP file is well-formed and metadata is complete, proceed to serialization or further processing; if validation fails, return an error response indicating the parsing issue. The skill succeeds when metadata and peak tables are accurately extracted without data loss.4041## Related tools4243- **Flask** (HTTP framework routing POST requests to /api/v1/chemspectra/file/convert and parsing JCAMP payloads) — https://flask.palletsprojects.com/44- **Python 3** (Language in which JCAMP file parsing and metadata extraction logic is implemented) — https://github.com/ComPlat/chem-spectra-app45- **chem-spectra-app** (Backend web service that orchestrates JCAMP parsing, validation, and conversion) — https://github.com/ComPlat/chem-spectra-app4647## Examples4849```50curl -X POST http://localhost:3007/api/v1/chemspectra/file/convert -F 'file=@spectrum.jcamp'51```5253## Evaluation signals5455- Parsed metadata matches expected JCAMP header fields (TITLE, JCAMP-DX, DATATYPE, DATACLASS present and non-empty).56- Extracted peak table contains same number and order of peaks as the original JCAMP data block (verified by count comparison).57- Spectral parameters (frequency, nucleus type, solvent for NMR; resolution, range for IR) are correctly transferred to internal representation.58- HTTP response status is 200 OK with converted file artifact when parsing succeeds; 4xx error when JCAMP structure is malformed.59- No data truncation or loss in chemical shift values, intensities, or multiplicities during parsing and serialization.6061## Limitations6263- JCAMP variant/version differences may cause parsing failures if the backend does not support all JCAMP-DX versions or extensions.64- Files with non-standard or corrupted JCAMP header lines will fail validation; error messages may not pinpoint the exact malformed field.65- Large JCAMP files (many data points or complex peak structures) may incur parsing latency and consume significant memory during internal representation construction.66- Metadata extraction assumes standard JCAMP naming conventions; custom or proprietary metadata fields in JCAMP files may be silently dropped.6768## Evidence6970- [other] Receive HTTP POST request containing an uploaded spectral file (jcamp, RAW, or mzML format) at the /api/v1/chemspectra/file/convert endpoint.: "Receive HTTP POST request containing an uploaded spectral file (jcamp, RAW, or mzML format) at the /api/v1/chemspectra/file/convert endpoint."71- [other] Parse and validate the input file format using proteowizard/pwiz-skyline via the Docker msconvert_docker service to handle vendor-specific RAW formats.: "Parse and validate the input file format using proteowizard/pwiz-skyline via the Docker msconvert_docker service to handle vendor-specific RAW formats."72- [other] Convert the spectral file to a standardized internal representation, extracting metadata and spectral parameters.: "Convert the spectral file to a standardized internal representation, extracting metadata and spectral parameters."73- [intro] This backend web service provides NMR/IR/MS processing for jcamp/RAW/mzML files.: "This backend web service provides NMR/IR/MS processing for jcamp/RAW/mzML files."74- [other] Serialize the converted file to jcamp output format with peak tables and metadata.: "Serialize the converted file to jcamp output format with peak tables and metadata."