moonbit-vcfkit is a native MoonBit toolkit for Variant Call Format text data. It focuses on the parts that are useful before a project needs the full htslib stack: header inspection, typed record parsing, compact filtering, small transformations, deterministic writing, and testable command behavior.
The package is written in MoonBit and uses synthetic fixtures only. It is intended for developer tools, teaching fixtures, lightweight data checks, and MoonBit ecosystem experiments. It is not a clinical validation tool.
What Works
Parse VCF 4.x-style header lines, including INFO, FORMAT, FILTER, contig, fileformat, and generic metadata.
Parse records into typed INFO and FORMAT values using header descriptors.
Filter records with expressions such as qual >= 30, has info.SOMATIC, and format.TUMOR.DP >= 20.
Split multi-allelic records into one alternate allele per output record.
Apply basic allele trimming normalization for simple single-alt records.
Serialize documents back to stable VCF text.
Summarize contigs, filters, INFO keys, sample count, multi-allelic records, and variant classes.
Run golden tests across wasm, wasm-gc, JavaScript, and native targets.
Provide a small CLI harness package plus cmd/vcfkit entrypoint.
cmd/vcfkit: executable entrypoint; reads demo input from VCFKIT_INPUT.
internal/text: small scanner helpers.
internal/normalize: allele trimming helper.
Quick Check
moon version --all
moon check --target all --deny-warn
moon test --target all --deny-warn
moon fmt --check
moon info
The repository also includes:
pwsh scripts/audit.ps1
CLI Demo
The executable path is intentionally thin. For shell demos, pass VCF text through VCFKIT_INPUT:
moon run cmd/vcfkit -- help
Core command behavior is tested through cli.run_cli_text(argv, input), so applications can embed the same logic without depending on shell IO.
Fixture Example
fixtures/basic.vcf contains three synthetic records covering a SNV, a multi-allelic insertion case, a deletion, typed INFO values, and FORMAT sample values. Expected outputs live under fixtures/golden/.
Current Boundaries
This version handles plain VCF text. It does not implement BCF, bgzip/tabix indexing, streaming decompression, external FASTA-backed left alignment, annotation databases, or clinical interpretation.
Source Notes
The implementation is original MoonBit source. VCF behavior is informed by the public hts-specs VCF documents, and MoonBit CI follows the public moonbit-community/.github workflow template shape with stricter warning checks. See docs/sources.md and docs/self-audit.md.
License
Apache-2.0.
关于
Native MoonBit toolkit for parsing, filtering, transforming, and inspecting VCF text data
MoonBit VCF Kit
moonbit-vcfkitis a native MoonBit toolkit for Variant Call Format text data. It focuses on the parts that are useful before a project needs the full htslib stack: header inspection, typed record parsing, compact filtering, small transformations, deterministic writing, and testable command behavior.The package is written in MoonBit and uses synthetic fixtures only. It is intended for developer tools, teaching fixtures, lightweight data checks, and MoonBit ecosystem experiments. It is not a clinical validation tool.
What Works
INFO,FORMAT,FILTER,contig,fileformat, and generic metadata.qual >= 30,has info.SOMATIC, andformat.TUMOR.DP >= 20.cmd/vcfkitentrypoint.Package Map
filter: expression parser and evaluator.cli: pure command dispatcher over VCF text.cmd/vcfkit: executable entrypoint; reads demo input fromVCFKIT_INPUT.internal/text: small scanner helpers.internal/normalize: allele trimming helper.Quick Check
The repository also includes:
CLI Demo
The executable path is intentionally thin. For shell demos, pass VCF text through
VCFKIT_INPUT:Core command behavior is tested through
cli.run_cli_text(argv, input), so applications can embed the same logic without depending on shell IO.Fixture Example
fixtures/basic.vcfcontains three synthetic records covering a SNV, a multi-allelic insertion case, a deletion, typed INFO values, and FORMAT sample values. Expected outputs live underfixtures/golden/.Current Boundaries
This version handles plain VCF text. It does not implement BCF, bgzip/tabix indexing, streaming decompression, external FASTA-backed left alignment, annotation databases, or clinical interpretation.
Source Notes
The implementation is original MoonBit source. VCF behavior is informed by the public hts-specs VCF documents, and MoonBit CI follows the public
moonbit-community/.githubworkflow template shape with stricter warning checks. Seedocs/sources.mdanddocs/self-audit.md.License
Apache-2.0.