Expand description
bcftools-style VCF filter-expression parser and per-sample evaluator.
Implements the subset of the bcftools filter language needed for
rsomics-vcf-setgt -t q and rsomics-vcf-filter -i/-e:
Supported field references
FMT/<TAG>/FORMAT/<TAG>— per-sample FORMAT field (numeric)INFO/<TAG>— site-level INFO field (numeric or string)QUAL— site-level QUAL column (numeric)FILTER— site-level FILTER stringGT— per-sample genotype with special string values:".","hom","het","ref","alt","miss"/"missing"
Operators
- Comparison:
<<=>>===!= - Logical:
&&|| - Parentheses for grouping
Scoped out (exits with error if used):
- Regex operators
~!~ - Array-index syntax
TAG[0] - Aggregation functions
N_PASS(),F_PASS(),SMPL_MAX(), etc. - Arithmetic
+-*/% - Special fields
N_MISSING,F_MISSING,N_ALT,AC,AN,AF
§Origin
Independent Rust implementation based on the MIT-licensed bcftools source (filter.c, develop branch) and the VCF 4.3 format specification. Consulted: https://github.com/samtools/bcftools License: MIT OR Apache-2.0 Upstream credit: bcftools https://github.com/samtools/bcftools (MIT)
Re-exports§
pub use eval::EvalContext;pub use eval::EvalError;pub use eval::SampleResult;pub use eval::eval_expr;pub use parse::Expr;pub use parse::ParseError;pub use parse::parse_expr;