- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.6 KiB
This Go package obiformats provides semantic parsing and serialization utilities for FASTQ/FASTA sequence headers encoded in JSON format, primarily used within the OBITools4 framework.
-
JSON Parsing Helpers:
It defines internal functions (_parse_json_map_*,_parse_json_array_*) to convert JSON objects/arrays into typed Go maps and slices (map[string]string,[]int, etc.), using the high-performancejsonparserlibrary for streaming parsing. -
Header Interpretation:
_parse_json_header_interprets a FASTQ/FASTA header string containing embedded JSON metadata. It extracts and assigns:- Core fields (
id,definition,count) - Specialized OBITools annotations (e.g.,
"obiclean_weight","taxid"with optional taxonomic ranks) - Generic annotations of any JSON type (string, number, bool, array, object), preserving numeric precision where possible.
- Core fields (
-
Sequence Annotation Enrichment:
ParseFastSeqJsonHeaderparses the header of aBioSequence, extracting JSON metadata into its annotations map and reconstructing non-JSON text as the new definition. -
Serialization Support:
WriteFastSeqJsonHeaderandFormatFastSeqJsonHeaderserialize sequence annotations back into JSON format, appending them to a buffer or returning as string — enabling round-trip compatibility for annotated sequences. -
Error Handling:
Useslog.Fatalfon parsing failures, ensuring malformed headers fail fast during processing.
In summary: structured JSON header ↔ BioSequence annotation mapping, optimized for metabarcoding workflows.